diff options
author | jkh <jkh@FreeBSD.org> | 1998-09-08 11:44:08 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1998-09-08 11:44:08 +0000 |
commit | 15f8e2550cf3707d5e5f0474e836f43d252350d8 (patch) | |
tree | 284b44b8bcf0ca2a23b3dff5b7e534a04795c380 /usr.sbin/sysinstall/dos.c | |
parent | d9b7f7adb82239a4b336d7af7b5b6a9620a0722e (diff) | |
download | FreeBSD-src-15f8e2550cf3707d5e5f0474e836f43d252350d8.zip FreeBSD-src-15f8e2550cf3707d5e5f0474e836f43d252350d8.tar.gz |
Go back to using MSDOSFS instead of Robert Nordier's stand-alone DOS
library. I have to include MSDOSFS on the boot floppy anyway (so I can
read DOS floppies in a few other contexts) and since both -stable and
-current MSDOSFS handle long filenames, I'm OK on that now. Should
save about 10K of space.
Diffstat (limited to 'usr.sbin/sysinstall/dos.c')
-rw-r--r-- | usr.sbin/sysinstall/dos.c | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/usr.sbin/sysinstall/dos.c b/usr.sbin/sysinstall/dos.c index ccdb204..4aec962 100644 --- a/usr.sbin/sysinstall/dos.c +++ b/usr.sbin/sysinstall/dos.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated to essentially a complete rewrite. * - * $Id$ + * $Id: dos.c,v 1.18 1997/02/22 14:11:39 peter Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -44,52 +44,57 @@ #include <unistd.h> #include <fcntl.h> #include <grp.h> -#include "dosio.h" +#define MSDOSFS +#include <sys/mount.h> +#include <msdosfs/msdosfsmount.h> +#undef MSDOSFS -static DOS_FS DOSFS; static Boolean DOSMounted; Boolean mediaInitDOS(Device *dev) { + struct msdosfs_args args; + if (!RunningAsInit || DOSMounted) return TRUE; + + if (DITEM_STATUS(Mkdir("/dist")) != DITEM_SUCCESS) + return FALSE; + + memset(&args, 0, sizeof(args)); + args.fspec = dev->devname; + args.uid = args.gid = 0; + args.mask = 0777; - if (dos_mount(&DOSFS, dev->devname)) { - msgConfirm("Error mounting DOS partition %s : %s (%u)", dev->devname, strerror(errno), errno); + if (mount("dos", "/dist", MNT_RDONLY, (caddr_t)&args) == -1) { + msgConfirm("Error mounting %s on /dist: %s (%u)", args.fspec, strerror(errno), errno); return FALSE; } + else + msgDebug("Mounted DOS device (%s) on /dist.\n", args.fspec); DOSMounted = TRUE; - msgDebug("DOS partition %s mounted\n", dev->devname); return TRUE; } FILE * mediaGetDOS(Device *dev, char *file, Boolean probe) { - char buf[PATH_MAX]; - FILE *fp; - - if (!DOSMounted) { - msgDebug("Can't get DOS file %s - DOSFS currently unmounted!\n", file); - return NULL; - } + char buf[PATH_MAX]; if (isDebug()) msgDebug("Request for %s from DOS\n", file); - snprintf(buf, PATH_MAX, "/freebsd/%s", file); - if ((fp = dos_open(&DOSFS, buf))) - return fp; - snprintf(buf, PATH_MAX, "/freebsd/dists/%s", file); - if ((fp = dos_open(&DOSFS, buf))) - return fp; - snprintf(buf, PATH_MAX, "/%s", file); - if ((fp = dos_open(&DOSFS, buf))) - return fp; - snprintf(buf, PATH_MAX, "/dists/%s", file); - if ((fp = dos_open(&DOSFS, buf))) - return fp; - return NULL; + snprintf(buf, PATH_MAX, "/dist/%s", file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "/dist/dists/%s", file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "/dist/%s/%s", variable_get(VAR_RELNAME), file); + if (file_readable(buf)) + return fopen(buf, "r"); + snprintf(buf, PATH_MAX, "/dist/%s/dists/%s", variable_get(VAR_RELNAME), file); + return fopen(buf, "r"); } void @@ -97,10 +102,11 @@ mediaShutdownDOS(Device *dev) { if (!RunningAsInit || !DOSMounted) return; - if (dos_unmount(&DOSFS)) - msgConfirm("Could not unmount DOS partition %s : %s", dev->devname, strerror(errno)); - else if (isDebug()) - msgDebug("Unmount of DOS partition on %s successful\n", dev->devname); + msgDebug("Unmounting %s from /dist\n", dev->name); + if (unmount("/dist", MNT_FORCE) != 0) + msgConfirm("Could not unmount the DOS partition: %s", strerror(errno)); + if (isDebug()) + msgDebug("Unmount successful\n"); DOSMounted = FALSE; return; } |