1 #ifndef _FS_CEPH_STRING_TABLE_H
2 #define _FS_CEPH_STRING_TABLE_H
4 #include <linux/types.h>
5 #include <linux/kref.h>
6 #include <linux/rbtree.h>
7 #include <linux/rcupdate.h>
19 extern void ceph_release_string(struct kref *ref);
20 extern struct ceph_string *ceph_find_or_create_string(const char *str,
22 extern bool ceph_strings_empty(void);
24 static inline struct ceph_string *ceph_get_string(struct ceph_string *str)
30 static inline void ceph_put_string(struct ceph_string *str)
34 kref_put(&str->kref, ceph_release_string);
37 static inline int ceph_compare_string(struct ceph_string *cs,
38 const char* str, size_t len)
40 size_t cs_len = cs ? cs->len : 0;
45 return strncmp(cs->str, str, len);
48 #define ceph_try_get_string(x) \
50 struct ceph_string *___str; \
53 ___str = rcu_dereference(x); \
55 kref_get_unless_zero(&___str->kref)) \