diff options
author | Karel Zak | 2017-01-16 11:20:32 +0100 |
---|---|---|
committer | Karel Zak | 2017-01-16 11:20:32 +0100 |
commit | b2140d2f24e046d57f9c653aad2f21732f04a51e (patch) | |
tree | b7c3f4ee0ee630ae61e51278cce5e01603f2ce9a /libfdisk/src/alignment.c | |
parent | partx: add --sector-size option (diff) | |
download | kernel-qcow2-util-linux-b2140d2f24e046d57f9c653aad2f21732f04a51e.tar.gz kernel-qcow2-util-linux-b2140d2f24e046d57f9c653aad2f21732f04a51e.tar.xz kernel-qcow2-util-linux-b2140d2f24e046d57f9c653aad2f21732f04a51e.zip |
libfdisk: apply label alignment properties
This fix changes from the previous patches.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/alignment.c')
-rw-r--r-- | libfdisk/src/alignment.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libfdisk/src/alignment.c b/libfdisk/src/alignment.c index 15d6140ed..77ca35dc5 100644 --- a/libfdisk/src/alignment.c +++ b/libfdisk/src/alignment.c @@ -614,6 +614,20 @@ static unsigned long topology_get_grain(struct fdisk_context *cxt) return res; } +/* apply label alignment setting to the context -- if not sure use + * fdisk_reset_alignment() + */ +int fdisk_apply_label_device_properties(struct fdisk_context *cxt) +{ + int rc = 0; + + if (cxt->label && cxt->label->op->reset_alignment) { + DBG(CXT, ul_debugobj(cxt, "appling label device properties...")); + rc = cxt->label->op->reset_alignment(cxt); + } + return rc; +} + /** * fdisk_reset_alignment: * @cxt: fdisk context @@ -638,8 +652,7 @@ int fdisk_reset_alignment(struct fdisk_context *cxt) cxt->last_lba = cxt->total_sectors - 1; /* overwrite default by label stuff */ - if (cxt->label && cxt->label->op->reset_alignment) - rc = cxt->label->op->reset_alignment(cxt); + rc = fdisk_apply_label_device_properties(cxt); DBG(CXT, ul_debugobj(cxt, "alignment reset to: " "first LBA=%ju, last LBA=%ju, grain=%lu [rc=%d]", |