MOS Source Code
Loading...
Searching...
No Matches
tmpfs.c File Reference
+ Include dependency graph for tmpfs.c:

Go to the source code of this file.

Classes

struct  tmpfs_inode_t
 
struct  tmpfs_sb_t
 

Macros

#define TMPFS_INODE(inode)
 
#define TMPFS_SB(var)
 

Functions

 SLAB_AUTOINIT ("tmpfs_i", tmpfs_inode_cache, tmpfs_inode_t)
 
 SLAB_AUTOINIT ("tmpfs_sb", tmpfs_superblock_cache, tmpfs_sb_t)
 
static dentry_ttmpfs_fsop_mount (filesystem_t *fs, const char *dev, const char *options)
 
 FILESYSTEM_DEFINE (fs_tmpfs, "tmpfs", tmpfs_fsop_mount, NULL)
 
 FILESYSTEM_AUTOREGISTER (fs_tmpfs)
 
inode_ttmpfs_create_inode (tmpfs_sb_t *sb, file_type_t type, file_perm_t perm)
 
static bool tmpfs_mknod_impl (inode_t *dir, dentry_t *dentry, file_type_t type, file_perm_t perm, dev_t dev)
 
static bool tmpfs_i_create (inode_t *dir, dentry_t *dentry, file_type_t type, file_perm_t perm)
 
static bool tmpfs_i_hardlink (dentry_t *old_dentry, inode_t *dir, dentry_t *new_dentry)
 
static bool tmpfs_i_symlink (inode_t *dir, dentry_t *dentry, const char *symname)
 
static bool tmpfs_i_unlink (inode_t *dir, dentry_t *dentry)
 
static bool tmpfs_i_mkdir (inode_t *dir, dentry_t *dentry, file_perm_t perm)
 
static bool tmpfs_i_rmdir (inode_t *dir, dentry_t *subdir_to_remove)
 
static bool tmpfs_i_mknod (inode_t *dir, dentry_t *dentry, file_type_t type, file_perm_t perm, dev_t dev)
 
static bool tmpfs_i_rename (inode_t *old_dir, dentry_t *old_dentry, inode_t *new_dir, dentry_t *new_dentry)
 
static size_t tmpfs_i_readlink (dentry_t *dentry, char *buffer, size_t buflen)
 
static phyframe_ttmpfs_fill_cache (inode_cache_t *cache, off_t pgoff)
 
static bool tmpfs_sb_drop_inode (inode_t *inode)
 

Variables

static const file_ops_t tmpfs_noop_file_ops = { 0 }
 
static const inode_ops_t tmpfs_inode_dir_ops
 
static const inode_ops_t tmpfs_inode_symlink_ops
 
static const inode_cache_ops_t tmpfs_inode_cache_ops
 
static const file_ops_t tmpfs_file_ops
 
static const superblock_ops_t tmpfs_sb_op
 
static slab_ttmpfs_inode_cache = NULL
 
static slab_ttmpfs_superblock_cache = NULL
 
static const file_perm_t tmpfs_default_mode = PERM_READ | PERM_WRITE | PERM_EXEC
 

Macro Definition Documentation

◆ TMPFS_INODE

#define TMPFS_INODE ( inode)
Value:
container_of(inode, tmpfs_inode_t, real_inode)
#define container_of(ptr, type, member)
Definition mos_global.h:50

Definition at line 37 of file tmpfs.c.

Referenced by tmpfs_i_readlink(), tmpfs_i_rmdir(), tmpfs_i_symlink(), tmpfs_mknod_impl(), and tmpfs_sb_drop_inode().

◆ TMPFS_SB

#define TMPFS_SB ( var)
Value:

Definition at line 38 of file tmpfs.c.

Referenced by tmpfs_mknod_impl().

Function Documentation

◆ SLAB_AUTOINIT() [1/2]

SLAB_AUTOINIT ( "tmpfs_i" ,
tmpfs_inode_cache ,
tmpfs_inode_t  )

◆ SLAB_AUTOINIT() [2/2]

SLAB_AUTOINIT ( "tmpfs_sb" ,
tmpfs_superblock_cache ,
tmpfs_sb_t  )

◆ tmpfs_fsop_mount()

static dentry_t * tmpfs_fsop_mount ( filesystem_t * fs,
const char * dev,
const char * options )
static

