aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/shm.c
diff options
context:
space:
mode:
authorPierre Peiffer <pierre.peiffer@bull.net>2008-04-29 04:00:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-29 11:06:12 -0400
commit48dea404ed01869313f1908cca8a15774dcd8ee5 (patch)
treec4c50c9032556cf96b21f8704e4544998769b6b9 /ipc/shm.c
parent02d15c43225afb2ebb6d700144285175a1c4abd9 (diff)
IPC: use ipc_buildid() directly from ipc_addid()
By continuing to consolidate a little the IPC code, each id can be built directly in ipc_addid() instead of having it built from each callers of ipc_addid() And I also remove shm_addid() in order to have, as much as possible, the same code for shm/sem/msg. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Pierre Peiffer <pierre.peiffer@bull.net> Cc: Nadia Derbey <Nadia.Derbey@bull.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/shm.c')
-rw-r--r--ipc/shm.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index e636910454a9..3e4aff982546 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -60,7 +60,6 @@ static struct vm_operations_struct shm_vm_ops;
60 60
61#define shm_unlock(shp) \ 61#define shm_unlock(shp) \
62 ipc_unlock(&(shp)->shm_perm) 62 ipc_unlock(&(shp)->shm_perm)
63#define shm_buildid(id, seq) ipc_buildid(id, seq)
64 63
65static int newseg(struct ipc_namespace *, struct ipc_params *); 64static int newseg(struct ipc_namespace *, struct ipc_params *);
66static void shm_open(struct vm_area_struct *vma); 65static void shm_open(struct vm_area_struct *vma);
@@ -169,12 +168,6 @@ static inline void shm_rmid(struct ipc_namespace *ns, struct shmid_kernel *s)
169 ipc_rmid(&shm_ids(ns), &s->shm_perm); 168 ipc_rmid(&shm_ids(ns), &s->shm_perm);
170} 169}
171 170
172static inline int shm_addid(struct ipc_namespace *ns, struct shmid_kernel *shp)
173{
174 return ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni);
175}
176
177
178 171
179/* This is called by fork, once for every shm attach. */ 172/* This is called by fork, once for every shm attach. */
180static void shm_open(struct vm_area_struct *vma) 173static void shm_open(struct vm_area_struct *vma)
@@ -416,7 +409,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
416 if (IS_ERR(file)) 409 if (IS_ERR(file))
417 goto no_file; 410 goto no_file;
418 411
419 id = shm_addid(ns, shp); 412 id = ipc_addid(&shm_ids(ns), &shp->shm_perm, ns->shm_ctlmni);
420 if (id < 0) { 413 if (id < 0) {
421 error = id; 414 error = id;
422 goto no_id; 415 goto no_id;
@@ -428,7 +421,6 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
428 shp->shm_ctim = get_seconds(); 421 shp->shm_ctim = get_seconds();
429 shp->shm_segsz = size; 422 shp->shm_segsz = size;
430 shp->shm_nattch = 0; 423 shp->shm_nattch = 0;
431 shp->shm_perm.id = shm_buildid(id, shp->shm_perm.seq);
432 shp->shm_file = file; 424 shp->shm_file = file;
433 /* 425 /*
434 * shmid gets reported as "inode#" in /proc/pid/maps. 426 * shmid gets reported as "inode#" in /proc/pid/maps.