4 #include <linux/types.h>
5 #include <linux/atomic.h>
8 struct user_key_payload {
9 size_t datalen; /* length of this data */
10 char data[0]; /* actual data */
14 atomic_t usage; /* number of references */
15 key_serial_t serial; /* key serial number */
16 struct rw_semaphore sem; /* change vs change sem */
17 struct user_key_payload payload;
20 static inline const struct user_key_payload *user_key_payload(const struct key *key)
25 static inline void key_put(struct key *key)
27 if (atomic_dec_and_test(&key->usage))
31 static inline struct key *__key_get(struct key *key)
33 atomic_inc(&key->usage);
37 static inline struct key *key_get(struct key *key)
39 return key ? __key_get(key) : key;
42 #endif /* _LINUX_KEY_H */