/* @brief Perform mount of the root file system * @param dev Path to the block device (e.g. /dev/sda1) * @param fs_type Name of the file system driver * * @return Negative error number * @retval 0 Ok * @revtal -ENOENT File system driver not found */ static int rootfs_mount(void) { const char *dev, *fs_type; struct dumb_fs_driver *fsdrv; struct block_dev *bdev = NULL; dev = OPTION_STRING_GET(bdev); fs_type = OPTION_STRING_GET(fstype); assert(fs_type); fsdrv = dumb_fs_driver_find(fs_type); if (fsdrv == NULL) return -ENOENT; if (dev) { block_devs_init(); bdev = block_dev_find(dev); } dvfs_update_root(); if (-1 == dvfs_mount(bdev, "/", (char *) fs_type, 0)) { return -errno; } return 0; }
/** * @brief Mount given device on given directory * * @param dev Path to device * @param dir Path to mount point * @param fs_type Name of FS driver * * @return Negative error number or 0 if succeed */ int mount(char *dev, char *dir, char *fs_type) { struct fuse_module *fm; fm = fuse_module_lookup(fs_type); if (fm) { return fuse_module_mount(fm, dev, dir); } return dvfs_mount(dev, dir, fs_type, 0); }