From 7e8dbd8b2043fb523ccb13c9f6d5ea014ab0ae0e Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Mon, 2 Dec 2002 20:15:16 +0000 Subject: ia64 specific. o Mount the EFI file system as msdosfs and not ufs as it's a FAT file system. Introduce Mount_msdos() for this to go side-by-side with Mount(). o Also, since mounting is performed as a command (which means it's queued, sorted, lost, found and executed), we cannot create a directory on the file system by calling mkdir. We must make sure the mkdir happens after the mount. Introduce Mkdir_command() to allow mkdir operations to be queued, sorted, lost, found and executed as well. Approved by: re (jhb, rwatson) --- usr.sbin/sade/install.c | 9 +++++--- usr.sbin/sade/misc.c | 45 ++++++++++++++++++++++++++++++++++++++++ usr.sbin/sade/sade.h | 2 ++ usr.sbin/sysinstall/install.c | 9 +++++--- usr.sbin/sysinstall/misc.c | 45 ++++++++++++++++++++++++++++++++++++++++ usr.sbin/sysinstall/sysinstall.h | 2 ++ 6 files changed, 106 insertions(+), 6 deletions(-) (limited to 'usr.sbin') diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 1b25046b462d..b9fe9b2fcbba 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -891,6 +891,9 @@ installFilesystems(dialogMenuItem *self) PartInfo *root; char dname[80]; Boolean upgrade = FALSE; +#if defined(__ia64__) + char efi_bootdir[FILENAME_MAX]; +#endif /* If we've already done this, bail out */ if (!variable_cmp(DISK_LABELLED, "written")) @@ -1055,14 +1058,13 @@ installFilesystems(dialogMenuItem *self) #if defined(__ia64__) else if (c1->type == efi && c1->private_data) { char bootdir[FILENAME_MAX]; - char efi_bootdir[FILENAME_MAX]; PartInfo *pi = (PartInfo *)c1->private_data; char *p; 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); + command_func_add(pi->mountpoint, Mount_msdosfs, c1->name); /* * Create a directory boot on the EFI filesystem and create a @@ -1074,7 +1076,8 @@ installFilesystems(dialogMenuItem *self) sprintf(efi_bootdir, "%s/%s", bootdir, pi->mountpoint); strcat(bootdir, "/boot"); strcat(efi_bootdir, "/boot"); - Mkdir(efi_bootdir); + command_func_add(pi->mountpoint, Mkdir_command, efi_bootdir); + /* Make a relative link. */ p = &efi_bootdir[(RunningAsInit) ? 4 : 0]; while (*p == '/') diff --git a/usr.sbin/sade/misc.c b/usr.sbin/sade/misc.c index 0965828ccbe3..e485234f8865 100644 --- a/usr.sbin/sade/misc.c +++ b/usr.sbin/sade/misc.c @@ -45,6 +45,7 @@ #include #include #include +#include /* Quick check to see if a file is readable */ Boolean @@ -309,6 +310,12 @@ Mkdir(char *ipath) return DITEM_SUCCESS; } +int +Mkdir_command(char *key, void *dir) +{ + return (Mkdir((char*)dir)); +} + int Mount(char *mountp, void *dev) { @@ -345,6 +352,44 @@ Mount(char *mountp, void *dev) return DITEM_SUCCESS; } +int +Mount_msdosfs(char *mountp, void *dev) +{ + struct msdosfs_args mount_args; + char device[80]; + char mountpoint[FILENAME_MAX]; + + if (Fake) + return DITEM_SUCCESS; + + if (*((char *)dev) != '/') { + sprintf(device, "%s/dev/%s", RunningAsInit ? "/mnt" : "", (char *)dev); + sprintf(mountpoint, "%s%s", RunningAsInit ? "/mnt" : "", mountp); + } + else { + strcpy(device, dev); + strcpy(mountpoint, mountp); + } + + if (Mkdir(mountpoint)) { + msgConfirm("Unable to make directory mountpoint for %s!", mountpoint); + return DITEM_FAILURE; + } + if (isDebug()) + msgDebug("mount %s %s\n", device, mountpoint); + + memset(&mount_args, 0, sizeof(mount_args)); + mount_args.fspec = device; + mount_args.magic = MSDOSFS_ARGSMAGIC; + mount_args.mask = S_IRWXU | S_IRWXG | S_IRWXO; + if (mount("msdosfs", mountpoint, RunningAsInit ? MNT_ASYNC|MNT_NOATIME : 0, + (caddr_t)&mount_args) == -1) { + msgConfirm("Error mounting %s on %s : %s", device, mountpoint, strerror(errno)); + return DITEM_FAILURE; + } + return DITEM_SUCCESS; +} + WINDOW * openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height) { diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 99d80fc2d5e1..81fdd35981aa 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -717,7 +717,9 @@ extern dialogMenuItem *item_add(dialogMenuItem *list, char *prompt, char *title, void *data, int *aux, int *curr, int *max); extern void items_free(dialogMenuItem *list, int *curr, int *max); extern int Mkdir(char *); +extern int Mkdir_command(char *key, void *data); extern int Mount(char *, void *data); +extern int Mount_msdosfs(char *mountp, void *devname); extern WINDOW *openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height); extern ComposeObj *initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max); extern int layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj, diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c index 1b25046b462d..b9fe9b2fcbba 100644 --- a/usr.sbin/sysinstall/install.c +++ b/usr.sbin/sysinstall/install.c @@ -891,6 +891,9 @@ installFilesystems(dialogMenuItem *self) PartInfo *root; char dname[80]; Boolean upgrade = FALSE; +#if defined(__ia64__) + char efi_bootdir[FILENAME_MAX]; +#endif /* If we've already done this, bail out */ if (!variable_cmp(DISK_LABELLED, "written")) @@ -1055,14 +1058,13 @@ installFilesystems(dialogMenuItem *self) #if defined(__ia64__) else if (c1->type == efi && c1->private_data) { char bootdir[FILENAME_MAX]; - char efi_bootdir[FILENAME_MAX]; PartInfo *pi = (PartInfo *)c1->private_data; char *p; 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); + command_func_add(pi->mountpoint, Mount_msdosfs, c1->name); /* * Create a directory boot on the EFI filesystem and create a @@ -1074,7 +1076,8 @@ installFilesystems(dialogMenuItem *self) sprintf(efi_bootdir, "%s/%s", bootdir, pi->mountpoint); strcat(bootdir, "/boot"); strcat(efi_bootdir, "/boot"); - Mkdir(efi_bootdir); + command_func_add(pi->mountpoint, Mkdir_command, efi_bootdir); + /* Make a relative link. */ p = &efi_bootdir[(RunningAsInit) ? 4 : 0]; while (*p == '/') diff --git a/usr.sbin/sysinstall/misc.c b/usr.sbin/sysinstall/misc.c index 0965828ccbe3..e485234f8865 100644 --- a/usr.sbin/sysinstall/misc.c +++ b/usr.sbin/sysinstall/misc.c @@ -45,6 +45,7 @@ #include #include #include +#include /* Quick check to see if a file is readable */ Boolean @@ -309,6 +310,12 @@ Mkdir(char *ipath) return DITEM_SUCCESS; } +int +Mkdir_command(char *key, void *dir) +{ + return (Mkdir((char*)dir)); +} + int Mount(char *mountp, void *dev) { @@ -345,6 +352,44 @@ Mount(char *mountp, void *dev) return DITEM_SUCCESS; } +int +Mount_msdosfs(char *mountp, void *dev) +{ + struct msdosfs_args mount_args; + char device[80]; + char mountpoint[FILENAME_MAX]; + + if (Fake) + return DITEM_SUCCESS; + + if (*((char *)dev) != '/') { + sprintf(device, "%s/dev/%s", RunningAsInit ? "/mnt" : "", (char *)dev); + sprintf(mountpoint, "%s%s", RunningAsInit ? "/mnt" : "", mountp); + } + else { + strcpy(device, dev); + strcpy(mountpoint, mountp); + } + + if (Mkdir(mountpoint)) { + msgConfirm("Unable to make directory mountpoint for %s!", mountpoint); + return DITEM_FAILURE; + } + if (isDebug()) + msgDebug("mount %s %s\n", device, mountpoint); + + memset(&mount_args, 0, sizeof(mount_args)); + mount_args.fspec = device; + mount_args.magic = MSDOSFS_ARGSMAGIC; + mount_args.mask = S_IRWXU | S_IRWXG | S_IRWXO; + if (mount("msdosfs", mountpoint, RunningAsInit ? MNT_ASYNC|MNT_NOATIME : 0, + (caddr_t)&mount_args) == -1) { + msgConfirm("Error mounting %s on %s : %s", device, mountpoint, strerror(errno)); + return DITEM_FAILURE; + } + return DITEM_SUCCESS; +} + WINDOW * openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height) { diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 99d80fc2d5e1..81fdd35981aa 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -717,7 +717,9 @@ extern dialogMenuItem *item_add(dialogMenuItem *list, char *prompt, char *title, void *data, int *aux, int *curr, int *max); extern void items_free(dialogMenuItem *list, int *curr, int *max); extern int Mkdir(char *); +extern int Mkdir_command(char *key, void *data); extern int Mount(char *, void *data); +extern int Mount_msdosfs(char *mountp, void *devname); extern WINDOW *openLayoutDialog(char *helpfile, char *title, int x, int y, int width, int height); extern ComposeObj *initLayoutDialog(WINDOW *win, Layout *layout, int x, int y, int *max); extern int layoutDialogLoop(WINDOW *win, Layout *layout, ComposeObj **obj, -- cgit v1.2.3