diff options
author | marcel <marcel@FreeBSD.org> | 2002-11-14 01:46:20 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2002-11-14 01:46:20 +0000 |
commit | dfa993f696df610240e67a7ca2e65c6f3a4742f1 (patch) | |
tree | 1c4d4d682fd876a665f7e7b094bfaaeffca099d6 /usr.sbin/sade/label.c | |
parent | ed16ce021a0ae9508c8a87f34b8a6b4e6ea6fd1f (diff) | |
download | FreeBSD-src-dfa993f696df610240e67a7ca2e65c6f3a4742f1.zip FreeBSD-src-dfa993f696df610240e67a7ca2e65c6f3a4742f1.tar.gz |
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.
Diffstat (limited to 'usr.sbin/sade/label.c')
-rw-r--r-- | usr.sbin/sade/label.c | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index 62f0024..ba2d655 100644 --- a/usr.sbin/sade/label.c +++ b/usr.sbin/sade/label.c @@ -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; |