ramfs: add inode number ticker
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
dc0a6c9cc4
commit
2a309d9671
1 changed files with 4 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
#include <kernel/slab.h>
|
#include <kernel/slab.h>
|
||||||
|
#include <kernel/atomic.h>
|
||||||
|
|
||||||
#include <fs/vfs.h>
|
#include <fs/vfs.h>
|
||||||
#include <fs/ramfs.h>
|
#include <fs/ramfs.h>
|
||||||
|
|
@ -9,6 +10,8 @@
|
||||||
static struct fs_ops *ramfs_ops = NULL;
|
static struct fs_ops *ramfs_ops = NULL;
|
||||||
static struct inode_ops *ramfs_inode_ops = NULL;
|
static struct inode_ops *ramfs_inode_ops = NULL;
|
||||||
|
|
||||||
|
static u64 inode_ticker = 1;
|
||||||
|
|
||||||
int ramfs_create(u64 flags, fs_t **out)
|
int ramfs_create(u64 flags, fs_t **out)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
@ -63,6 +66,7 @@ static int alloc_inode(fs_t *fs, u64 mode, inode_t **out)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ret->mode = mode;
|
ret->mode = mode;
|
||||||
|
ret->ino_num = atomic_xadd(&inode_ticker, 1);
|
||||||
|
|
||||||
*out = ret;
|
*out = ret;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue