X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ipc%2Futil.h;h=3b3adb2d54b431fb58af7f6f326fbbd2a8f33626;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=8697df67b592d7177ce623ea07f0caa431fc41b4;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/ipc/util.h b/ipc/util.h index 8697df67b..3b3adb2d5 100644 --- a/ipc/util.h +++ b/ipc/util.h @@ -45,14 +45,20 @@ int ipcperms (struct kern_ipc_perm *ipcp, short flg); */ void* ipc_alloc(int size); void ipc_free(void* ptr, int size); -/* for allocation that need to be freed by RCU - * both function can sleep + +/* + * For allocation that need to be freed by RCU. + * Objects are reference counted, they start with reference count 1. + * getref increases the refcount, the putref call that reduces the recount + * to 0 schedules the rcu destruction. Caller must guarantee locking. */ void* ipc_rcu_alloc(int size); -void ipc_rcu_free(void* arg, int size); +void ipc_rcu_getref(void *ptr); +void ipc_rcu_putref(void *ptr); struct kern_ipc_perm* ipc_get(struct ipc_ids* ids, int id); struct kern_ipc_perm* ipc_lock(struct ipc_ids* ids, int id); +void ipc_lock_by_ptr(struct kern_ipc_perm *ipcp); void ipc_unlock(struct kern_ipc_perm* perm); int ipc_buildid(struct ipc_ids* ids, int id, int seq); int ipc_checkid(struct ipc_ids* ids, struct kern_ipc_perm* ipcp, int uid);