From: Karel Zak Date: Tue, 21 Apr 2015 12:30:11 +0000 (+0200) Subject: libfdisk: don't resize in label drivers X-Git-Tag: v2.27-rc1~254 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee105ed6f3e5aeef8b01944d8f81296f83e92ac2;p=thirdparty%2Futil-linux.git libfdisk: don't resize in label drivers The resize operation has to be implemented on upper layer. Signed-off-by: Karel Zak --- diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c index f2308e3e04..e5f7081327 100644 --- a/libfdisk/src/dos.c +++ b/libfdisk/src/dos.c @@ -1897,7 +1897,6 @@ static int dos_get_partition(struct fdisk_context *cxt, size_t n, static int dos_set_partition(struct fdisk_context *cxt, size_t n, struct fdisk_partition *pa) { - struct fdisk_dos_label *l; struct dos_partition *p; struct pte *pe; fdisk_sector_t start, size; @@ -1919,7 +1918,6 @@ static int dos_set_partition(struct fdisk_context *cxt, size_t n, if (pa->type && !pa->type->code) fdisk_warnx(cxt, _("Type 0 means free space to many systems. " "Having partitions of type 0 is probably unwise.")); - l = self_label(cxt); p = self_partition(cxt, n); pe = self_pte(cxt, n); @@ -1931,31 +1929,6 @@ static int dos_set_partition(struct fdisk_context *cxt, size_t n, if (fdisk_partition_has_size(pa)) size = pa->size; - if (pa->end_follow_default) { - fdisk_sector_t first[cxt->label->nparts_max], - last[cxt->label->nparts_max], - xlast; - struct pte *ext = l->ext_offset ? self_pte(cxt, l->ext_index) : NULL; - - fill_bounds(cxt, first, last); - - if (ext && l->ext_offset) { - first[l->ext_index] = l->ext_offset; - last[l->ext_index] = get_abs_partition_end(ext); - } - if (FDISK_IS_UNDEF(start)) - start = get_abs_partition_start(pe); - - DBG(LABEL, ul_debug("DOS: #%zu now %ju +%ju sectors", - n, (uintmax_t) start, (uintmax_t) dos_partition_get_size(p))); - - xlast = get_unused_last(cxt, n, start, first, last); - size = xlast ? xlast - start + 1: dos_partition_get_size(p); - - DBG(LABEL, ul_debug("DOS: #%zu wanted %ju +%ju sectors", - n, (uintmax_t) start, (uintmax_t) size)); - } - if (!FDISK_IS_UNDEF(start) || !FDISK_IS_UNDEF(size)) { DBG(LABEL, ul_debug("DOS: resize partition")); diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index 0fb7c86270..34e5d85318 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -1646,15 +1646,6 @@ static int gpt_set_partition(struct fdisk_context *cxt, size_t n, if (fdisk_partition_has_size(pa)) end = gpt_partition_start(e) + pa->size - 1ULL; - if (pa->end_follow_default) { - /* enlarge */ - if (!FDISK_IS_UNDEF(start)) - start = gpt_partition_start(e); - end = find_last_free(gpt->bheader, gpt->ents, start); - if (!end) - FDISK_INIT_UNDEF(end); - } - if (!FDISK_IS_UNDEF(start)) e->lba_start = cpu_to_le64(start); if (!FDISK_IS_UNDEF(end))