summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1998-10-12 23:45:07 +0000
committerjkh <jkh@FreeBSD.org>1998-10-12 23:45:07 +0000
commit9f3e704a535d4e3a76f3791a97954f7283058cb3 (patch)
treed80c5bbec249a8b92ed361936fb0c000f431ef99
parentcfc27182a25a97cf9d1bc7a7d08e73c52dd3f347 (diff)
downloadFreeBSD-src-9f3e704a535d4e3a76f3791a97954f7283058cb3.zip
FreeBSD-src-9f3e704a535d4e3a76f3791a97954f7283058cb3.tar.gz
Make floppy media code more generic so that fixit floppy can use it.
-rw-r--r--release/sysinstall/floppy.c11
-rw-r--r--release/sysinstall/install.c22
-rw-r--r--release/sysinstall/media.c4
-rw-r--r--usr.sbin/sade/install.c22
-rw-r--r--usr.sbin/sysinstall/floppy.c11
-rw-r--r--usr.sbin/sysinstall/install.c22
-rw-r--r--usr.sbin/sysinstall/media.c4
7 files changed, 45 insertions, 51 deletions
diff --git a/release/sysinstall/floppy.c b/release/sysinstall/floppy.c
index ec87289..87974dd 100644
--- a/release/sysinstall/floppy.c
+++ b/release/sysinstall/floppy.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: floppy.c,v 1.28 1998/02/10 18:31:22 jkh Exp $
+ * $Id: floppy.c,v 1.29 1998/07/18 09:42:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -62,11 +62,12 @@ mediaInitFloppy(Device *dev)
{
struct msdosfs_args dosargs;
struct ufs_args u_args;
- char *mountpoint = "/dist";
+ char *mountpoint;
if (floppyMounted)
return TRUE;
+ mountpoint = (char *)dev->private;
if (Mkdir(mountpoint)) {
msgConfirm("Unable to make %s directory mountpoint for %s!", mountpoint, dev->devname);
return FALSE;
@@ -110,10 +111,10 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe)
FILE *fp;
int nretries = 5;
- snprintf(buf, PATH_MAX, "/dist/%s", file);
+ snprintf(buf, PATH_MAX, "%s/%s", (char *)dev->private, file);
if (isDebug())
- msgDebug("Request for %s from floppy on /dist, probe is %d.\n", buf, probe);
+ msgDebug("Request for %s from floppy on %s, probe is %d.\n", buf, (char *)dev->private, probe);
if (!file_readable(buf)) {
if (probe)
return NULL;
@@ -137,7 +138,7 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe)
void
mediaShutdownFloppy(Device *dev)
{
- char *mountpoint = "/dist";
+ char *mountpoint = (char *)dev->private;
if (floppyMounted) {
if (unmount(mountpoint, MNT_FORCE) != 0)
diff --git a/release/sysinstall/install.c b/release/sysinstall/install.c
index 60c599a..8d47c5e 100644
--- a/release/sysinstall/install.c
+++ b/release/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.212 1998/09/29 14:23:13 jkh Exp $
+ * $Id: install.c,v 1.213 1998/09/30 20:33:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -353,22 +353,18 @@ installFixitFloppy(dialogMenuItem *self)
while (1) {
msgConfirm("Please insert a writable fixit floppy and press return");
- if (mount("ufs", "/mnt2", 0, (caddr_t)&args) != -1)
- break;
- msgConfirm("An attempt to mount the fixit floppy failed, maybe the filesystem\n"
- "is unclean. Trying a forcible mount as a last resort...");
- if (mount("ufs", "/mnt2", MNT_FORCE, (caddr_t)&args) != -1)
- break;
- if (msgYesNo("Unable to mount the fixit floppy - do you want to try again?") != 0)
- return DITEM_FAILURE;
+ mediaDevice->private = "/mnt2";
+ if (!mediaDevice->init(&mediaDevice)) {
+ if (msgYesNo("The attempt to mount the fixit floppy failed, bad floppy\n"
+ "or unclean filesystem. Do you want to try again?")
+ return DITEM_FAILURE;
+ }
}
-
if (!directory_exists("/tmp"))
(void)symlink("/mnt2/tmp", "/tmp");
-
fixit_common();
-
- unmount("/mnt2", MNT_FORCE);
+ mediaDevice->shutdown(&mediaDevice);
+ mediaDevice = NULL;
msgConfirm("Please remove the fixit floppy now.");
return DITEM_SUCCESS;
}
diff --git a/release/sysinstall/media.c b/release/sysinstall/media.c
index c20b385..c5ae93e 100644
--- a/release/sysinstall/media.c
+++ b/release/sysinstall/media.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: media.c,v 1.87 1997/08/11 13:08:28 jkh Exp $
+ * $Id: media.c,v 1.88 1998/10/10 09:43:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -204,6 +204,8 @@ mediaSetFloppy(dialogMenuItem *self)
}
else
mediaDevice = devs[0];
+ if (mediaDevice)
+ mediaDevice->private = "/dist";
return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE;
}
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c
index 60c599a..8d47c5e 100644
--- a/usr.sbin/sade/install.c
+++ b/usr.sbin/sade/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.212 1998/09/29 14:23:13 jkh Exp $
+ * $Id: install.c,v 1.213 1998/09/30 20:33:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -353,22 +353,18 @@ installFixitFloppy(dialogMenuItem *self)
while (1) {
msgConfirm("Please insert a writable fixit floppy and press return");
- if (mount("ufs", "/mnt2", 0, (caddr_t)&args) != -1)
- break;
- msgConfirm("An attempt to mount the fixit floppy failed, maybe the filesystem\n"
- "is unclean. Trying a forcible mount as a last resort...");
- if (mount("ufs", "/mnt2", MNT_FORCE, (caddr_t)&args) != -1)
- break;
- if (msgYesNo("Unable to mount the fixit floppy - do you want to try again?") != 0)
- return DITEM_FAILURE;
+ mediaDevice->private = "/mnt2";
+ if (!mediaDevice->init(&mediaDevice)) {
+ if (msgYesNo("The attempt to mount the fixit floppy failed, bad floppy\n"
+ "or unclean filesystem. Do you want to try again?")
+ return DITEM_FAILURE;
+ }
}
-
if (!directory_exists("/tmp"))
(void)symlink("/mnt2/tmp", "/tmp");
-
fixit_common();
-
- unmount("/mnt2", MNT_FORCE);
+ mediaDevice->shutdown(&mediaDevice);
+ mediaDevice = NULL;
msgConfirm("Please remove the fixit floppy now.");
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sysinstall/floppy.c b/usr.sbin/sysinstall/floppy.c
index ec87289..87974dd 100644
--- a/usr.sbin/sysinstall/floppy.c
+++ b/usr.sbin/sysinstall/floppy.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: floppy.c,v 1.28 1998/02/10 18:31:22 jkh Exp $
+ * $Id: floppy.c,v 1.29 1998/07/18 09:42:00 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -62,11 +62,12 @@ mediaInitFloppy(Device *dev)
{
struct msdosfs_args dosargs;
struct ufs_args u_args;
- char *mountpoint = "/dist";
+ char *mountpoint;
if (floppyMounted)
return TRUE;
+ mountpoint = (char *)dev->private;
if (Mkdir(mountpoint)) {
msgConfirm("Unable to make %s directory mountpoint for %s!", mountpoint, dev->devname);
return FALSE;
@@ -110,10 +111,10 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe)
FILE *fp;
int nretries = 5;
- snprintf(buf, PATH_MAX, "/dist/%s", file);
+ snprintf(buf, PATH_MAX, "%s/%s", (char *)dev->private, file);
if (isDebug())
- msgDebug("Request for %s from floppy on /dist, probe is %d.\n", buf, probe);
+ msgDebug("Request for %s from floppy on %s, probe is %d.\n", buf, (char *)dev->private, probe);
if (!file_readable(buf)) {
if (probe)
return NULL;
@@ -137,7 +138,7 @@ mediaGetFloppy(Device *dev, char *file, Boolean probe)
void
mediaShutdownFloppy(Device *dev)
{
- char *mountpoint = "/dist";
+ char *mountpoint = (char *)dev->private;
if (floppyMounted) {
if (unmount(mountpoint, MNT_FORCE) != 0)
diff --git a/usr.sbin/sysinstall/install.c b/usr.sbin/sysinstall/install.c
index 60c599a..8d47c5e 100644
--- a/usr.sbin/sysinstall/install.c
+++ b/usr.sbin/sysinstall/install.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: install.c,v 1.212 1998/09/29 14:23:13 jkh Exp $
+ * $Id: install.c,v 1.213 1998/09/30 20:33:56 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -353,22 +353,18 @@ installFixitFloppy(dialogMenuItem *self)
while (1) {
msgConfirm("Please insert a writable fixit floppy and press return");
- if (mount("ufs", "/mnt2", 0, (caddr_t)&args) != -1)
- break;
- msgConfirm("An attempt to mount the fixit floppy failed, maybe the filesystem\n"
- "is unclean. Trying a forcible mount as a last resort...");
- if (mount("ufs", "/mnt2", MNT_FORCE, (caddr_t)&args) != -1)
- break;
- if (msgYesNo("Unable to mount the fixit floppy - do you want to try again?") != 0)
- return DITEM_FAILURE;
+ mediaDevice->private = "/mnt2";
+ if (!mediaDevice->init(&mediaDevice)) {
+ if (msgYesNo("The attempt to mount the fixit floppy failed, bad floppy\n"
+ "or unclean filesystem. Do you want to try again?")
+ return DITEM_FAILURE;
+ }
}
-
if (!directory_exists("/tmp"))
(void)symlink("/mnt2/tmp", "/tmp");
-
fixit_common();
-
- unmount("/mnt2", MNT_FORCE);
+ mediaDevice->shutdown(&mediaDevice);
+ mediaDevice = NULL;
msgConfirm("Please remove the fixit floppy now.");
return DITEM_SUCCESS;
}
diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c
index c20b385..c5ae93e 100644
--- a/usr.sbin/sysinstall/media.c
+++ b/usr.sbin/sysinstall/media.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: media.c,v 1.87 1997/08/11 13:08:28 jkh Exp $
+ * $Id: media.c,v 1.88 1998/10/10 09:43:44 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -204,6 +204,8 @@ mediaSetFloppy(dialogMenuItem *self)
}
else
mediaDevice = devs[0];
+ if (mediaDevice)
+ mediaDevice->private = "/dist";
return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE;
}
OpenPOWER on IntegriCloud