Search
j0ke.net Open Build Service
>
Projects
>
GFS
>
multipath-tools
> multipath-tools-use-mapname-for-kpartx
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File multipath-tools-use-mapname-for-kpartx of Package multipath-tools
tree 30c0375248cc3a705e6e23f1fbfef0c48e1547da parent 40eac42f1586ee3b21d8f676d9f4e820ad5f0731 author Hannes Reinecke <hare@suse.de> 1175152315 +0200 committer Hannes Reinecke <hare@suse.de> 1175152315 +0200 [kpartx] Use mapname for device-mapper devices When kpartx is run on a device-mapper device it should rather use the mapname instead of generating the name from the commandline arguments. Signed-off-by: Hannes Reinecke <hare@suse.de> bc12604255cc0ee7a04b443181c79a87a3319aa3 kpartx/kpartx.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c index 0ee0cb3..b406b95 100644 --- a/kpartx/kpartx.c +++ b/kpartx/kpartx.c @@ -193,6 +193,7 @@ main(int argc, char **argv){ char * loopdev = NULL; char * delim = NULL; char *uuid = NULL; + char *mapname = NULL; int loopro = 0; int hotplug = 0; struct stat buf; @@ -310,12 +311,19 @@ main(int argc, char **argv){ off = find_devname_offset(device); - if (!loopdev) + if (!loopdev) { uuid = dm_mapuuid((unsigned int)MAJOR(buf.st_rdev), (unsigned int)MINOR(buf.st_rdev)); + mapname = dm_mapname((unsigned int)MAJOR(buf.st_rdev), + (unsigned int)MINOR(buf.st_rdev)); + } + if (!uuid) uuid = device + off; + if (!mapname) + mapname = device + off; + fd = open(device, O_RDONLY); if (fd == -1) { @@ -365,7 +373,7 @@ #endif continue; printf("%s%s%d : 0 %lu %s %lu\n", - device + off, delim, j+1, + mapname, delim, j+1, (unsigned long) slices[j].size, device, (unsigned long) slices[j].start); } @@ -374,7 +382,7 @@ #endif case DELETE: for (j = 0; j < n; j++) { if (safe_sprintf(partname, "%s%s%d", - device + off , delim, j+1)) { + mapname, delim, j+1)) { fprintf(stderr, "partname too small\n"); exit(1); } @@ -407,7 +415,7 @@ #endif continue; if (safe_sprintf(partname, "%s%s%d", - device + off , delim, j+1)) { + mapname, delim, j+1)) { fprintf(stderr, "partname too small\n"); exit(1); }