diff options
author | jkh <jkh@FreeBSD.org> | 1995-05-08 21:39:40 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1995-05-08 21:39:40 +0000 |
commit | 1aa6f0255a93cada013e339b339895f4d6c1b066 (patch) | |
tree | bbc7db4913e184339a9fef242727b484f56afaa6 /usr.sbin/sysinstall/devices.c | |
parent | db10ed51dd5e2127eff1c14b27784304cce58d3e (diff) | |
download | FreeBSD-src-1aa6f0255a93cada013e339b339895f4d6c1b066.zip FreeBSD-src-1aa6f0255a93cada013e339b339895f4d6c1b066.tar.gz |
Sync these up so that they'll get into my CVS tree at home, where I'll continue
working on the distribution extract stuff.
Diffstat (limited to 'usr.sbin/sysinstall/devices.c')
-rw-r--r-- | usr.sbin/sysinstall/devices.c | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index a087fdf..6fa547a 100644 --- a/usr.sbin/sysinstall/devices.c +++ b/usr.sbin/sysinstall/devices.c @@ -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.10 1995/05/08 01:27:06 jkh Exp $ + * $Id: devices.c,v 1.11 1995/05/08 10:20:46 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -47,6 +47,14 @@ /* Where we start displaying chunk information on the screen */ #define CHUNK_START_ROW 5 +static char *cdrom_table[] = { + "cd0a", "cd1a", /* SCSI */ + "mcd0a", "mcd1a", /* Mitsumi (old model) */ + "scd0a", "scd1a", /* Sony CDROM */ + "matcd0a", "matcd1a", /* Matsushita (SB) */ + NULL, +}; + /* Get all device information for a given device class */ static Device * device_get_all(DeviceType which, int *ndevs) @@ -66,11 +74,27 @@ device_get_all(DeviceType which, int *ndevs) strcpy(devs[i].name, names[i]); devs[i].type = DEVICE_TYPE_DISK; } - devs[i].name[0] = '\0'; free(names); } } - /* put detection for other classes here just as soon as I figure out how */ + if (which == DEVICE_TYPE_CDROM || which == DEVICE_TYPE_ANY) { + char try[FILENAME_MAX]; + int i, fd; + + for (i = 0; cdrom_table[i]; i++) { + snprintf(try, FILENAME_MAX, "/mnt/dev/%s", cdrom_table[i]); + fd = open(try); + if (fd > 0) { + close(fd); + devs = safe_realloc(devs, sizeof(Device) * (*ndevs + 2)); + strcpy(devs[*ndevs].name, cdrom_table[i]); + devs[(*ndevs)++].type = DEVICE_TYPE_CDROM; + break; + } + } + } + /* Terminate the devices array */ + devs[*ndevs].name[0] = '\0'; return devs; } |