gitignore: add .cpio

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-05-13 04:47:59 -04:00
commit f0a9ff299b
27 changed files with 253 additions and 245 deletions

View file

@ -12,15 +12,18 @@ static mem_cache_t *dirent_slab = NULL;
dirent_t *inode_find_dirent(inode_t *inode, const char *name)
{
list_item_t *p = inode->dentries.head;
dirent_t *ret = NULL;
while (p) {
dirent_t *dirent = (void *)p->ptr;
if (!strncmp(name, dirent->name, dirent->name_len))
return dirent;
if (!strncmp(name, dirent->name, dirent->name_len)) {
ret = dirent;
break;
}
p = p->next;
}
return NULL;
return ret;
}
dirent_t *dirent_create(const char *name)
@ -66,6 +69,30 @@ void inode_free(inode_t *inode)
slab_free(inode_slab, inode);
}
void inode_inc_ref(inode_t *inode)
{
write_lock(&inode->rwlock);
inode->refcount += 1;
write_unlock(&inode->rwlock);
}
void inode_dec_ref(inode_t *inode)
{
write_lock(&inode->rwlock);
inode->refcount -= 1;
write_unlock(&inode->rwlock);
if (inode->refcount == 0) {
if (inode->parent_inode) {
write_lock(&inode->parent_inode->rwlock);
inode_dec_ref(inode->parent_inode);
write_unlock(&inode->parent_inode->rwlock);
}
inode->fs->fs_ops.free_inode(inode->fs, inode);
}
}
void inode_init()
{
inode_slab = slab_create("inode_slab", sizeof(inode_t), 64 * KB, 0x8);