38#define TMPFS_INODE(inode) container_of(inode, tmpfs_inode_t, real_inode)
39#define TMPFS_SB(var) container_of(var, tmpfs_sb_t, sb)
65 pr_dinfo2(tmpfs,
"tmpfs: creating a directory inode");
72 pr_dinfo2(tmpfs,
"tmpfs: creating a symlink inode");
79 pr_dinfo2(tmpfs,
"tmpfs: creating a file inode");
87 mos_warn(
"TODO: tmpfs: create inode for file type %d", type);
88 mos_panic(
"tmpfs: unsupported file type");
105 if (
strcmp(dev,
"none") != 0)
107 mos_warn(
"tmpfs: device not supported");
111 if (options &&
strlen(options) != 0 &&
strcmp(options,
"defaults") != 0)
113 mos_warn(
"tmpfs: options '%s' not supported", options);
118 tmpfs_sb->
sb.
fs = fs;
217 return bytes_to_copy;
#define MOS_ASSERT_X(cond, msg,...)
#define mos_warn(fmt,...)
void dentry_attach(dentry_t *d, inode_t *inode)
Attach an inode to a dentry.
void dentry_detach(dentry_t *d)
Detach the inode from a dentry.
MOSAPI char * strdup(const char *src)
MOSAPI s32 strcmp(const char *str1, const char *str2)
phyframe_t * mm_get_free_page(void)
#define pmm_ref_one(thing)
void inode_init(inode_t *inode, superblock_t *sb, u64 ino, file_type_t type)
T * create(Args &&...args)
#define mos_panic(fmt,...)
static void * memcpy(void *s1, const void *s2, size_t n)
static size_t strlen(const char *s)
#define pr_dinfo2(feat, fmt,...)
const inode_cache_ops_t * ops
superblock_t * superblock
const file_ops_t * file_ops
const superblock_ops_t * ops
static PtrResult< phyframe_t > tmpfs_fill_cache(inode_cache_t *cache, uint64_t pgoff)
static PtrResult< dentry_t > tmpfs_fsop_mount(filesystem_t *fs, const char *dev, const char *options)
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_symlink(inode_t *dir, dentry_t *dentry, const char *symname)
static bool tmpfs_i_hardlink(dentry_t *old_dentry, inode_t *dir, dentry_t *new_dentry)
static const file_perm_t tmpfs_default_mode
const file_ops_t tmpfs_file_ops
static bool tmpfs_sb_drop_inode(inode_t *inode)
static bool tmpfs_mknod_impl(inode_t *dir, dentry_t *dentry, file_type_t type, file_perm_t perm, dev_t dev)
const inode_ops_t tmpfs_inode_symlink_ops
#define TMPFS_INODE(inode)
static bool tmpfs_i_create(inode_t *dir, dentry_t *dentry, file_type_t type, file_perm_t perm)
const inode_ops_t tmpfs_inode_dir_ops
const superblock_ops_t tmpfs_sb_op
static const file_ops_t tmpfs_noop_file_ops
static bool tmpfs_i_unlink(inode_t *dir, dentry_t *dentry)
inode_t * tmpfs_create_inode(tmpfs_sb_t *sb, file_type_t type, file_perm_t perm)
static bool tmpfs_i_rmdir(inode_t *dir, dentry_t *subdir_to_remove)
static size_t tmpfs_i_readlink(dentry_t *dentry, char *buffer, size_t buflen)
static bool tmpfs_i_rename(inode_t *old_dir, dentry_t *old_dentry, inode_t *new_dir, dentry_t *new_dentry)
const inode_cache_ops_t tmpfs_inode_cache_ops
static bool tmpfs_i_mkdir(inode_t *dir, dentry_t *dentry, file_perm_t perm)
std::atomic_size_t atomic_t
#define FILESYSTEM_DEFINE(var, fsname, mountfn, unmountfn)
#define FILESYSTEM_AUTOREGISTER(fs)
ssize_t vfs_generic_write(const file_t *file, const void *buf, size_t size, off_t offset)
dentry_t * dentry_get_from_parent(superblock_t *sb, dentry_t *parent, mos::string_view name)
Create a new dentry with the given name and parent.
bool simple_page_write_begin(inode_cache_t *icache, off_t offset, size_t size, phyframe_t **page, void **private_)
ssize_t vfs_generic_read(const file_t *file, void *buf, size_t size, off_t offset)
void simple_page_write_end(inode_cache_t *icache, off_t offset, size_t size, phyframe_t *page, void *private_)