Orion
Barry Importing existing Orion kernel d41a53c (3 years, 2 months ago)
/*
* 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);
}