From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] mount: add compatibility to old mount command
Date: Thu, 1 Nov 2012 18:08:53 +0100 [thread overview]
Message-ID: <1351789733-28638-1-git-send-email-s.hauer@pengutronix.de> (raw)
the mount command used to have the syntax 'mount <dev> <type> <mountpoint>'.
This was changed to the more Linux like behaviour which specifies the
type with the -t <type> option. If a newer barebox is run on a device
with an older environment the mount command no longer works. This patch
adds compatibility to the old behaviour.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
commands/mount.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/commands/mount.c b/commands/mount.c
index f339c37..be26af8 100644
--- a/commands/mount.c
+++ b/commands/mount.c
@@ -33,7 +33,8 @@ static int do_mount(int argc, char *argv[])
int opt;
int ret = 0;
struct fs_device_d *fsdev;
- char *type = NULL;
+ const char *type = NULL;
+ const char *mountpoint, *dev;
if (argc == 1) {
for_each_fs_device(fsdev) {
@@ -56,7 +57,19 @@ static int do_mount(int argc, char *argv[])
if (argc < optind + 2)
return COMMAND_ERROR_USAGE;
- if ((ret = mount(argv[optind], type, argv[optind + 1]))) {
+ dev = argv[optind];
+
+ if (argc == optind + 3) {
+ /*
+ * Old behaviour: mount <dev> <type> <mountpoint>
+ */
+ type = argv[optind + 1];
+ mountpoint = argv[optind + 2];
+ } else {
+ mountpoint = argv[optind + 1];
+ }
+
+ if ((ret = mount(dev, type, mountpoint))) {
perror("mount");
return 1;
}
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2012-11-01 17:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1351789733-28638-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@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