summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-02-15 08:48:36 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-02-17 10:27:15 +0100
commit62d8b2f8c088f73cf929d6c5be360846c6bfb556 (patch)
tree12e1f005b0cf59b5d47d2d989b456e410005df64 /fs
parent9bf08d582a5016ed7c74bffe23901fa06ed27afa (diff)
downloadbarebox-62d8b2f8c088f73cf929d6c5be360846c6bfb556.tar.gz
barebox-62d8b2f8c088f73cf929d6c5be360846c6bfb556.tar.xz
fs: allow to mount on subdirectories
Since get_mtab_entry_by_path() is a bit more flexible now we no longer have to force the user to mount on the root directory only. Instead, we can allow to mount on subdirectories aswell. Nested mounts are still not possible though. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/fs.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/fs.c b/fs/fs.c
index 637a01f8c5..3923ec67bb 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -778,13 +778,14 @@ int mount(const char *device, const char *fsname, const char *_path)
debug("mount: %s on %s type %s\n", device, path, fsname);
- if (strchr(path + 1, '/')) {
- printf("mounting allowed on first directory level only\n");
- errno = -EBUSY;
- goto err_free_path;
- }
-
if (mtab_root) {
+ struct mtab_entry *entry;
+ entry = get_mtab_entry_by_path(path);
+ if (entry != mtab_root) {
+ printf("sorry, no nested mounts\n");
+ errno = -EBUSY;
+ goto err_free_path;
+ }
if (path_check_prereq(path, S_IFDIR))
goto err_free_path;
} else {