From b7a66554dcbc2525b719f7216cb77c2037e6af80 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Fri, 1 Nov 2013 09:33:17 +0100 Subject: [PATCH] fs: Add function to get cdev by mountpath This is useful to know for the bootloader spec implementation. Signed-off-by: Sascha Hauer --- fs/fs.c | 13 +++++++++++++ include/fs.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/fs/fs.c b/fs/fs.c index 7d558e90d..4563a8126 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -283,6 +283,19 @@ static struct fs_device_d *get_fsdevice_by_path(const char *path) return fs_dev_root; } +/* + * get_cdev_by_mountpath - return the cdev the given path + * is mounted on + */ +struct cdev *get_cdev_by_mountpath(const char *path) +{ + struct fs_device_d *fsdev; + + fsdev = get_fsdevice_by_path(path); + + return fsdev->cdev; +} + char *get_mounted_path(const char *path) { struct fs_device_d *fdev; diff --git a/include/fs.h b/include/fs.h index 99f168983..856e00abb 100644 --- a/include/fs.h +++ b/include/fs.h @@ -184,6 +184,8 @@ char *normalise_link(const char *pathname, const char* symlink); char *get_mounted_path(const char *path); +struct cdev *get_cdev_by_mountpath(const char *path); + /* Register a new filesystem driver */ int register_fs_driver(struct fs_driver_d *fsdrv);