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
This commit is contained in:
parent
845894074a
commit
c956ace928
@ -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)
|
||||
|
@ -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 *
|
||||
|
@ -66,12 +66,12 @@ static void fixit_common(void);
|
||||
static void installConfigure(void);
|
||||
|
||||
Boolean
|
||||
checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev, Chunk **vtdev, Chunk **hdev)
|
||||
checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev, Chunk **tdev, Chunk **hdev)
|
||||
{
|
||||
Device **devs;
|
||||
Boolean status;
|
||||
Disk *disk;
|
||||
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev, *vartmpdev, *homedev;
|
||||
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev, *tmpdev, *homedev;
|
||||
int i;
|
||||
|
||||
/* Don't allow whinging if noWarn is set */
|
||||
@ -87,11 +87,11 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
*udev = NULL;
|
||||
if (vdev)
|
||||
*vdev = NULL;
|
||||
if (vtdev)
|
||||
*vtdev = NULL;
|
||||
if (tdev)
|
||||
*tdev = NULL;
|
||||
if (hdev)
|
||||
*hdev = NULL;
|
||||
rootdev = swapdev = usrdev = vardev = vartmpdev = homedev = NULL;
|
||||
rootdev = swapdev = usrdev = vardev = tmpdev = homedev = NULL;
|
||||
|
||||
/* We don't need to worry about root/usr/swap if we're already multiuser */
|
||||
if (!RunningAsInit)
|
||||
@ -148,17 +148,17 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
if (isDebug())
|
||||
msgDebug("Found vardev at %s!\n", vardev->name);
|
||||
}
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/var/tmp")) {
|
||||
if (vartmpdev) {
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/tmp")) {
|
||||
if (tmpdev) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /var/tmp filesystem.\n"
|
||||
msgConfirm("WARNING: You have more than one /tmp filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
vartmpdev = c2;
|
||||
tmpdev = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found vartmpdev at %s!\n", vartmpdev->name);
|
||||
msgDebug("Found tmpdev at %s!\n", tmpdev->name);
|
||||
}
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/home")) {
|
||||
if (homedev) {
|
||||
@ -210,8 +210,8 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
*udev = usrdev;
|
||||
if (vdev)
|
||||
*vdev = vardev;
|
||||
if (vtdev)
|
||||
*vtdev = vartmpdev;
|
||||
if (tdev)
|
||||
*tdev = tmpdev;
|
||||
if (hdev)
|
||||
*hdev = homedev;
|
||||
|
||||
|
@ -1027,6 +1027,11 @@ diskLabel(Device *dev)
|
||||
case 'T': /* Toggle newfs state */
|
||||
if (label_chunk_info[here].type == PART_FILESYSTEM) {
|
||||
PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private_data);
|
||||
if (!pi->newfs)
|
||||
label_chunk_info[here].c->flags |= CHUNK_NEWFS;
|
||||
else
|
||||
label_chunk_info[here].c->flags &= ~CHUNK_NEWFS;
|
||||
|
||||
label_chunk_info[here].c->private_data =
|
||||
new_part(pi ? pi->mountpoint : NULL, pi ? !pi->newfs : TRUE, label_chunk_info[here].c->size);
|
||||
if (pi && pi->soft)
|
||||
@ -1165,13 +1170,13 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
struct chunk *swap_chunk = NULL;
|
||||
struct chunk *usr_chunk = NULL;
|
||||
struct chunk *var_chunk = NULL;
|
||||
struct chunk *vartmp_chunk = NULL;
|
||||
struct chunk *tmp_chunk = NULL;
|
||||
struct chunk *home_chunk = NULL;
|
||||
int mib[2];
|
||||
unsigned int physmem;
|
||||
size_t size;
|
||||
Chunk *rootdev, *swapdev, *usrdev, *vardev;
|
||||
Chunk *vartmpdev, *homedev;
|
||||
Chunk *tmpdev, *homedev;
|
||||
char *msg = NULL;
|
||||
|
||||
sz = space_free(label_chunk_info[here].c);
|
||||
@ -1179,12 +1184,13 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
return("Not enough free space to create a new partition in the slice");
|
||||
|
||||
(void)checkLabels(FALSE, &rootdev, &swapdev, &usrdev,
|
||||
&vardev, &vartmpdev, &homedev);
|
||||
&vardev, &tmpdev, &homedev);
|
||||
if (!rootdev) {
|
||||
sz = requested_part_size(VAR_ROOT_SIZE, ROOT_NOMINAL_SIZE, ROOT_DEFAULT_SIZE, perc);
|
||||
|
||||
root_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, CHUNK_IS_ROOT);
|
||||
root_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_IS_ROOT | CHUNK_AUTO_SIZE);
|
||||
if (!root_chunk) {
|
||||
*req = 1;
|
||||
msg = "Unable to create the root partition. Too big?";
|
||||
@ -1192,6 +1198,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
root_chunk->private_data = new_part("/", TRUE, root_chunk->size);
|
||||
root_chunk->private_free = safe_free;
|
||||
root_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!swapdev) {
|
||||
@ -1212,8 +1219,9 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
nom = (int)(physmem / 512) / 2;
|
||||
sz = nom + (def - nom) * perc / 100;
|
||||
}
|
||||
swap_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
|
||||
sz, part, FS_SWAP, 0);
|
||||
swap_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_SWAP, CHUNK_AUTO_SIZE);
|
||||
if (!swap_chunk) {
|
||||
*req = 1;
|
||||
msg = "Unable to create the swap partition. Too big?";
|
||||
@ -1226,8 +1234,9 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
if (!vardev) {
|
||||
sz = requested_part_size(VAR_VAR_SIZE, VAR_NOMINAL_SIZE, VAR_DEFAULT_SIZE, perc);
|
||||
|
||||
var_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, 0);
|
||||
var_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!var_chunk) {
|
||||
*req = 1;
|
||||
msg = "Not enough free space for /var - you will need to\n"
|
||||
@ -1236,21 +1245,24 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
var_chunk->private_data = new_part("/var", TRUE, var_chunk->size);
|
||||
var_chunk->private_free = safe_free;
|
||||
var_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!vartmpdev && !variable_get(VAR_NO_VARTMP)) {
|
||||
if (!tmpdev && !variable_get(VAR_NO_VARTMP)) {
|
||||
sz = requested_part_size(VAR_VARTMP_SIZE, VARTMP_NOMINAL_SIZE, VARTMP_DEFAULT_SIZE, perc);
|
||||
|
||||
vartmp_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, 0);
|
||||
if (!vartmp_chunk) {
|
||||
tmp_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!tmp_chunk) {
|
||||
*req = 1;
|
||||
msg = "Not enough free space for /var/tmp - you will need to\n"
|
||||
"partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
vartmp_chunk->private_data = new_part("/var/tmp", TRUE, vartmp_chunk->size);
|
||||
vartmp_chunk->private_free = safe_free;
|
||||
tmp_chunk->private_data = new_part("/tmp", TRUE, tmp_chunk->size);
|
||||
tmp_chunk->private_free = safe_free;
|
||||
tmp_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!usrdev && !variable_get(VAR_NO_USR)) {
|
||||
@ -1266,8 +1278,8 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
|
||||
usr_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, 0);
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!usr_chunk) {
|
||||
msg = "Unable to create the /usr partition. Not enough space?\n"
|
||||
"You will need to partition your disk manually with a custom install!";
|
||||
@ -1275,6 +1287,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
usr_chunk->private_data = new_part("/usr", TRUE, usr_chunk->size);
|
||||
usr_chunk->private_free = safe_free;
|
||||
usr_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
}
|
||||
@ -1291,8 +1304,8 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
|
||||
home_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, 0);
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!home_chunk) {
|
||||
msg = "Unable to create the /home partition. Not enough space?\n"
|
||||
"You will need to partition your disk manually with a custom install!";
|
||||
@ -1300,6 +1313,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
home_chunk->private_data = new_part("/home", TRUE, home_chunk->size);
|
||||
home_chunk->private_free = safe_free;
|
||||
home_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
}
|
||||
@ -1316,8 +1330,8 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
Delete_Chunk(swap_chunk->disk, swap_chunk);
|
||||
if (var_chunk)
|
||||
Delete_Chunk(var_chunk->disk, var_chunk);
|
||||
if (vartmp_chunk)
|
||||
Delete_Chunk(vartmp_chunk->disk, vartmp_chunk);
|
||||
if (tmp_chunk)
|
||||
Delete_Chunk(tmp_chunk->disk, tmp_chunk);
|
||||
if (usr_chunk)
|
||||
Delete_Chunk(usr_chunk->disk, usr_chunk);
|
||||
if (home_chunk)
|
||||
|
@ -66,12 +66,12 @@ static void fixit_common(void);
|
||||
static void installConfigure(void);
|
||||
|
||||
Boolean
|
||||
checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev, Chunk **vtdev, Chunk **hdev)
|
||||
checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vdev, Chunk **tdev, Chunk **hdev)
|
||||
{
|
||||
Device **devs;
|
||||
Boolean status;
|
||||
Disk *disk;
|
||||
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev, *vartmpdev, *homedev;
|
||||
Chunk *c1, *c2, *rootdev, *swapdev, *usrdev, *vardev, *tmpdev, *homedev;
|
||||
int i;
|
||||
|
||||
/* Don't allow whinging if noWarn is set */
|
||||
@ -87,11 +87,11 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
*udev = NULL;
|
||||
if (vdev)
|
||||
*vdev = NULL;
|
||||
if (vtdev)
|
||||
*vtdev = NULL;
|
||||
if (tdev)
|
||||
*tdev = NULL;
|
||||
if (hdev)
|
||||
*hdev = NULL;
|
||||
rootdev = swapdev = usrdev = vardev = vartmpdev = homedev = NULL;
|
||||
rootdev = swapdev = usrdev = vardev = tmpdev = homedev = NULL;
|
||||
|
||||
/* We don't need to worry about root/usr/swap if we're already multiuser */
|
||||
if (!RunningAsInit)
|
||||
@ -148,17 +148,17 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
if (isDebug())
|
||||
msgDebug("Found vardev at %s!\n", vardev->name);
|
||||
}
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/var/tmp")) {
|
||||
if (vartmpdev) {
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/tmp")) {
|
||||
if (tmpdev) {
|
||||
if (whinge)
|
||||
msgConfirm("WARNING: You have more than one /var/tmp filesystem.\n"
|
||||
msgConfirm("WARNING: You have more than one /tmp filesystem.\n"
|
||||
"Using the first one found.");
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
vartmpdev = c2;
|
||||
tmpdev = c2;
|
||||
if (isDebug())
|
||||
msgDebug("Found vartmpdev at %s!\n", vartmpdev->name);
|
||||
msgDebug("Found tmpdev at %s!\n", tmpdev->name);
|
||||
}
|
||||
} else if (!strcmp(((PartInfo *)c2->private_data)->mountpoint, "/home")) {
|
||||
if (homedev) {
|
||||
@ -210,8 +210,8 @@ checkLabels(Boolean whinge, Chunk **rdev, Chunk **sdev, Chunk **udev, Chunk **vd
|
||||
*udev = usrdev;
|
||||
if (vdev)
|
||||
*vdev = vardev;
|
||||
if (vtdev)
|
||||
*vtdev = vartmpdev;
|
||||
if (tdev)
|
||||
*tdev = tmpdev;
|
||||
if (hdev)
|
||||
*hdev = homedev;
|
||||
|
||||
|
@ -1027,6 +1027,11 @@ diskLabel(Device *dev)
|
||||
case 'T': /* Toggle newfs state */
|
||||
if (label_chunk_info[here].type == PART_FILESYSTEM) {
|
||||
PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private_data);
|
||||
if (!pi->newfs)
|
||||
label_chunk_info[here].c->flags |= CHUNK_NEWFS;
|
||||
else
|
||||
label_chunk_info[here].c->flags &= ~CHUNK_NEWFS;
|
||||
|
||||
label_chunk_info[here].c->private_data =
|
||||
new_part(pi ? pi->mountpoint : NULL, pi ? !pi->newfs : TRUE, label_chunk_info[here].c->size);
|
||||
if (pi && pi->soft)
|
||||
@ -1165,13 +1170,13 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
struct chunk *swap_chunk = NULL;
|
||||
struct chunk *usr_chunk = NULL;
|
||||
struct chunk *var_chunk = NULL;
|
||||
struct chunk *vartmp_chunk = NULL;
|
||||
struct chunk *tmp_chunk = NULL;
|
||||
struct chunk *home_chunk = NULL;
|
||||
int mib[2];
|
||||
unsigned int physmem;
|
||||
size_t size;
|
||||
Chunk *rootdev, *swapdev, *usrdev, *vardev;
|
||||
Chunk *vartmpdev, *homedev;
|
||||
Chunk *tmpdev, *homedev;
|
||||
char *msg = NULL;
|
||||
|
||||
sz = space_free(label_chunk_info[here].c);
|
||||
@ -1179,12 +1184,13 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
return("Not enough free space to create a new partition in the slice");
|
||||
|
||||
(void)checkLabels(FALSE, &rootdev, &swapdev, &usrdev,
|
||||
&vardev, &vartmpdev, &homedev);
|
||||
&vardev, &tmpdev, &homedev);
|
||||
if (!rootdev) {
|
||||
sz = requested_part_size(VAR_ROOT_SIZE, ROOT_NOMINAL_SIZE, ROOT_DEFAULT_SIZE, perc);
|
||||
|
||||
root_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, CHUNK_IS_ROOT);
|
||||
root_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_IS_ROOT | CHUNK_AUTO_SIZE);
|
||||
if (!root_chunk) {
|
||||
*req = 1;
|
||||
msg = "Unable to create the root partition. Too big?";
|
||||
@ -1192,6 +1198,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
root_chunk->private_data = new_part("/", TRUE, root_chunk->size);
|
||||
root_chunk->private_free = safe_free;
|
||||
root_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!swapdev) {
|
||||
@ -1212,8 +1219,9 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
nom = (int)(physmem / 512) / 2;
|
||||
sz = nom + (def - nom) * perc / 100;
|
||||
}
|
||||
swap_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
|
||||
sz, part, FS_SWAP, 0);
|
||||
swap_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_SWAP, CHUNK_AUTO_SIZE);
|
||||
if (!swap_chunk) {
|
||||
*req = 1;
|
||||
msg = "Unable to create the swap partition. Too big?";
|
||||
@ -1226,8 +1234,9 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
if (!vardev) {
|
||||
sz = requested_part_size(VAR_VAR_SIZE, VAR_NOMINAL_SIZE, VAR_DEFAULT_SIZE, perc);
|
||||
|
||||
var_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, 0);
|
||||
var_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!var_chunk) {
|
||||
*req = 1;
|
||||
msg = "Not enough free space for /var - you will need to\n"
|
||||
@ -1236,21 +1245,24 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
var_chunk->private_data = new_part("/var", TRUE, var_chunk->size);
|
||||
var_chunk->private_free = safe_free;
|
||||
var_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!vartmpdev && !variable_get(VAR_NO_VARTMP)) {
|
||||
if (!tmpdev && !variable_get(VAR_NO_VARTMP)) {
|
||||
sz = requested_part_size(VAR_VARTMP_SIZE, VARTMP_NOMINAL_SIZE, VARTMP_DEFAULT_SIZE, perc);
|
||||
|
||||
vartmp_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk, label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, 0);
|
||||
if (!vartmp_chunk) {
|
||||
tmp_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!tmp_chunk) {
|
||||
*req = 1;
|
||||
msg = "Not enough free space for /var/tmp - you will need to\n"
|
||||
"partition your disk manually with a custom install!";
|
||||
goto done;
|
||||
}
|
||||
vartmp_chunk->private_data = new_part("/var/tmp", TRUE, vartmp_chunk->size);
|
||||
vartmp_chunk->private_free = safe_free;
|
||||
tmp_chunk->private_data = new_part("/tmp", TRUE, tmp_chunk->size);
|
||||
tmp_chunk->private_free = safe_free;
|
||||
tmp_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
if (!usrdev && !variable_get(VAR_NO_USR)) {
|
||||
@ -1266,8 +1278,8 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
|
||||
usr_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, 0);
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!usr_chunk) {
|
||||
msg = "Unable to create the /usr partition. Not enough space?\n"
|
||||
"You will need to partition your disk manually with a custom install!";
|
||||
@ -1275,6 +1287,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
usr_chunk->private_data = new_part("/usr", TRUE, usr_chunk->size);
|
||||
usr_chunk->private_free = safe_free;
|
||||
usr_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
}
|
||||
@ -1291,8 +1304,8 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
|
||||
home_chunk = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
|
||||
label_chunk_info[here].c,
|
||||
sz, part, FS_BSDFFS, 0);
|
||||
label_chunk_info[here].c, sz, part,
|
||||
FS_BSDFFS, CHUNK_AUTO_SIZE);
|
||||
if (!home_chunk) {
|
||||
msg = "Unable to create the /home partition. Not enough space?\n"
|
||||
"You will need to partition your disk manually with a custom install!";
|
||||
@ -1300,6 +1313,7 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
}
|
||||
home_chunk->private_data = new_part("/home", TRUE, home_chunk->size);
|
||||
home_chunk->private_free = safe_free;
|
||||
home_chunk->flags |= CHUNK_NEWFS;
|
||||
record_label_chunks(devs, dev);
|
||||
}
|
||||
}
|
||||
@ -1316,8 +1330,8 @@ try_auto_label(Device **devs, Device *dev, int perc, int *req)
|
||||
Delete_Chunk(swap_chunk->disk, swap_chunk);
|
||||
if (var_chunk)
|
||||
Delete_Chunk(var_chunk->disk, var_chunk);
|
||||
if (vartmp_chunk)
|
||||
Delete_Chunk(vartmp_chunk->disk, vartmp_chunk);
|
||||
if (tmp_chunk)
|
||||
Delete_Chunk(tmp_chunk->disk, tmp_chunk);
|
||||
if (usr_chunk)
|
||||
Delete_Chunk(usr_chunk->disk, usr_chunk);
|
||||
if (home_chunk)
|
||||
|
Loading…
Reference in New Issue
Block a user