Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2
multipath-tools
kpartx-work-correctly-with-empty-GPT-table.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File kpartx-work-correctly-with-empty-GPT-table.patch of Package multipath-tools
From 973f6bb4f689029456d3daf6c54645937cc4df24 Mon Sep 17 00:00:00 2001 From: Petr Uzel <petr.uzel@suse.cz> Date: Wed, 25 Jul 2012 14:04:46 +0200 Subject: [PATCH] kpartx: work correctly with empty GPT table When running the partition table probes, the code considered empty tables as invalid ones. Because of this, kpartx -u / -d does not work correctly on empty tables (with zero partitions). The return value of the probes should be: -1: not our partition table type 0: our partition table, but no partitions exist >0: number of partitions found Adapt read_gpt_pt() to this semantics. CC: Hannes Reinecke <hare@suse.com> CC: Christophe Varoqui <christophe.varoqui@gmail.com> Signed-off-by: Petr Uzel <petr.uzel@suse.cz> --- kpartx/gpt.c | 6 +++--- kpartx/kpartx.c | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) Index: multipath-tools-0.4.9/kpartx/gpt.c =================================================================== --- multipath-tools-0.4.9.orig/kpartx/gpt.c +++ multipath-tools-0.4.9/kpartx/gpt.c @@ -625,8 +625,8 @@ find_valid_gpt(int fd, gpt_header ** gpt * @fd * @all - slice with start/size of whole disk * - * 0 if this isn't our partition table - * number of partitions if successful + * -1 if this isn't our partition table + * number of partitions if successful (>= 0) * */ int @@ -643,7 +643,7 @@ read_gpt_pt (int fd, struct slice all, s free (gpt); if (ptes) free (ptes); - return 0; + return -1; } for (i = 0; i < __le32_to_cpu(gpt->num_partition_entries) && i < ns; i++) { Index: multipath-tools-0.4.9/kpartx/kpartx.c =================================================================== --- multipath-tools-0.4.9.orig/kpartx/kpartx.c +++ multipath-tools-0.4.9/kpartx/kpartx.c @@ -368,12 +368,10 @@ main(int argc, char **argv){ /* here we get partitions */ n = ptp->fn(fd, all, slices, SIZE(slices)); + if (n >= 0) { #ifdef DEBUG - if (n >= 0) printf("%s: %d slices\n", ptp->type, n); #endif - - if (n > 0) { close(fd); fd = -1; } @@ -607,7 +605,7 @@ main(int argc, char **argv){ break; } - if (n > 0) + if (n >= 0) break; } if (what == LIST && loopcreated && S_ISREG (buf.st_mode)) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor