summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/partition.c
diff options
context:
space:
mode:
authorKarel Zak2015-09-17 12:04:23 +0200
committerKarel Zak2015-09-17 12:04:23 +0200
commitf2be8b3dfcf990872e1964f028a89d46bf16b230 (patch)
tree9c5eda8b45f1cc7037ad3f58ae5a805aa808963b /libfdisk/src/partition.c
parentsfdisk: fix -N return code detection, add debug messages (diff)
downloadkernel-qcow2-util-linux-f2be8b3dfcf990872e1964f028a89d46bf16b230.tar.gz
kernel-qcow2-util-linux-f2be8b3dfcf990872e1964f028a89d46bf16b230.tar.xz
kernel-qcow2-util-linux-f2be8b3dfcf990872e1964f028a89d46bf16b230.zip
libfdisk: add more debug message to resize code
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/partition.c')
-rw-r--r--libfdisk/src/partition.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c
index aeba7c402..001fa356e 100644
--- a/libfdisk/src/partition.c
+++ b/libfdisk/src/partition.c
@@ -1006,7 +1006,7 @@ static int recount_resize(
struct fdisk_table *tb = NULL;
int rc;
- DBG(PART, ul_debugobj(tpl, "resize requested"));
+ DBG(PART, ul_debugobj(tpl, ">>> resize requested"));
FDISK_INIT_UNDEF(start);
FDISK_INIT_UNDEF(size);
@@ -1033,9 +1033,14 @@ static int recount_resize(
} else
start += fdisk_partition_get_start(tpl);
+ DBG(PART, ul_debugobj(tpl, "resize: moving start %s relative, new start: %ju",
+ tpl->movestart == FDISK_MOVE_DOWN ? "DOWN" : "UP", start));
+
/* 1b) set new start - absolute number */
- } else if (fdisk_partition_has_start(tpl))
+ } else if (fdisk_partition_has_start(tpl)) {
start = fdisk_partition_get_start(tpl);
+ DBG(PART, ul_debugobj(tpl, "resize: moving start to absolute offset: %ju", start));
+ }
/* 2) verify that start is within the current partition or any freespace area */
if (!FDISK_IS_UNDEF(start)) {
@@ -1050,6 +1055,7 @@ static int recount_resize(
goto erange;
} else {
/* no change, start points to the current partition */
+ DBG(PART, ul_debugobj(tpl, "resize: start unchanged"));
start = fdisk_partition_get_start(cur);
}
@@ -1088,9 +1094,12 @@ static int recount_resize(
(uintmax_t) size, (uintmax_t) maxsz));
if (size > maxsz)
goto erange;
+ } else {
+ DBG(PART, ul_debugobj(tpl, "resize: size unchanged (undefined)"));
}
- DBG(PART, ul_debugobj(tpl, "resize: SUCCESS: start %ju->%ju; size %ju->%ju",
+
+ DBG(PART, ul_debugobj(tpl, "<<< resize: SUCCESS: start %ju->%ju; size %ju->%ju",
(uintmax_t) fdisk_partition_get_start(cur), (uintmax_t) start,
(uintmax_t) fdisk_partition_get_size(cur), (uintmax_t) size));
res->start = start;
@@ -1098,7 +1107,7 @@ static int recount_resize(
fdisk_unref_table(tb);
return 0;
erange:
- DBG(PART, ul_debugobj(tpl, "resize: FAILED"));
+ DBG(PART, ul_debugobj(tpl, "<<< resize: FAILED"));
fdisk_warnx(cxt, _("Failed to resize partition #%zu."), partno + 1);
fdisk_unref_table(tb);
return -ERANGE;