30 if (cur->name ==
NULL)
56 mos_warn(
"dentry refcount is already 0");
66 pr_dinfo2(vfs,
"inode %p has no more references, releasing", (
void *) dentry->
inode);
79 pr_dinfo2(dcache_ref,
" mountpoint %p '%s' decreased mountpoint refcount to %zu", (
void *) mountpoint,
dentry_name(mountpoint), mountpoint->
refcount);
91 receiver(depth, dentry,
false, receiver_data);
96 receiver(depth, dentry,
true, receiver_data);
109 size_t expected_refcount = 0;
126 expected_refcount += child->refcount;
129 if (dentry->
refcount < expected_refcount)
131 mos_warn(
"dentry %p refcount %zu is less than expected refcount %zu", (
void *) dentry, dentry->
refcount, expected_refcount);
134 pr_warn(
" child %p '%s' has %zu references", (
void *) child,
dentry_name(child), child->refcount);
136 mos_panic(
"don't know how to handle this");
138 else if (dentry->
refcount - expected_refcount)
140 pr_dinfo2(dcache_ref,
" dentry %p '%s' has %zu direct references", (
void *) dentry,
dentry_name(dentry), dentry->
refcount - expected_refcount);
198 char *newpath = kmalloc(
strlen(path) + 3);
207 const size_t real_size =
snprintf(buf,
size,
"%s", path);
225 const size_t real_size =
snprintf(buf,
size,
"/%s", path);
#define mos_warn(fmt,...)
void dentry_dump_refstat(const dentry_t *dentry, dump_refstat_receiver_t *receiver, void *receiver_data)
dentry_t * dentry_ref_up_to(dentry_t *dentry, dentry_t *root)
Increment the reference count of a dentry up to a given dentry.
void dump_refstat_receiver_t(int depth, const dentry_t *dentry, bool mountroot, void *data)
void dentry_try_release(dentry_t *dentry)
ssize_t dentry_path(dentry_t *dentry, dentry_t *root, char *buf, size_t size)
Get the path of a dentry.
dentry_t * dentry_ref(dentry_t *dentry)
Increment the reference count of a dentry.
should_inline dentry_t * dentry_parent(const dentry_t *dentry)
void dentry_check_refstat(const dentry_t *dentry)
Check the reference count of a dentry.
void dentry_unref(dentry_t *dentry)
Decrement the reference count of a dentry.
__nodiscard bool dentry_unref_one_norelease(dentry_t *dentry)
Decrease the refcount of ONE SINGLE dentry, including (if it's a mountpoint) the mountpoint dentry.
MOSAPI char * strcat(char *__restrict dest, const char *__restrict src)
MOSAPI char * strcpy(char *__restrict dest, const char *__restrict src)
MOSAPI char * strdup(const char *src)
MOSAPI bool list_is_empty(const list_node_t *head)
#define list_remove(element)
void inode_ref(inode_t *inode)
bool inode_unref(inode_t *inode)
int snprintf(char *__restrict str, size_t size, const char *__restrict format,...)
dentry_t * dentry_root_get_mountpoint(dentry_t *dentry)
Given a mounted root dentry, return the mountpoint dentry that points to it.
mount_t * dentry_get_mount(const dentry_t *dentry)
#define mos_panic(fmt,...)
static size_t strlen(const char *s)
#define pr_dinfo2(feat, fmt,...)
#define tree_node(element)
#define tree_foreach_child(t, v, h)
#define dentry_name(dentry)