|
PatchworkOS
|
Mountable filesystem. More...
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_t * | superblock_new (const 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. | |
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 the device provides the data and 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.
| typedef uint64_t superblock_id_t |
Superblock ID type.
Definition at line 35 of file superblock.h.
| 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.
| superblock | Pointer to the superblock. |
Definition at line 62 of file superblock.c.
References atomic_fetch_sub, superblock_t::mountCount, NULL, superblock_t::ops, and superblock_ops_t::unmount.
Referenced by mount_free().
| void superblock_inc_mount_count | ( | superblock_t * | superblock | ) |
Increment the mount count of a superblock.
| superblock | Pointer to the superblock. |
Definition at line 57 of file superblock.c.
References atomic_fetch_add, and superblock_t::mountCount.
Referenced by mount_new().
| superblock_t * superblock_new | ( | const 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 DEREF().
Note that the superblock's root dentry must be created and assigned after calling this function.
| fs | The filesystem type of the superblock. |
| deviceName | The device name, or VFS_DEVICE_NAME_NONE for no device. |
| ops | The superblock operations, can be NULL. |
| dentryOps | The dentry operations for dentries in this superblock, can be NULL. |
NULL and errno is set. Definition at line 32 of file superblock.c.
References atomic_init, superblock_t::blockSize, superblock_t::dentryOps, dentryOps, superblock_t::deviceName, superblock_t::entry, superblock_t::fs, superblock_t::id, list_entry_init(), malloc(), MAX_NAME, superblock_t::maxFileSize, superblock_t::mountCount, NULL, superblock_t::ops, ops, PAGE_SIZE, superblock_t::private, superblock_t::ref, ref_init(), superblock_t::root, strncpy(), superblock_free(), UINT64_MAX, and vfs_get_new_id().
Referenced by ramfs_mount(), and sysfs_mount().