Definition at line 107 of file tmpfs.c.

+ Here is the call graph for this function:

◆ FILESYSTEM_DEFINE()

FILESYSTEM_DEFINE ( fs_tmpfs ,
"tmpfs" ,
tmpfs_fsop_mount ,
NULL  )

◆ FILESYSTEM_AUTOREGISTER()

FILESYSTEM_AUTOREGISTER ( fs_tmpfs )

◆ tmpfs_create_inode()

inode_t * tmpfs_create_inode ( tmpfs_sb_t * sb,
file_type_t type,
file_perm_t perm )

Definition at line 58 of file tmpfs.c.

Referenced by tmpfs_fsop_mount(), and tmpfs_mknod_impl().

+ Here is the call graph for this function:

◆ tmpfs_mknod_impl()

static bool tmpfs_mknod_impl ( inode_t * dir,
dentry_t * dentry,
file_type_t type,
file_perm_t perm,
dev_t dev )
static

Definition at line 131 of file tmpfs.c.

Referenced by tmpfs_i_create(), tmpfs_i_mkdir(), tmpfs_i_mknod(), and tmpfs_i_symlink().

+ Here is the call graph for this function:

◆ tmpfs_i_create()

static bool tmpfs_i_create ( inode_t * dir,
dentry_t * dentry,
file_type_t type,
file_perm_t perm )
static

Definition at line 139 of file tmpfs.c.

+ Here is the call graph for this function:

◆ tmpfs_i_hardlink()

static bool tmpfs_i_hardlink ( dentry_t * old_dentry,
inode_t * dir,
dentry_t * new_dentry )
static

Definition at line 144 of file tmpfs.c.

+ Here is the call graph for this function:

◆ tmpfs_i_symlink()

static bool tmpfs_i_symlink ( inode_t * dir,
dentry_t * dentry,
const char * symname )
static

Definition at line 153 of file tmpfs.c.

+ Here is the call graph for this function:

◆ tmpfs_i_unlink()

static bool tmpfs_i_unlink ( inode_t * dir,
dentry_t * dentry )
static

Definition at line 165 of file tmpfs.c.

◆ tmpfs_i_mkdir()

static bool tmpfs_i_mkdir ( inode_t * dir,
dentry_t * dentry,
file_perm_t perm )
static

Definition at line 172 of file tmpfs.c.

+ Here is the call graph for this function:

◆ tmpfs_i_rmdir()

static bool tmpfs_i_rmdir ( inode_t * dir,
dentry_t * subdir_to_remove )
static

Definition at line 177 of file tmpfs.c.

+ Here is the call graph for this function:

◆ tmpfs_i_mknod()

static bool tmpfs_i_mknod ( inode_t * dir,
dentry_t * dentry,
file_type_t type,
file_perm_t perm,
dev_t dev )
static

Definition at line 191 of file tmpfs.c.

+ Here is the call graph for this function:

◆ tmpfs_i_rename()

static bool tmpfs_i_rename ( inode_t * old_dir,
dentry_t * old_dentry,
inode_t * new_dir,
dentry_t * new_dentry )
static

Definition at line 196 of file tmpfs.c.

+ Here is the call graph for this function:

◆ tmpfs_i_readlink()

static size_t tmpfs_i_readlink ( dentry_t * dentry,
char * buffer,
size_t buflen )
static

Definition at line 217 of file tmpfs.c.

+ Here is the call graph for this function:

◆ tmpfs_fill_cache()

static phyframe_t * tmpfs_fill_cache ( inode_cache_t * cache,
off_t pgoff )
static

Definition at line 225 of file tmpfs.c.

+ Here is the call graph for this function:

◆ tmpfs_sb_drop_inode()

static bool tmpfs_sb_drop_inode ( inode_t * inode)
static

Definition at line 237 of file tmpfs.c.

Variable Documentation

◆ tmpfs_noop_file_ops

const file_ops_t tmpfs_noop_file_ops = { 0 }
static

Definition at line 40 of file tmpfs.c.

Referenced by tmpfs_create_inode().

◆ tmpfs_inode_dir_ops

