From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, Jes Sorensen <Jes.Sorensen@redhat.com>
Subject: [PATCH 1/1] mddev_create(): choose /dev/md/ name over /dev/mdX
Date: Wed, 11 Feb 2015 14:53:09 -0500 [thread overview]
Message-ID: <1423684389-10977-2-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1423684389-10977-1-git-send-email-Jes.Sorensen@redhat.com>
From: Jes Sorensen <Jes.Sorensen@redhat.com>
/dev/mdX is created automatically if we create /dev/md/X, but
/dev/md/X isn't created automatically if we create /dev/mdX.
By chosing /dev/md/X as the default name from /dev/mdX, we achieve
consistency when creating new arrays.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
mdopen.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mdopen.c b/mdopen.c
index 2c9d745..db75d09 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -338,7 +338,11 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
sprintf(devname, "/dev/%s", devnm);
- if (dev && dev[0] == '/')
+ if (dev && strncmp(dev, "/dev/md", 7) == 0 &&
+ dev[7] != '/' && strlen(dev) > 7) {
+ strcpy(chosen, "/dev/md/");
+ strcpy(chosen + 8, dev + 7);
+ } else if (dev && dev[0] == '/')
strcpy(chosen, dev);
else if (cname[0] == 0)
strcpy(chosen, devname);
--
2.1.0
next prev parent reply other threads:[~2015-02-11 19:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-11 19:53 [PATCH 0/1] RFC: Use /dev/md/X as default name Jes.Sorensen
2015-02-11 19:53 ` Jes.Sorensen [this message]
2015-02-18 18:12 ` Jes Sorensen
2015-02-18 21:37 ` NeilBrown
2015-02-18 22:11 ` Jes Sorensen
2015-02-18 22:32 ` NeilBrown
2015-03-02 16:32 ` Jes Sorensen
2015-03-02 21:43 ` NeilBrown
2015-03-04 15:57 ` Jes Sorensen
2015-03-05 14:56 ` Jes Sorensen
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=1423684389-10977-2-git-send-email-Jes.Sorensen@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).