diff options
author | marcel <marcel@FreeBSD.org> | 2002-12-02 20:15:16 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2002-12-02 20:15:16 +0000 |
commit | 08185d6b24389fb9fd0169df1777d2260c978b01 (patch) | |
tree | e448534c83572001a19e32a84c82fd4857feaa95 /usr.sbin | |
parent | 7b3238944ad7e75d41b5abeec125b1565b406096 (diff) | |
download | FreeBSD-src-08185d6b24389fb9fd0169df1777d2260c978b01.zip FreeBSD-src-08185d6b24389fb9fd0169df1777d2260c978b01.tar.gz |
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)
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/sade/install.c | 9 | ||||
-rw-r--r-- | usr.sbin/sade/misc.c | 45 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 2 | ||||
-rw-r--r-- | usr.sbin/sysinstall/install.c | 9 | ||||
-rw-r--r-- | usr.sbin/sysinstall/misc.c | 45 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 2 |
6 files changed, 106 insertions, 6 deletions
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 1b25046..b9fe9b2 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 0965828..e485234 100644 --- a/usr.sbin/sade/misc.c +++ b/usr.sbin/sade/misc.c @@ -45,6 +45,7 @@ #include <ufs/ufs/ufsmount.h> #include <sys/reboot.h> #include <sys/disklabel.h> +#include <fs/msdosfs/msdosfsmount.h> /* Quick check to see if a file is readable */ Boolean @@ -310,6 +311,12 @@ Mkdir(char *ipath) } int +Mkdir_command(char *key, void *dir) +{ + return (Mkdir((char*)dir)); +} + +int Mount(char *mountp, void *dev) { struct ufs_args ufsargs; @@ -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 99d80fc..81fdd35 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 1b25046..b9fe9b2 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 0965828..e485234 100644 --- a/usr.sbin/sysinstall/misc.c +++ b/usr.sbin/sysinstall/misc.c @@ -45,6 +45,7 @@ #include <ufs/ufs/ufsmount.h> #include <sys/reboot.h> #include <sys/disklabel.h> +#include <fs/msdosfs/msdosfsmount.h> /* Quick check to see if a file is readable */ Boolean @@ -310,6 +311,12 @@ Mkdir(char *ipath) } int +Mkdir_command(char *key, void *dir) +{ + return (Mkdir((char*)dir)); +} + +int Mount(char *mountp, void *dev) { struct ufs_args ufsargs; @@ -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 99d80fc..81fdd35 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, |