From: Nadia.Derbey@bull.net
To: linux-kernel@vger.kernel.org
Cc: matthltc@us.ibm.com, Nadia Derbey <Nadia.Derbey@bull.net>
Subject: [RFC][PATCH 5/6] Introducing the ipcid_to_idx macro
Date: Fri, 31 Aug 2007 13:24:50 +0200 [thread overview]
Message-ID: <20070831112615.093123000@bull.net> (raw)
In-Reply-To: <20070831112445.976429000@bull.net>
[-- Attachment #1: ipcid_to_idx.patch --]
[-- Type: text/plain, Size: 1613 bytes --]
[PATCH 05/06]
This is a trivial patch that changes all the (id % SEQ_MULTIPLIER) into a call
to the ipcid_to_idx(id) macro.
Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>
---
ipc/util.c | 4 ++--
ipc/util.h | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
Index: linux-2.6.23-rc2/ipc/util.h
===================================================================
--- linux-2.6.23-rc2.orig/ipc/util.h 2007-08-31 12:26:31.000000000 +0200
+++ linux-2.6.23-rc2/ipc/util.h 2007-08-31 12:53:30.000000000 +0200
@@ -78,6 +78,8 @@ void __init ipc_init_proc_interface(cons
#define IPC_MSG_IDS 1
#define IPC_SHM_IDS 2
+#define ipcid_to_idx(id) ((id) % SEQ_MULTIPLIER)
+
/* must be called with ids->mutex acquired.*/
int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int);
int ipc_get_maxid(struct ipc_ids *);
Index: linux-2.6.23-rc2/ipc/util.c
===================================================================
--- linux-2.6.23-rc2.orig/ipc/util.c 2007-08-31 12:29:32.000000000 +0200
+++ linux-2.6.23-rc2/ipc/util.c 2007-08-31 12:54:39.000000000 +0200
@@ -413,7 +413,7 @@ int ipcget_public(struct ipc_namespace *
void ipc_rmid(struct ipc_ids *ids, struct kern_ipc_perm *ipcp)
{
- int lid = ipcp->id % SEQ_MULTIPLIER;
+ int lid = ipcid_to_idx(ipcp->id);
idr_remove(&ids->ipcs_idr, lid);
@@ -672,7 +672,7 @@ void ipc64_perm_to_ipc_perm (struct ipc6
struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
{
struct kern_ipc_perm *out;
- int lid = id % SEQ_MULTIPLIER;
+ int lid = ipcid_to_idx(id);
rcu_read_lock();
out = idr_find(&ids->ipcs_idr, lid);
--
next prev parent reply other threads:[~2007-08-31 11:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-31 11:24 [RFC][PATCH 0/6] An IPC implementation base on Linux IDRs Nadia.Derbey
2007-08-31 11:24 ` [RFC][PATCH 1/6] Storing ipcs into IDRs Nadia.Derbey
2007-09-01 22:12 ` Andi Kleen
2007-09-03 10:16 ` Nadia Derbey
2007-09-06 9:33 ` Nadia Derbey
2007-09-07 15:18 ` Nadia Derbey
2007-09-10 20:08 ` Andrew Morton
2007-08-31 11:24 ` [RFC][PATCH 2/6] Unifying the syscalls code Nadia.Derbey
2007-08-31 11:24 ` [RFC][PATCH 3/6] Removing the ipc_get() routine Nadia.Derbey
2007-08-31 11:24 ` [RFC][PATCH 4/6] Integrating ipc_checkid() into ipc_lock() Nadia.Derbey
2007-08-31 11:24 ` Nadia.Derbey [this message]
2007-08-31 11:24 ` [RFC][PATCH 6/6] Inlining ipc_buildid() Nadia.Derbey
-- strict thread matches above, loose matches on Subject: below --
2007-06-07 16:53 [RFC][PATCH 0/6] an IPC implementation based on Linux radix trees Nadia.Derbey
2007-06-07 16:53 ` [RFC][PATCH 5/6] Introducing the ipcid_to_idx macro Nadia.Derbey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070831112615.093123000@bull.net \
--to=nadia.derbey@bull.net \
--cc=linux-kernel@vger.kernel.org \
--cc=matthltc@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®