PatchworkOS
Loading...
Searching...
No Matches

Mount point. More...

Data Structures

struct  mount_t
 Mount structure. More...
 

Typedefs

typedef uint64_t mount_id_t
 Mount ID type.
 

Functions

mount_tmount_new (superblock_t *superblock, dentry_t *root, dentry_t *mountpoint, mount_t *parent)
 Create a new mount.
 

Detailed Description

Mount point.

A mount represents a location that a superblock is mounted to. It links a superblock (the mounted filesystem) to a mountpoint (a dentry in another filesystem).

Typedef Documentation

◆ mount_id_t

Mount ID type.

Definition at line 28 of file mount.h.

Function Documentation

◆ mount_new()

mount_t * mount_new ( superblock_t superblock,
dentry_t root,
dentry_t mountpoint,
mount_t parent 
)

Create a new mount.

This does not add the mount to the mount cache, that must be done separately with vfs_add_mount().

There is no mount_free() instead use DEREF().

Note that the root dentry is not necessarily the same as superblock->root, instead its the directory that will "appear" to be the root of the newly mounted filesystem, the dentry that gets jumped to durning the lookup. This is important for implementing bind mounts.

Parameters
superblockThe superblock of the mounted filesystem.
rootThe root dentry of the mounted filesystem.
mountpointThe dentry that this filesystem will be mounted on, can be NULL for the root filesystem.
parentThe parent mount, can be NULL for the root filesystem.
Returns
On success, the new mount. On failure, returns NULL and errno is set.

Definition at line 39 of file mount.c.

References dentry_inc_mount_count(), EINVAL, errno, mount_t::id, malloc(), map_entry_init(), mount_t::mapEntry, mount, mount_free(), mount_t::mountpoint, NULL, mount_t::parent, mount_t::ref, REF, ref_init(), mount_t::root, mount_t::superblock, superblock_inc_mount_count(), and vfs_get_new_id().

Referenced by namespace_bind(), and namespace_mount().