BarryServer : Git

All the code for all my projects
// BarryServer : Git / Nucleus / blob / f97b909e66a1314d3bb9da413cd515cf47672180 / vfs / superblock.c

// Related

Nucleus

Barry New list iteration in VFS f97b909 (3 years, 3 months ago)
/*
 * 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 <sys/types.h>
#include <nucleus/vfs.h>

/* 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;
}