summaryrefslogtreecommitdiffstats
path: root/commands/mount.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2014-02-07 22:28:12 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-02-10 09:02:21 +0100
commitf97f4b6571d1297973f08b9f921778e0b2e7f064 (patch)
tree2f270dff58b9b90d11c455f6498389177ec1bd21 /commands/mount.c
parentf43f827bb4bc03526cbfa4ac58fac6747e3caddb (diff)
downloadbarebox-f97f4b6571d1297973f08b9f921778e0b2e7f064.tar.gz
barebox-f97f4b6571d1297973f08b9f921778e0b2e7f064.tar.xz
mount: support filesystem options passed via -o
Similar to mount(8) the barebox command mount now supports passing a string to the file system driver via -o. This is used in the next commit to let the user specify port numbers for nfs mounts. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/mount.c')
-rw-r--r--commands/mount.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/commands/mount.c b/commands/mount.c
index 2e9d4bef5e..691bc2911e 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -33,26 +33,31 @@ static int do_mount(int argc, char *argv[])
{
int opt;
int ret = 0, verbose = 0;
- struct fs_device_d *fsdev;
struct driver_d *drv;
const char *type = NULL;
const char *mountpoint, *dev;
+ const char *fsoptions = NULL;
- while ((opt = getopt(argc, argv, "t:va")) > 0) {
+ while ((opt = getopt(argc, argv, "ao:t:v")) > 0) {
switch (opt) {
+ case 'a':
+ mount_all();
+ break;
case 't':
type = optarg;
break;
+ case 'o':
+ fsoptions = optarg;
+ break;
case 'v':
verbose++;
break;
- case 'a':
- mount_all();
- break;
}
}
if (argc == optind) {
+ struct fs_device_d *fsdev;
+
for_each_fs_device(fsdev) {
printf("%s on %s type %s\n",
fsdev->backingstore ? fsdev->backingstore : "none",
@@ -84,7 +89,7 @@ static int do_mount(int argc, char *argv[])
if (!cdev)
return -ENOENT;
- path = cdev_mount_default(cdev);
+ path = cdev_mount_default(cdev, fsoptions);
if (IS_ERR(path))
return PTR_ERR(path);
@@ -108,7 +113,7 @@ static int do_mount(int argc, char *argv[])
mountpoint = argv[optind + 1];
}
- if ((ret = mount(dev, type, mountpoint))) {
+ if ((ret = mount(dev, type, mountpoint, fsoptions))) {
perror("mount");
return 1;
}