Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=ce621f5ba52f30dd59aef4fb50276faee04ef9cf
Commit:     ce621f5ba52f30dd59aef4fb50276faee04ef9cf
Parent:     03f02c7657f7948ab980280c54c9366f962b1474
Author:     Nadia Derbey <[EMAIL PROTECTED]>
AuthorDate: Thu Oct 18 23:40:52 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Oct 19 11:53:46 2007 -0700

    ipc: introduce the ipcid_to_idx macro
    
    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 <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 ipc/util.c |    4 ++--
 ipc/util.h |    2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ipc/util.c b/ipc/util.c
index 9b0c4e7..c51c96f 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -413,7 +413,7 @@ int ipcget_public(struct ipc_namespace *ns, struct ipc_ids 
*ids,
  
 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 ipc64_perm *in, struct 
ipc_perm *out)
 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);
diff --git a/ipc/util.h b/ipc/util.h
index 2a03d8c..fa7e7a0 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -79,6 +79,8 @@ void __init ipc_init_proc_interface(const char *path, const 
char *header,
 #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 *);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to