Fix EBUSY checking in devices.c - DTRT when it's detected on a CD.

This commit is contained in:
Jordan K. Hubbard 1996-07-13 05:09:29 +00:00
parent 3bc99bbcc2
commit f6d3326b0c
5 changed files with 18 additions and 19 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: cdrom.c,v 1.17 1996/07/08 08:54:22 jkh Exp $
* $Id: cdrom.c,v 1.18 1996/07/12 11:13:54 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -76,9 +76,6 @@ mediaInitCDROM(Device *dev)
if (cdromMounted != CD_UNMOUNTED)
return TRUE;
if (Mkdir("/cdrom"))
return FALSE;
bzero(&args, sizeof(args));
args.fspec = dev->devname;
args.flags = 0;
@ -88,6 +85,7 @@ mediaInitCDROM(Device *dev)
dontRead = FALSE;
/* If this cdrom's not already mounted or can't be mounted, yell */
if (!file_readable("/cdrom/cdrom.inf")) {
Mkdir("/cdrom");
if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
return FALSE;
@ -119,7 +117,7 @@ mediaInitCDROM(Device *dev)
"does not match the version of this boot floppy (%s).\n"
"If this is intentional, then please visit the Options editor\n"
"to set the boot floppy version string to match that of the CD\n"
"before selecting it as an installation media.");
"before selecting it as an installation media.", cp, variable_get(VAR_RELNAME));
cdromMounted = CD_UNMOUNTED;
return FALSE;
}

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: devices.c,v 1.46 1996/06/12 17:09:31 jkh Exp $
* $Id: devices.c,v 1.47 1996/06/13 17:07:37 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -141,8 +141,8 @@ deviceTry(char *name, char *try)
fd = open(try, O_RDWR);
if (fd > 0)
return fd;
else if (errno == EACCES)
return 0;
if (errno == EBUSY)
return -1;
snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name);
fd = open(try, O_RDWR);
return fd;
@ -229,6 +229,7 @@ deviceGetAll(void)
switch(device_names[i].type) {
case DEVICE_TYPE_CDROM:
fd = deviceTry(device_names[i].name, try);
msgDebug("Try for %s returns errno %d\n", device_names[i].name, errno);
if (fd >= 0 || errno == EBUSY) { /* EBUSY if already mounted */
if (fd >= 0) close(fd);
(void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try),

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: devices.c,v 1.46 1996/06/12 17:09:31 jkh Exp $
* $Id: devices.c,v 1.47 1996/06/13 17:07:37 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -141,8 +141,8 @@ deviceTry(char *name, char *try)
fd = open(try, O_RDWR);
if (fd > 0)
return fd;
else if (errno == EACCES)
return 0;
if (errno == EBUSY)
return -1;
snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name);
fd = open(try, O_RDWR);
return fd;
@ -229,6 +229,7 @@ deviceGetAll(void)
switch(device_names[i].type) {
case DEVICE_TYPE_CDROM:
fd = deviceTry(device_names[i].name, try);
msgDebug("Try for %s returns errno %d\n", device_names[i].name, errno);
if (fd >= 0 || errno == EBUSY) { /* EBUSY if already mounted */
if (fd >= 0) close(fd);
(void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try),

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: cdrom.c,v 1.17 1996/07/08 08:54:22 jkh Exp $
* $Id: cdrom.c,v 1.18 1996/07/12 11:13:54 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -76,9 +76,6 @@ mediaInitCDROM(Device *dev)
if (cdromMounted != CD_UNMOUNTED)
return TRUE;
if (Mkdir("/cdrom"))
return FALSE;
bzero(&args, sizeof(args));
args.fspec = dev->devname;
args.flags = 0;
@ -88,6 +85,7 @@ mediaInitCDROM(Device *dev)
dontRead = FALSE;
/* If this cdrom's not already mounted or can't be mounted, yell */
if (!file_readable("/cdrom/cdrom.inf")) {
Mkdir("/cdrom");
if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
return FALSE;
@ -119,7 +117,7 @@ mediaInitCDROM(Device *dev)
"does not match the version of this boot floppy (%s).\n"
"If this is intentional, then please visit the Options editor\n"
"to set the boot floppy version string to match that of the CD\n"
"before selecting it as an installation media.");
"before selecting it as an installation media.", cp, variable_get(VAR_RELNAME));
cdromMounted = CD_UNMOUNTED;
return FALSE;
}

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: devices.c,v 1.46 1996/06/12 17:09:31 jkh Exp $
* $Id: devices.c,v 1.47 1996/06/13 17:07:37 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@ -141,8 +141,8 @@ deviceTry(char *name, char *try)
fd = open(try, O_RDWR);
if (fd > 0)
return fd;
else if (errno == EACCES)
return 0;
if (errno == EBUSY)
return -1;
snprintf(try, FILENAME_MAX, "/mnt/dev/%s", name);
fd = open(try, O_RDWR);
return fd;
@ -229,6 +229,7 @@ deviceGetAll(void)
switch(device_names[i].type) {
case DEVICE_TYPE_CDROM:
fd = deviceTry(device_names[i].name, try);
msgDebug("Try for %s returns errno %d\n", device_names[i].name, errno);
if (fd >= 0 || errno == EBUSY) { /* EBUSY if already mounted */
if (fd >= 0) close(fd);
(void)deviceRegister(device_names[i].name, device_names[i].description, strdup(try),