]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: don't resize in label drivers
authorKarel Zak <kzak@redhat.com>
Tue, 21 Apr 2015 12:30:11 +0000 (14:30 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 22 Apr 2015 10:21:19 +0000 (12:21 +0200)
The resize operation has to be implemented on upper layer.

Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/dos.c
libfdisk/src/gpt.c

index f2308e3e04924d18475ecf908a6329c986d0faec..e5f70813270a64b18da14ad0774122d797f48a01 100644 (file)
@@ -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"));
 
index 0fb7c86270ebae1547db9466937854bb289f3dd1..34e5d8531832bb408bdd1c425fee256bd145bc80 100644 (file)
@@ -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))