Re: [PATCH 2.6.24-mm1 8/8] (resend) IPC: consolidate all xxxctl_down() functions

Previous thread: [PATCH 2.6.24-mm1 7/8] (resend) IPC: introduce ipc_update_perm() by pierre.peiffer on Tuesday, February 12, 2008 - 9:13 am. (1 message)

Next thread: Re: [PATCH] libata: Add MMIO support to pata_sil680 by Tim Ellis on Tuesday, February 12, 2008 - 8:58 am. (16 messages)
From: pierre.peiffer
Date: Tuesday, February 12, 2008 - 9:13 am

semctl_down(), msgctl_down() and shmctl_down() are used to handle the same
set of commands for each kind of IPC. They all start to do the same job (they
retrieve the ipc and do some permission checks) before handling the commands
on their own.

This patch proposes to consolidate this by moving these same pieces of code
into one common function called ipcctl_pre_down().
It simplifies a little these xxxctl_down() functions and increases a little
the maintainability.

Signed-off-by: Pierre Peiffer <pierre.peiffer@bull.net>
Acked-by: Serge Hallyn <serue@us.ibm.com>
---
 ipc/msg.c  |   48 +++++-------------------------------------------
 ipc/sem.c  |   42 ++++--------------------------------------
 ipc/shm.c  |   42 ++++--------------------------------------
 ipc/util.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 ipc/util.h |    2 ++
 5 files changed, 66 insertions(+), 119 deletions(-)

Index: b/ipc/sem.c
===================================================================
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -141,21 +141,6 @@ void __init sem_init (void)
 }
 
 /*
- * This routine is called in the paths where the rw_mutex is held to protect
- * access to the idr tree.
- */
-static inline struct sem_array *sem_lock_check_down(struct ipc_namespace *ns,
-						int id)
-{
-	struct kern_ipc_perm *ipcp = ipc_lock_check_down(&sem_ids(ns), id);
-
-	if (IS_ERR(ipcp))
-		return (struct sem_array *)ipcp;
-
-	return container_of(ipcp, struct sem_array, sem_perm);
-}
-
-/*
  * sem_lock_(check_) routines are called in the paths where the rw_mutex
  * is not held.
  */
@@ -878,31 +863,12 @@ static int semctl_down(struct ipc_namesp
 		if (copy_semid_from_user(&semid64, arg.buf, version))
 			return -EFAULT;
 	}
-	down_write(&sem_ids(ns).rw_mutex);
-	sma = sem_lock_check_down(ns, semid);
-	if (IS_ERR(sma)) {
-		err = PTR_ERR(sma);
-		goto out_up;
-	}
-
-	ipcp = &sma->sem_perm;
 
-	err = audit_ipc_obj(ipcp);
-	if (err)
-		goto out_unlock;
+	ipcp = ...
From: Randy Dunlap
Date: Tuesday, March 4, 2008 - 5:03 pm

Hi,
kernel-doc here causes a warning in 2.6.25-rc3-mm1:

Warning(linux-2.6.25-rc3-mm1//ipc/util.c:845): No description found for parameter 'extrat_perm'








---
~Randy
--

Previous thread: [PATCH 2.6.24-mm1 7/8] (resend) IPC: introduce ipc_update_perm() by pierre.peiffer on Tuesday, February 12, 2008 - 9:13 am. (1 message)

Next thread: Re: [PATCH] libata: Add MMIO support to pata_sil680 by Tim Ellis on Tuesday, February 12, 2008 - 8:58 am. (16 messages)