ramfs: add inode number ticker

Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
Michael Shaw 2026-07-04 23:25:17 +02:00
commit 2a309d9671

View file

@ -1,5 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <kernel/slab.h>
#include <kernel/atomic.h>
#include <fs/vfs.h>
#include <fs/ramfs.h>
@ -9,6 +10,8 @@
static struct fs_ops *ramfs_ops = NULL;
static struct inode_ops *ramfs_inode_ops = NULL;
static u64 inode_ticker = 1;
int ramfs_create(u64 flags, fs_t **out)
{
int ret = 0;
@ -63,6 +66,7 @@ static int alloc_inode(fs_t *fs, u64 mode, inode_t **out)
return -ENOMEM;
ret->mode = mode;
ret->ino_num = atomic_xadd(&inode_ticker, 1);
*out = ret;
return 0;