mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/5] commands: mount: combine dev and devstr, which are the same
Date: Tue, 30 May 2017 16:09:44 +0200	[thread overview]
Message-ID: <20170530140947.3988-2-p.zabel@pengutronix.de> (raw)
In-Reply-To: <20170530140947.3988-1-p.zabel@pengutronix.de>

Unify the device path used by the default mount and mount with specified
mount point paths.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 commands/mount.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/commands/mount.c b/commands/mount.c
index aa769d46fe..f05e23b227 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -29,7 +29,7 @@ static int do_mount(int argc, char *argv[])
 	int opt, verbose = 0;
 	struct driver_d *drv;
 	const char *type = NULL;
-	const char *mountpoint, *dev;
+	const char *mountpoint, *devstr;
 	const char *fsoptions = NULL;
 
 	while ((opt = getopt(argc, argv, "ao:t:v")) > 0) {
@@ -70,11 +70,11 @@ static int do_mount(int argc, char *argv[])
 		return 0;
 	}
 
+	devstr = argv[optind];
+
 	if (argc == optind + 1) {
 		struct cdev *cdev;
-		const char *path, *devstr;
-
-		devstr = argv[optind];
+		const char *path;
 
 		if (!strncmp(devstr, "/dev/", 5))
 			devstr += 5;
@@ -97,8 +97,6 @@ static int do_mount(int argc, char *argv[])
 	if (argc < optind + 2)
 		return COMMAND_ERROR_USAGE;
 
-	dev = argv[optind];
-
 	if (argc == optind + 3) {
 		/*
 		 * Old behaviour: mount <dev> <type> <mountpoint>
@@ -109,7 +107,7 @@ static int do_mount(int argc, char *argv[])
 		mountpoint = argv[optind + 1];
 	}
 
-	return mount(dev, type, mountpoint, fsoptions);
+	return mount(devstr, type, mountpoint, fsoptions);
 }
 
 BAREBOX_CMD_HELP_START(mount)
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2017-05-30 14:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 14:09 [PATCH 1/5] cdev: make file operations const Philipp Zabel
2017-05-30 14:09 ` Philipp Zabel [this message]
2017-05-30 14:09 ` [PATCH 3/5] fs: add parseopt_b for loop mount option Philipp Zabel
2017-05-30 14:09 ` [PATCH 4/5] fs: add cdev_create_from_file " Philipp Zabel
2017-06-01  6:31   ` Sascha Hauer
2017-06-01  9:37     ` Philipp Zabel
2017-05-30 14:09 ` [PATCH 5/5] commands: mount: mention file loop mounts in the help text Philipp Zabel
2017-06-01  6:32 ` [PATCH 1/5] cdev: make file operations const Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170530140947.3988-2-p.zabel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox