diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2022-09-30 17:40:17 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-10-04 11:01:24 +0200 |
commit | 9719692439b21f828eb63d6e8d703ec34fbfebe2 (patch) | |
tree | 9388031911fcfa701ef5e3c1eed1184ae5263c57 /fs | |
parent | 13c7a12af0ab73adb5577adfd3d28731cd1b6190 (diff) | |
download | barebox-9719692439b21f828eb63d6e8d703ec34fbfebe2.tar.gz |
fs: implement cdev_mount()
EFI loaders provide both block device and file system access to software
running under it. For file system access, we will just want to get a
mount if available and mount at a default location if not. Provide a
helper that does just that.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220930154017.750867-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -1000,6 +1000,25 @@ const char *cdev_mount_default(struct cdev *cdev, const char *fsoptions) } /* + * cdev_mount - return existing mount or mount a cdev to the default path + * + * If a cdev is already mounted anywhere return the path + * it's mounted on. + * Otherwise mount it to /mnt/<cdevname> and return the path. Returns an + * error pointer on failure. + */ +const char *cdev_mount(struct cdev *cdev) +{ + const char *path; + + path = cdev_get_mount_path(cdev); + if (path) + return path; + + return cdev_mount_default(cdev, NULL); +} + +/* * mount_all - iterate over block devices and mount all devices we are able to */ void mount_all(void) |