1 #ifndef __LINUX_HANDLES_H_
2 #define __LINUX_HANDLES_H_
6 #include <asm/atomic.h>
7 #include <linux/list.h>
10 typedef void (*portals_handle_addref_cb)(void *object);
12 /* These handles are most easily used by having them appear at the very top of
13 * whatever object that you want to make handles for. ie:
16 * struct portals_handle handle;
20 * Now you're able to assign the results of cookie2handle directly to an
21 * ldlm_lock. If it's not at the top, you'll want to hack up a macro that
22 * uses some offsetof() magic. */
24 struct portals_handle {
25 struct list_head h_link;
27 portals_handle_addref_cb h_addref;
32 /* Add a handle to the hash table */
33 void class_handle_hash(struct portals_handle *, portals_handle_addref_cb);
34 void class_handle_unhash(struct portals_handle *);
35 void *class_handle2object(__u64 cookie);
36 int class_handle_init(void);
37 void class_handle_cleanup(void);