Orion
Barry Importing existing Orion kernel d41a53c (2 years, 4 months ago)diff --git a/vfs/super.c b/vfs/super.c new file mode 100644 index 0000000..5201110 --- /dev/null +++ b/vfs/super.c @@ -0,0 +1,42 @@ +/* + * This file contains the wrapper functions for the Super Block Operations. It + * just calls the relevant internal functions for the file system, since most of + * them need to know driver specific values, like where to find the file system + * operations. There usually isn't a generic way to handle the functions. + */ + +#include <stdint.h> +#include "vfs.h" + +/* Allocate an inode */ +Inode * +super_alloc_inode(SuperBlock *sb) +{ + if (!sb->ops) + return NULL; + if (!sb->ops->alloc_inode) + return NULL; + return sb->ops->alloc_inode(sb); +} + +/* Search for an Inode in a Super Block's Inode list */ +Inode * +super_find_inode(SuperBlock *sb, ino_t ino) +{ + Inode *inode; + for (inode = sb->inodes; inode; inode = inode->lnext) + if (inode->ino == ino) + break; + return inode; +} + +/* Write an inode to disk */ +int +super_write_inode(SuperBlock *sb, Inode *inode) +{ + if (!sb->ops) + return 0; + if (!sb->ops->write_inode) + return 0; + return sb->ops->write_inode(inode); +}