Add conditional code specific to ia64 to allow newfs(8)-ing FAT

partitions marked as being of type efi. This change adds code to
1. actually run the newfs command at mount time (install.c),
2. display the newfs state on screen (label.c)
3. allow toggling of the newfs state (label.c)

Even though newfs(8)-ing FAT partitions can be of use on i386
machines in general, it has been opted to minimize impact for
now.
This commit is contained in:
marcel 2002-11-14 01:46:20 +00:00
parent ed16ce021a
commit dfa993f696
4 changed files with 118 additions and 6 deletions

View File

@ -1038,12 +1038,22 @@ installFilesystems(dialogMenuItem *self)
}
}
}
else if ((c1->type == fat || c1->type == efi) && c1->private_data && (root->newfs || upgrade)) {
else if (c1->type == fat && c1->private_data && (root->newfs || upgrade)) {
char name[FILENAME_MAX];
sprintf(name, "%s/%s", RunningAsInit ? "/mnt" : "", ((PartInfo *)c1->private_data)->mountpoint);
Mkdir(name);
}
#if defined(__ia64__)
else if (c1->type == efi && c1->private_data) {
PartInfo *pi = (PartInfo *)c1->private_data;
if (pi->newfs && (!upgrade || !msgNoYes("You are upgrading - are you SURE you want to newfs /dev/%s?", c1->name)))
command_shell_add(pi->mountpoint, "%s %s/dev/%s", pi->newfs_cmd, RunningAsInit ? "/mnt" : "", c1->name);
command_func_add(pi->mountpoint, Mount, c1->name);
}
#endif
}
}

View File

@ -336,6 +336,25 @@ new_part(char *mpoint, Boolean newfs)
return ret;
}
#if defined(__ia64__)
static PartInfo *
new_efi_part(char *mpoint, Boolean newfs)
{
PartInfo *ret;
if (!mpoint)
mpoint = "/efi";
ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
sstrncpy(ret->mountpoint, mpoint, FILENAME_MAX);
/* XXX */
strcpy(ret->newfs_cmd, "newfs_msdos ");
ret->newfs = newfs;
ret->soft = 0;
return ret;
}
#endif
/* Get the mountpoint for a partition and save it away */
static PartInfo *
get_mountpoint(struct chunk *old)
@ -600,8 +619,17 @@ print_label_chunks(void)
mountpoint = "<none>";
/* Now display the newfs field */
if (label_chunk_info[i].type == PART_FAT)
strcpy(newfs, "DOS");
if (label_chunk_info[i].type == PART_FAT) {
strcpy(newfs, "DOS");
#if defined(__ia64__)
if (label_chunk_info[i].c->private_data &&
label_chunk_info[i].c->type == efi) {
strcat(newfs, " ");
PartInfo *pi = (PartInfo *)label_chunk_info[i].c->private_data;
strcat(newfs, pi->newfs ? " Y" : " N");
}
#endif
}
else if (label_chunk_info[i].c->private_data && label_chunk_info[i].type == PART_FILESYSTEM) {
strcpy(newfs, "UFS");
strcat(newfs,
@ -1018,6 +1046,24 @@ diskLabel(Device *dev)
if (variable_cmp(DISK_LABELLED, "written"))
variable_set2(DISK_LABELLED, "yes", 0);
}
#if defined(__ia64__)
else if (label_chunk_info[here].type == PART_FAT &&
label_chunk_info[here].c->type == efi &&
label_chunk_info[here].c->private_data) {
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_efi_part(pi->mountpoint, !pi->newfs);
safe_free(pi);
label_chunk_info[here].c->private_free = safe_free;
if (variable_cmp(DISK_LABELLED, "written"))
variable_set2(DISK_LABELLED, "yes", 0);
}
#endif
else
msg = MSG_NOT_APPLICABLE;
break;

View File

@ -1038,12 +1038,22 @@ installFilesystems(dialogMenuItem *self)
}
}
}
else if ((c1->type == fat || c1->type == efi) && c1->private_data && (root->newfs || upgrade)) {
else if (c1->type == fat && c1->private_data && (root->newfs || upgrade)) {
char name[FILENAME_MAX];
sprintf(name, "%s/%s", RunningAsInit ? "/mnt" : "", ((PartInfo *)c1->private_data)->mountpoint);
Mkdir(name);
}
#if defined(__ia64__)
else if (c1->type == efi && c1->private_data) {
PartInfo *pi = (PartInfo *)c1->private_data;
if (pi->newfs && (!upgrade || !msgNoYes("You are upgrading - are you SURE you want to newfs /dev/%s?", c1->name)))
command_shell_add(pi->mountpoint, "%s %s/dev/%s", pi->newfs_cmd, RunningAsInit ? "/mnt" : "", c1->name);
command_func_add(pi->mountpoint, Mount, c1->name);
}
#endif
}
}

View File

@ -336,6 +336,25 @@ new_part(char *mpoint, Boolean newfs)
return ret;
}
#if defined(__ia64__)
static PartInfo *
new_efi_part(char *mpoint, Boolean newfs)
{
PartInfo *ret;
if (!mpoint)
mpoint = "/efi";
ret = (PartInfo *)safe_malloc(sizeof(PartInfo));
sstrncpy(ret->mountpoint, mpoint, FILENAME_MAX);
/* XXX */
strcpy(ret->newfs_cmd, "newfs_msdos ");
ret->newfs = newfs;
ret->soft = 0;
return ret;
}
#endif
/* Get the mountpoint for a partition and save it away */
static PartInfo *
get_mountpoint(struct chunk *old)
@ -600,8 +619,17 @@ print_label_chunks(void)
mountpoint = "<none>";
/* Now display the newfs field */
if (label_chunk_info[i].type == PART_FAT)
strcpy(newfs, "DOS");
if (label_chunk_info[i].type == PART_FAT) {
strcpy(newfs, "DOS");
#if defined(__ia64__)
if (label_chunk_info[i].c->private_data &&
label_chunk_info[i].c->type == efi) {
strcat(newfs, " ");
PartInfo *pi = (PartInfo *)label_chunk_info[i].c->private_data;
strcat(newfs, pi->newfs ? " Y" : " N");
}
#endif
}
else if (label_chunk_info[i].c->private_data && label_chunk_info[i].type == PART_FILESYSTEM) {
strcpy(newfs, "UFS");
strcat(newfs,
@ -1018,6 +1046,24 @@ diskLabel(Device *dev)
if (variable_cmp(DISK_LABELLED, "written"))
variable_set2(DISK_LABELLED, "yes", 0);
}
#if defined(__ia64__)
else if (label_chunk_info[here].type == PART_FAT &&
label_chunk_info[here].c->type == efi &&
label_chunk_info[here].c->private_data) {
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_efi_part(pi->mountpoint, !pi->newfs);
safe_free(pi);
label_chunk_info[here].c->private_free = safe_free;
if (variable_cmp(DISK_LABELLED, "written"))
variable_set2(DISK_LABELLED, "yes", 0);
}
#endif
else
msg = MSG_NOT_APPLICABLE;
break;