Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f35d1b

Browse files
committed
libfdisk: don't resize in label drivers
The resize operation has to be implemented on upper layer. Signed-off-by: Karel Zak <[email protected]>
1 parent a01a490 commit 9f35d1b

File tree

2 files changed

+0
-36
lines changed

2 files changed

+0
-36
lines changed

libfdisk/src/dos.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1897,7 +1897,6 @@ static int dos_get_partition(struct fdisk_context *cxt, size_t n,
18971897
static int dos_set_partition(struct fdisk_context *cxt, size_t n,
18981898
struct fdisk_partition *pa)
18991899
{
1900-
struct fdisk_dos_label *l;
19011900
struct dos_partition *p;
19021901
struct pte *pe;
19031902
fdisk_sector_t start, size;
@@ -1919,7 +1918,6 @@ static int dos_set_partition(struct fdisk_context *cxt, size_t n,
19191918
if (pa->type && !pa->type->code)
19201919
fdisk_warnx(cxt, _("Type 0 means free space to many systems. "
19211920
"Having partitions of type 0 is probably unwise."));
1922-
l = self_label(cxt);
19231921
p = self_partition(cxt, n);
19241922
pe = self_pte(cxt, n);
19251923

@@ -1931,31 +1929,6 @@ static int dos_set_partition(struct fdisk_context *cxt, size_t n,
19311929
if (fdisk_partition_has_size(pa))
19321930
size = pa->size;
19331931

1934-
if (pa->end_follow_default) {
1935-
fdisk_sector_t first[cxt->label->nparts_max],
1936-
last[cxt->label->nparts_max],
1937-
xlast;
1938-
struct pte *ext = l->ext_offset ? self_pte(cxt, l->ext_index) : NULL;
1939-
1940-
fill_bounds(cxt, first, last);
1941-
1942-
if (ext && l->ext_offset) {
1943-
first[l->ext_index] = l->ext_offset;
1944-
last[l->ext_index] = get_abs_partition_end(ext);
1945-
}
1946-
if (FDISK_IS_UNDEF(start))
1947-
start = get_abs_partition_start(pe);
1948-
1949-
DBG(LABEL, ul_debug("DOS: #%zu now %ju +%ju sectors",
1950-
n, (uintmax_t) start, (uintmax_t) dos_partition_get_size(p)));
1951-
1952-
xlast = get_unused_last(cxt, n, start, first, last);
1953-
size = xlast ? xlast - start + 1: dos_partition_get_size(p);
1954-
1955-
DBG(LABEL, ul_debug("DOS: #%zu wanted %ju +%ju sectors",
1956-
n, (uintmax_t) start, (uintmax_t) size));
1957-
}
1958-
19591932
if (!FDISK_IS_UNDEF(start) || !FDISK_IS_UNDEF(size)) {
19601933
DBG(LABEL, ul_debug("DOS: resize partition"));
19611934

libfdisk/src/gpt.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,15 +1646,6 @@ static int gpt_set_partition(struct fdisk_context *cxt, size_t n,
16461646
if (fdisk_partition_has_size(pa))
16471647
end = gpt_partition_start(e) + pa->size - 1ULL;
16481648

1649-
if (pa->end_follow_default) {
1650-
/* enlarge */
1651-
if (!FDISK_IS_UNDEF(start))
1652-
start = gpt_partition_start(e);
1653-
end = find_last_free(gpt->bheader, gpt->ents, start);
1654-
if (!end)
1655-
FDISK_INIT_UNDEF(end);
1656-
}
1657-
16581649
if (!FDISK_IS_UNDEF(start))
16591650
e->lba_start = cpu_to_le64(start);
16601651
if (!FDISK_IS_UNDEF(end))

0 commit comments

Comments
 (0)