PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
Superblock

Mountable filesystem. More...

Collaboration diagram for Superblock:

Detailed Description

Mountable filesystem.

A superblock represents a mounted filesystem, it can be thought of as "filesystem + device". The filesystem is just the format of the data, e.g. fat32, ramfs, sysfs, etc. and the device provides the data. The superblock is the combination of both, e.g. a fat32 filesystem on /dev/sda1.

In the case of certain special filesystems like ramfs or sysfs there is no underlying device, in this case the device name is simply set to VFS_DEVICE_NAME_NONE.

Data Structures

struct  superblock_t
 Superblock structure. More...
 
struct  superblock_ops_t
 Superblock operations structure. More...
 

Typedefs

typedef uint64_t superblock_id_t
 Superblock ID type.
 

Functions

superblock_tsuperblock_new (filesystem_t *fs, const char *deviceName, const superblock_ops_t *ops, const dentry_ops_t *dentryOps)
 Create a new superblock.
 
void superblock_inc_mount_count (superblock_t *superblock)
 Increment the mount count of a superblock.
 
void superblock_dec_mount_count (superblock_t *superblock)
 Decrement the mount count of a superblock.
 

Typedef Documentation

◆ superblock_id_t

Superblock ID type.

Definition at line 35 of file superblock.h.

Function Documentation

◆ superblock_new()

superblock_t * superblock_new ( filesystem_t fs,
const char *  deviceName,
const superblock_ops_t ops,
const dentry_ops_t dentryOps 
)

Create a new superblock.

This does not add the superblock to the superblock cache, the vfs_mount() function will do that using vfs_add_superblock().

There is no superblock_free() instead use UNREF().

Note that the superblock's root dentry must be created and assigned after calling this function.

Parameters
fsThe filesystem type of the superblock.
deviceNameThe device name, or VFS_DEVICE_NAME_NONE for no device.
opsThe superblock operations, can be NULL.
dentryOpsThe dentry operations for dentries in this superblock, can be NULL.
Returns
On success, the new superblock. On failure, returns NULL and errno is set.

Definition at line 35 of file superblock.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ superblock_inc_mount_count()

void superblock_inc_mount_count ( superblock_t superblock)

Increment the mount count of a superblock.

Parameters
superblockPointer to the superblock.

Definition at line 60 of file superblock.c.

Here is the caller graph for this function:

◆ superblock_dec_mount_count()

void superblock_dec_mount_count ( superblock_t superblock)

Decrement the mount count of a superblock.

If the mount count reaches zero, the unmount operation is called if its not NULL.

Parameters
superblockPointer to the superblock.

Definition at line 65 of file superblock.c.

Here is the caller graph for this function: