Make floppy media code more generic so that fixit floppy can use it.

This commit is contained in:
Jordan K. Hubbard 1998-10-12 23:45:07 +00:00
parent d7500a66e0
commit d5aaa80c1c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40273
7 changed files with 45 additions and 51 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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;
}

View File

@ -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;
}