summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>2001-12-09 23:40:02 +0000
committerdillon <dillon@FreeBSD.org>2001-12-09 23:40:02 +0000
commitc956ace9287cde07a8c002decbaad4801fbdb728 (patch)
treef3f84b26521094c279e0a04f4d5a2cde0af6dbb2 /lib
parent845894074a1beb0a467683592d77d4c5999cb88b (diff)
downloadFreeBSD-src-c956ace9287cde07a8c002decbaad4801fbdb728.zip
FreeBSD-src-c956ace9287cde07a8c002decbaad4801fbdb728.tar.gz
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
Diffstat (limited to 'lib')
-rw-r--r--lib/libdisk/chunk.c15
-rw-r--r--lib/libdisk/libdisk.h40
2 files changed, 38 insertions, 17 deletions
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)
diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h
index 9457dfb..7281f8e 100644
--- a/lib/libdisk/libdisk.h
+++ b/lib/libdisk/libdisk.h
@@ -69,21 +69,6 @@ struct chunk {
chunk_e type;
int subtype;
u_long flags;
-# define CHUNK_BSD_COMPAT 2
- /* this chunk is in the BSD-compatibility, and has a
- * short name too, ie wd0s4f -> wd0f
- */
-# define CHUNK_ALIGN 8
- /* This chunk should be aligned */
-# define CHUNK_IS_ROOT 16
- /* This 'part' is a rootfs, allocate 'a' */
-# define CHUNK_ACTIVE 32
- /* This is the active slice in the MBR */
-# define CHUNK_FORCE_ALL 64
- /* Force a dedicated disk for FreeBSD, bypassing
- * all BIOS geometry considerations
- */
-
void (*private_free)(void*);
void *(*private_clone)(void*);
void *private_data;
@@ -94,6 +79,31 @@ struct chunk {
*/
};
+/*
+ * flags:
+ *
+ * BSD_COMPAT - This chunk is in the BSD-compatibility, and has
+ * a short name too, ie wd0s4f -> wd0f
+ * ALIGN - This chunk should be aligned
+ * IS_ROOT - This 'part' is a rootfs, allocate 'a'
+ * ACTIVE - This is the active slice in the MBR
+ * FORCE_ALL - Force a dedicated disk for FreeBSD, bypassing
+ * all BIOS geometry considerations
+ * AUTO_SIZE - This chunk was auto-sized and can fill-out a
+ * following chunk if the following chunk is deleted.
+ * NEWFS - newfs pending, used to enable auto-resizing on
+ * delete (along with AUTO_SIZE).
+ */
+
+#define CHUNK_BSD_COMPAT 0x0002
+#define CHUNK_ALIGN 0x0008
+#define CHUNK_IS_ROOT 0x0010
+#define CHUNK_ACTIVE 0x0020
+#define CHUNK_FORCE_ALL 0x0040
+#define CHUNK_AUTO_SIZE 0x0080
+#define CHUNK_NEWFS 0x0100
+
+
extern const char *chunk_n[];
const char *
OpenPOWER on IntegriCloud