Util-Linux package development
 help / color / mirror / Atom feed
From: Stanislav Brabec <sbrabec@suse.cz>
To: util-linux@vger.kernel.org
Subject: [PATCH] Use correct partition names for /dev/mapper
Date: Mon, 25 May 2015 21:17:52 +0200	[thread overview]
Message-ID: <55637560.4060207@suse.cz> (raw)

The default configuration of multipath-tools appends "-partN" to
partition nodes. Follow this conventions and do the same.

It fixes for example fdisk -l /dev/mapper/name_of_the_device.

Note that the current implementation only partially fixes the problem. It
does not reflect any udev configuration changes, as udev does not provide
any function to return names of future (or current) partitions of a
particular device. It also does not fix fdisk -l /dev/dm-0.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
---
 libfdisk/src/utils.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libfdisk/src/utils.c b/libfdisk/src/utils.c
index cc470d9..928c59b 100644
--- a/libfdisk/src/utils.c
+++ b/libfdisk/src/utils.c
@@ -139,9 +139,11 @@ char *fdisk_partname(const char *dev, size_t partno)
 	}
 
 	/* udev names partitions by appending -partN
-	   e.g. ata-SAMSUNG_SV8004H_0357J1FT712448-part1 */
+	   e.g. ata-SAMSUNG_SV8004H_0357J1FT712448-part1
+	   multipath-tools kpartx.rules also append -partN */
 	if ((strncmp(dev, _PATH_DEV_BYID, sizeof(_PATH_DEV_BYID) - 1) == 0) ||
-	     strncmp(dev, _PATH_DEV_BYPATH, sizeof(_PATH_DEV_BYPATH) - 1) == 0) {
+	     strncmp(dev, _PATH_DEV_BYPATH, sizeof(_PATH_DEV_BYPATH) - 1) == 0 ||
+	     strncmp(dev, "/dev/mapper", sizeof("/dev/mapper") - 1) == 0) {
 	       p = "-part";
 	}
 
-- 
2.4.1

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarská 1060/12                            tel: +49 911 7405384547
190 00 Praha 9                                 fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

                 reply	other threads:[~2015-05-25 19:17 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=55637560.4060207@suse.cz \
    --to=sbrabec@suse.cz \
    --cc=util-linux@vger.kernel.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