static const inode_ops_t tmpfs_inode_dir_ops
static
Initial value:
= {
.lookup = NULL,
.newfile = tmpfs_i_create,
.hardlink = tmpfs_i_hardlink,
.symlink = tmpfs_i_symlink,
.unlink = tmpfs_i_unlink,
.mkdir = tmpfs_i_mkdir,
.rmdir = tmpfs_i_rmdir,
.mknode = tmpfs_i_mknod,
.rename = tmpfs_i_rename,
}
#define NULL
Definition pb_syshdr.h:46
static bool tmpfs_i_mknod(inode_t *dir, dentry_t *dentry, file_type_t type, file_perm_t perm, dev_t dev)
Definition tmpfs.c:191
static bool tmpfs_i_symlink(inode_t *dir, dentry_t *dentry, const char *symname)
Definition tmpfs.c:153
static bool tmpfs_i_hardlink(dentry_t *old_dentry, inode_t *dir, dentry_t *new_dentry)
Definition tmpfs.c:144
static bool tmpfs_i_create(inode_t *dir, dentry_t *dentry, file_type_t type, file_perm_t perm)
Definition tmpfs.c:139
static bool tmpfs_i_unlink(inode_t *dir, dentry_t *dentry)
Definition tmpfs.c:165
static bool tmpfs_i_rmdir(inode_t *dir, dentry_t *subdir_to_remove)
Definition tmpfs.c:177
static bool tmpfs_i_rename(inode_t *old_dir, dentry_t *old_dentry, inode_t *new_dir, dentry_t *new_dentry)
Definition tmpfs.c:196
static bool tmpfs_i_mkdir(inode_t *dir, dentry_t *dentry, file_perm_t perm)
Definition tmpfs.c:172

Definition at line 42 of file tmpfs.c.

Referenced by tmpfs_create_inode().

◆ tmpfs_inode_symlink_ops

static const inode_ops_t tmpfs_inode_symlink_ops
static
Initial value:
= {
.readlink = tmpfs_i_readlink,
}
static size_t tmpfs_i_readlink(dentry_t *dentry, char *buffer, size_t buflen)
Definition tmpfs.c:217

Definition at line 43 of file tmpfs.c.

Referenced by tmpfs_create_inode().

◆ tmpfs_inode_cache_ops

static const inode_cache_ops_t tmpfs_inode_cache_ops
static
Initial value:
= {
.fill_cache = tmpfs_fill_cache,
.page_write_begin = simple_page_write_begin,
.page_write_end = simple_page_write_end,
}
static phyframe_t * tmpfs_fill_cache(inode_cache_t *cache, off_t pgoff)
Definition tmpfs.c:225
bool simple_page_write_begin(inode_cache_t *icache, off_t offset, size_t size, phyframe_t **page, void **private)
Definition vfs_utils.c:65
void simple_page_write_end(inode_cache_t *icache, off_t offset, size_t size, phyframe_t *page, void *private)
Definition vfs_utils.c:76

Definition at line 44 of file tmpfs.c.

Referenced by tmpfs_create_inode().

◆ tmpfs_file_ops

static const file_ops_t tmpfs_file_ops
static
Initial value:
= {
}
ssize_t vfs_generic_write(const file_t *file, const void *buf, size_t size, off_t offset)
Definition vfs_utils.c:105
ssize_t vfs_generic_read(const file_t *file, void *buf, size_t size, off_t offset)
Definition vfs_utils.c:95

Definition at line 45 of file tmpfs.c.

Referenced by tmpfs_create_inode().

◆ tmpfs_sb_op

static const superblock_ops_t tmpfs_sb_op
static
Initial value:
= {
.drop_inode = tmpfs_sb_drop_inode,
}
static bool tmpfs_sb_drop_inode(inode_t *inode)
Definition tmpfs.c:237

Definition at line 46 of file tmpfs.c.

Referenced by tmpfs_fsop_mount().

◆ tmpfs_inode_cache

slab_t* tmpfs_inode_cache = NULL
static

Definition at line 48 of file tmpfs.c.

Referenced by tmpfs_create_inode().

◆ tmpfs_superblock_cache

slab_t* tmpfs_superblock_cache = NULL
static

Definition at line 51 of file tmpfs.c.

Referenced by tmpfs_fsop_mount().

◆ tmpfs_default_mode

const file_perm_t tmpfs_default_mode = PERM_READ | PERM_WRITE | PERM_EXEC
static

Definition at line 105 of file tmpfs.c.

Referenced by tmpfs_fsop_mount(), and tmpfs_i_symlink().