#include #include extern InodeOps tmpfsInodeOps; extern FileOps tmpfsFileOps; Inode *tmpfs_alloc_inode(SuperBlock *sb); SuperOps tmpfsSuperOps = { .alloc_inode = tmpfs_alloc_inode, }; /* Mount a tmpfs instance */ Inode * tmpfs_mount(FSType *type, int flags, const char *dev, void *data) { SuperBlock *super = new(&superBlockType); super->type = get(type); super->ops = &tmpfsSuperOps; Inode *inode = super_alloc_inode(super); inode->mode = S_IFDIR | 0755; super->root = inode; return inode; } /* Allocate an inode */ Inode * tmpfs_alloc_inode(SuperBlock *sb) { Inode *inode = new(&inodeType); inode->ops = &tmpfsInodeOps; inode->fileOps = &tmpfsFileOps; inode->super = get(sb); inode->nlink = 1; return inode; }