/* * This file implements the Super Block object and associated functions. Most * of the functions here are just wrappers for the Super Block Operations that * get specified by the individual file systems, since most of them need to know * driver-specific values. There usually isn't a generic way to handle these * operations. */ #include #include /* Super Block object type */ ObjectType superBlockType = { .name = "SUPER BLOCK", .size = sizeof(SuperBlock), }; /* Allocate an Inode */ Inode * super_alloc_inode(SuperBlock *sb) { if (!sb->ops || !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; foreach (sb->inodes, inode) { if (inode->ino == ino) break; } return inode; }