summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/ufs.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/sysinstall/ufs.c')
-rw-r--r--usr.sbin/sysinstall/ufs.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/usr.sbin/sysinstall/ufs.c b/usr.sbin/sysinstall/ufs.c
index c9515ae..d8a6fcf 100644
--- a/usr.sbin/sysinstall/ufs.c
+++ b/usr.sbin/sysinstall/ufs.c
@@ -39,11 +39,47 @@
#include "sysinstall.h"
#include <sys/fcntl.h>
#include <sys/param.h>
+#include <sys/mount.h>
+#include <ufs/ufs/ufsmount.h>
-/* No init or shutdown routines necessary - all done in mediaSetUFS() */
+static Boolean UFSMounted;
+static char mountpoint[] = "/dist";
+
+Boolean
+mediaInitUFS(Device *dev)
+{
+ struct ufs_args args;
+
+ if (UFSMounted)
+ return TRUE;
+
+ Mkdir(mountpoint);
+ memset(&args, 0, sizeof(args));
+ args.fspec = dev->devname;
+
+ if (mount("ufs", mountpoint, MNT_RDONLY, (caddr_t)&args) == -1) {
+ msgConfirm("Error mounting %s on %s: %s (%u)", args.fspec, mountpoint, strerror(errno), errno);
+ return FALSE;
+ }
+ UFSMounted = TRUE;
+ return TRUE;
+}
FILE *
mediaGetUFS(Device *dev, char *file, Boolean probe)
{
return mediaGenericGet((char *)dev->private, file);
}
+
+void
+mediaShutdownUFS(Device *dev)
+{
+ if (!UFSMounted)
+ return;
+ if (unmount(mountpoint, MNT_FORCE) != 0)
+ msgConfirm("Could not unmount the UFS partition from %s: %s",
+ mountpoint, strerror(errno));
+ else
+ UFSMounted = FALSE;
+ return;
+}
OpenPOWER on IntegriCloud