Commit ce621f5b authored by Nadia Derbey's avatar Nadia Derbey Committed by Linus Torvalds

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: default avatarNadia Derbey <Nadia.Derbey@bull.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 03f02c76
...@@ -413,7 +413,7 @@ int ipcget_public(struct ipc_namespace *ns, struct ipc_ids *ids, ...@@ -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) 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); idr_remove(&ids->ipcs_idr, lid);
...@@ -672,7 +672,7 @@ void ipc64_perm_to_ipc_perm (struct ipc64_perm *in, struct ipc_perm *out) ...@@ -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 *ipc_lock(struct ipc_ids *ids, int id)
{ {
struct kern_ipc_perm *out; struct kern_ipc_perm *out;
int lid = id % SEQ_MULTIPLIER; int lid = ipcid_to_idx(id);
rcu_read_lock(); rcu_read_lock();
out = idr_find(&ids->ipcs_idr, lid); out = idr_find(&ids->ipcs_idr, lid);
......
...@@ -79,6 +79,8 @@ void __init ipc_init_proc_interface(const char *path, const char *header, ...@@ -79,6 +79,8 @@ void __init ipc_init_proc_interface(const char *path, const char *header,
#define IPC_MSG_IDS 1 #define IPC_MSG_IDS 1
#define IPC_SHM_IDS 2 #define IPC_SHM_IDS 2
#define ipcid_to_idx(id) ((id) % SEQ_MULTIPLIER)
/* must be called with ids->mutex acquired.*/ /* must be called with ids->mutex acquired.*/
int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int); int ipc_addid(struct ipc_ids *, struct kern_ipc_perm *, int);
int ipc_get_maxid(struct ipc_ids *); int ipc_get_maxid(struct ipc_ids *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment