Filesystems/rootfs

From Linux Drivers
(Redirected from Fielsystems/rootfs)
Jump to: navigation, search

Introduction

rootfs is almost same as ramfs. Only difference is that, roofs can't be unmounted once mounted.

rootfs is always ramfs because it is implemented as part of ramfs. It can't be tmpfs unlike the documentation says. There was a patch that allows using tmpfs as rootfs, but it is not part of official Linux kernel.

Difference from ramfs

kill_sb handler is different.

static struct file_system_type ramfs_fs_type = {
        .name           = "ramfs",
        .mount          = ramfs_mount,
        .kill_sb        = ramfs_kill_sb,
};
static struct file_system_type rootfs_fs_type = {
        .name           = "rootfs",
        .mount          = rootfs_mount,
        .kill_sb        = kill_litter_super,
};

When mounting the rootfs, MS_NOUSER flag is set. This flag tells the VFS that this filesystem will never mounted from userland.

struct dentry *ramfs_mount(struct file_system_type *fs_type,
        int flags, const char *dev_name, void *data)
{
        return mount_nodev(fs_type, flags, data, ramfs_fill_super);
}

static struct dentry *rootfs_mount(struct file_system_type *fs_type,
        int flags, const char *dev_name, void *data)
{
        return mount_nodev(fs_type, flags|MS_NOUSER, data, ramfs_fill_super);
}

References

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox