dc68054305
- Restore 29 recipe symlinks (libdrm, qtbase, dbus, sddm, pipewire, etc.) - Restore 33 patches (KDE, libdrm, mesa, pipewire, sddm, wireplumber) - Restore 20+ local/scripts (audit, lint, test, build helpers) - Restore src/cook/scheduler.rs, status.rs, gnu-config/ - Restore scripts/patch-inclusion-gate.sh, run_mini1.sh, validate-collision-log.sh - Recover TLC source from HEAD (was overwritten by 0.2.3 checkout) - Recover 11 local/docs plans from HEAD (were overwritten) - Recover qt6-wayland-smoke symlink from HEAD - Fix MOTD: remove garbled ASCII art, use clean text - Update version: 0.2.0 -> 0.2.4 in os-release, motd, config - Reduce filesystem_size: 1536 -> 512 MiB - Add ABSOLUTE RULE to AGENTS.md: never delete/ignore packages - Reduce pcid scheme log verbosity: info -> debug
64 lines
1.3 KiB
C
64 lines
1.3 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _FS_CEPH_STRING_TABLE_H
|
|
#define _FS_CEPH_STRING_TABLE_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/kref.h>
|
|
#include <linux/rbtree.h>
|
|
#include <linux/rcupdate.h>
|
|
|
|
struct ceph_string {
|
|
struct kref kref;
|
|
union {
|
|
struct rb_node node;
|
|
struct rcu_head rcu;
|
|
};
|
|
size_t len;
|
|
char str[];
|
|
};
|
|
|
|
extern void ceph_release_string(struct kref *ref);
|
|
extern struct ceph_string *ceph_find_or_create_string(const char *str,
|
|
size_t len);
|
|
extern bool ceph_strings_empty(void);
|
|
|
|
static inline struct ceph_string *ceph_get_string(struct ceph_string *str)
|
|
{
|
|
kref_get(&str->kref);
|
|
return str;
|
|
}
|
|
|
|
static inline void ceph_put_string(struct ceph_string *str)
|
|
{
|
|
if (!str)
|
|
return;
|
|
kref_put(&str->kref, ceph_release_string);
|
|
}
|
|
|
|
static inline int ceph_compare_string(struct ceph_string *cs,
|
|
const char* str, size_t len)
|
|
{
|
|
size_t cs_len = cs ? cs->len : 0;
|
|
if (cs_len != len)
|
|
return cs_len - len;
|
|
if (len == 0)
|
|
return 0;
|
|
return strncmp(cs->str, str, len);
|
|
}
|
|
|
|
#define ceph_try_get_string(x) \
|
|
({ \
|
|
struct ceph_string *___str; \
|
|
rcu_read_lock(); \
|
|
for (;;) { \
|
|
___str = rcu_dereference(x); \
|
|
if (!___str || \
|
|
kref_get_unless_zero(&___str->kref)) \
|
|
break; \
|
|
} \
|
|
rcu_read_unlock(); \
|
|
(___str); \
|
|
})
|
|
|
|
#endif
|