summaryrefslogtreecommitdiffstats
path: root/ipc/util.c
diff options
context:
space:
mode:
authorNadia Derbey <Nadia.Derbey@bull.net>2007-10-18 23:40:51 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 11:53:44 -0700
commit023a53557ea0e987b002e9a844242ef0b0aa1eb3 (patch)
tree7f3accdd7cb1d801607bf71e56b9b99e9c7ff7ca /ipc/util.c
parent637c36634029e4e7c81112796dafc32d56355b4a (diff)
downloadblackbird-op-linux-023a53557ea0e987b002e9a844242ef0b0aa1eb3.tar.gz
blackbird-op-linux-023a53557ea0e987b002e9a844242ef0b0aa1eb3.zip
ipc: integrate ipc_checkid() into ipc_lock()
This patch introduces a new ipc_lock_check() routine interface: . each time ipc_checkid() is called, this is done after calling ipc_lock(). ipc_checkid() is now called from inside ipc_lock_check(). [akpm@linux-foundation.org: build fix] [akpm@linux-foundation.org: fix RCU locking] Signed-off-by: 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/util.c')
-rw-r--r--ipc/util.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/ipc/util.c b/ipc/util.c
index e72865f677a7..9b0c4e7753af 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -678,7 +678,7 @@ struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
out = idr_find(&ids->ipcs_idr, lid);
if (out == NULL) {
rcu_read_unlock();
- return NULL;
+ return ERR_PTR(-EINVAL);
}
spin_lock(&out->lock);
@@ -689,36 +689,17 @@ struct kern_ipc_perm *ipc_lock(struct ipc_ids *ids, int id)
if (out->deleted) {
spin_unlock(&out->lock);
rcu_read_unlock();
- return NULL;
+ return ERR_PTR(-EINVAL);
}
return out;
}
-void ipc_lock_by_ptr(struct kern_ipc_perm *perm)
-{
- rcu_read_lock();
- spin_lock(&perm->lock);
-}
-
-void ipc_unlock(struct kern_ipc_perm* perm)
-{
- spin_unlock(&perm->lock);
- rcu_read_unlock();
-}
-
int ipc_buildid(struct ipc_ids* ids, int id, int seq)
{
return SEQ_MULTIPLIER*seq + id;
}
-int ipc_checkid(struct ipc_ids* ids, struct kern_ipc_perm* ipcp, int uid)
-{
- if(uid/SEQ_MULTIPLIER != ipcp->seq)
- return 1;
- return 0;
-}
-
#ifdef __ARCH_WANT_IPC_PARSE_VERSION
OpenPOWER on IntegriCloud