4 #include <linux/types.h>
5 #include <linux/list.h>
6 #include <linux/rbtree.h>
7 #include <linux/rcupdate.h>
8 #include <linux/sysctl.h>
9 #include <linux/rwsem.h>
10 #include <linux/atomic.h>
16 struct user_key_payload {
17 size_t datalen; /* length of this data */
18 char data[0]; /* actual data */
22 atomic_t usage; /* number of references */
23 key_serial_t serial; /* key serial number */
24 struct rw_semaphore sem; /* change vs change sem */
25 struct user_key_payload payload;
28 static inline const struct user_key_payload *user_key_payload(const struct key *key)
33 static inline void key_put(struct key *key)
35 if (atomic_dec_and_test(&key->usage))
39 static inline struct key *__key_get(struct key *key)
41 atomic_inc(&key->usage);
45 static inline struct key *key_get(struct key *key)
47 return key ? __key_get(key) : key;
50 #endif /* _LINUX_KEY_H */