1 #ifndef __LUSTRE_HANDLES_H_
2 #define __LUSTRE_HANDLES_H_
5 #include <linux/lustre_handles.h>
6 #elif defined(__APPLE__)
7 #include <darwin/lustre_handles.h>
8 #elif defined(__WINNT__)
9 #include <winnt/lustre_handles.h>
11 #error Unsupported operating system.
14 typedef void (*portals_handle_addref_cb)(void *object);
16 /* These handles are most easily used by having them appear at the very top of
17 * whatever object that you want to make handles for. ie:
20 * struct portals_handle handle;
24 * Now you're able to assign the results of cookie2handle directly to an
25 * ldlm_lock. If it's not at the top, you'll want to hack up a macro that
26 * uses some offsetof() magic. */
28 struct portals_handle {
29 struct list_head h_link;
31 portals_handle_addref_cb h_addref;
33 /* newly added fields to handle the RCU issue. -jxiong */
36 void (*h_free_cb)(void *, size_t);
37 struct rcu_head h_rcu;
42 #define RCU2HANDLE(rcu) container_of(rcu, struct portals_handle, h_rcu)
46 /* Add a handle to the hash table */
47 void class_handle_hash(struct portals_handle *, portals_handle_addref_cb);
48 void class_handle_unhash(struct portals_handle *);
49 void class_handle_hash_back(struct portals_handle *);
50 void *class_handle2object(__u64 cookie);
51 void class_handle_free_cb(struct rcu_head *);
52 int class_handle_init(void);
53 void class_handle_cleanup(void);