From c956ace9287cde07a8c002decbaad4801fbdb728 Mon Sep 17 00:00:00 2001 From: dillon Date: Sun, 9 Dec 2001 23:40:02 +0000 Subject: Add auto-fill-on-delete. When deleting an 'A'uto created partition sysinstall will automatically expand the previous partition to take up the freed up space. So you can 'D'elete /home and /usr will get the combined space, or you can 'D'elete /tmp and /var will get the combined space. This gives the user, developer, or lay person a huge amount of flexibility in constructing partitions from an 'A'uto base. It takes only 3 or 4 keystrokes to achieve virtually any combination of having or not having a /tmp and/or /home after doing an 'A'uto create. Change 'A'uto creation of /var/tmp to 'A'uto creation /tmp, which should be less controversial. MFC after: 6 days --- lib/libdisk/chunk.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'lib/libdisk/chunk.c') diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c index 83c247a..b2e9d3d 100644 --- a/lib/libdisk/chunk.c +++ b/lib/libdisk/chunk.c @@ -363,6 +363,7 @@ Delete_Chunk(struct disk *d, struct chunk *c) { struct chunk *c1=0, *c2, *c3; chunk_e type = c->type; + long offset = c->offset; if(type == whole) return 1; @@ -398,9 +399,19 @@ Delete_Chunk(struct disk *d, struct chunk *c) } return 1; scan: + /* + * Collapse multiple unused elements together, and attempt + * to extend the previous chunk into the freed chunk. + */ for(c2 = c1->part; c2; c2 = c2->next) { - if (c2->type != unused) - continue; + if (c2->type != unused) { + if (c2->offset + c2->size != offset || + (c2->flags & CHUNK_AUTO_SIZE) == 0 || + (c2->flags & CHUNK_NEWFS) == 0) { + continue; + } + /* else extend into free area */ + } if (!c2->next) continue; if (c2->next->type != unused) -- cgit v1.1