diff options
author | jkh <jkh@FreeBSD.org> | 1999-04-06 08:25:53 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1999-04-06 08:25:53 +0000 |
commit | de886587fee38a2b6d267e4b9f1452643ee84206 (patch) | |
tree | fa63f7228f8d696e01328e315e334d08ecb7726d | |
parent | 94c3a8d12f3962371ab018cc5870594c6426240a (diff) | |
download | FreeBSD-src-de886587fee38a2b6d267e4b9f1452643ee84206.zip FreeBSD-src-de886587fee38a2b6d267e4b9f1452643ee84206.tar.gz |
Add an option for resetting and rescanning the probed device list, perhaps
to now detect that CD you just remembered to put in the drive or that
pccard NIC that you've inserted (anybody can put pccardd in an mfsroot image
now you know.. :)
Requested by: Annelise Anderson <andrsn@andrsn.Stanford.EDU>
-rw-r--r-- | release/sysinstall/devices.c | 29 | ||||
-rw-r--r-- | release/sysinstall/index.c | 8 | ||||
-rw-r--r-- | release/sysinstall/options.c | 4 | ||||
-rw-r--r-- | release/sysinstall/sysinstall.h | 4 | ||||
-rw-r--r-- | usr.sbin/sade/devices.c | 29 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/devices.c | 29 | ||||
-rw-r--r-- | usr.sbin/sysinstall/index.c | 8 | ||||
-rw-r--r-- | usr.sbin/sysinstall/options.c | 4 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 4 |
10 files changed, 109 insertions, 14 deletions
diff --git a/release/sysinstall/devices.c b/release/sysinstall/devices.c index 7b7261d..0269d4e 100644 --- a/release/sysinstall/devices.c +++ b/release/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.87 1998/12/04 18:01:10 wpaul Exp $ + * $Id: devices.c,v 1.88 1999/01/09 18:12:06 wpaul Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -202,6 +202,25 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e return newdev; } +/* Reset the registered device chain */ +void +deviceReset(void) +{ + int i; + + for (i = 0; i < numDevs; i++) { + Devices[i]->shutdown(Devices[i]); + + /* XXX this potentially leaks Devices[i]->private if it's being + * used to point to something dynamic, but you're not supposed + * to call this routine at such times that some open instance + * has its private ptr pointing somewhere anyway. XXX + */ + free(Devices[i]); + } + Devices[numDevs = 0] = NULL; +} + /* Get all device information for devices we have attached */ void deviceGetAll(void) @@ -417,6 +436,14 @@ skipif: } } +/* Rescan all devices, after closing previous set - convenience function */ +void +deviceRescan(void) +{ + deviceReset(); + deviceGetAll(); +} + /* * Find all devices that match the criteria, allowing "wildcarding" as well * by allowing NULL or ANY values to match all. The array returned is static diff --git a/release/sysinstall/index.c b/release/sysinstall/index.c index 52838d9..c02d4ad 100644 --- a/release/sysinstall/index.c +++ b/release/sysinstall/index.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: index.c,v 1.62 1999/02/02 16:57:55 jkh Exp $ + * $Id: index.c,v 1.63 1999/02/15 04:57:07 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -475,13 +475,15 @@ pkg_fire(dialogMenuItem *self) else if (ie->depc == 0) { WINDOW *save = savescr(); - if (!msgYesNo("Do you really want to delete %s from the system?", kp->name)) - if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name)) + if (!msgYesNo("Do you really want to delete %s from the system?", kp->name)) { + if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name)) { msgConfirm("Warning: pkg_delete of %s failed.\n Check debug output for details.", kp->name); + } else { ie->installed = 0; index_recorddeps(FALSE, lists->root, ie); } + } restorescr(save); } else diff --git a/release/sysinstall/options.c b/release/sysinstall/options.c index 6d5fb3c..5365d77 100644 --- a/release/sysinstall/options.c +++ b/release/sysinstall/options.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id: options.c,v 1.56 1997/07/16 05:22:42 jkh Exp $ + * $Id: options.c,v 1.57 1999/02/05 22:15:51 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -141,6 +141,8 @@ static Option Options[] = { OPT_IS_VAR, GATED_PKG_PROMPT, VAR_GATED_PKG, varCheck }, { "PCNFSD package", "The name of the PCNFSD package to install if requested", OPT_IS_VAR, PCNFSD_PKG_PROMPT, VAR_PCNFSD_PKG, varCheck }, +{ "Re-scan Devices", "Re-run sysinstall's initial device probe", + OPT_IS_FUNC, deviceRescan }, { "Use Defaults", "Reset all values to startup defaults", OPT_IS_FUNC, installVarDefaults, 0, resetLogo }, { NULL }, diff --git a/release/sysinstall/sysinstall.h b/release/sysinstall/sysinstall.h index 42537d0..8f171d1 100644 --- a/release/sysinstall/sysinstall.h +++ b/release/sysinstall/sysinstall.h @@ -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: sysinstall.h,v 1.158 1999/02/09 22:18:10 jkh Exp $ + * $Id: sysinstall.h,v 1.159 1999/03/19 10:54:38 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -429,6 +429,8 @@ extern int crc(int, unsigned long *, unsigned long *); extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), int (*check)(dialogMenuItem *d)); extern void deviceGetAll(void); +extern void deviceReset(void); +extern void deviceRescan(void); extern Device **deviceFind(char *name, DeviceType type); extern Device **deviceFindDescr(char *name, char *desc, DeviceType class); extern int deviceCount(Device **devs); diff --git a/usr.sbin/sade/devices.c b/usr.sbin/sade/devices.c index 7b7261d..0269d4e 100644 --- a/usr.sbin/sade/devices.c +++ b/usr.sbin/sade/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.87 1998/12/04 18:01:10 wpaul Exp $ + * $Id: devices.c,v 1.88 1999/01/09 18:12:06 wpaul Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -202,6 +202,25 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e return newdev; } +/* Reset the registered device chain */ +void +deviceReset(void) +{ + int i; + + for (i = 0; i < numDevs; i++) { + Devices[i]->shutdown(Devices[i]); + + /* XXX this potentially leaks Devices[i]->private if it's being + * used to point to something dynamic, but you're not supposed + * to call this routine at such times that some open instance + * has its private ptr pointing somewhere anyway. XXX + */ + free(Devices[i]); + } + Devices[numDevs = 0] = NULL; +} + /* Get all device information for devices we have attached */ void deviceGetAll(void) @@ -417,6 +436,14 @@ skipif: } } +/* Rescan all devices, after closing previous set - convenience function */ +void +deviceRescan(void) +{ + deviceReset(); + deviceGetAll(); +} + /* * Find all devices that match the criteria, allowing "wildcarding" as well * by allowing NULL or ANY values to match all. The array returned is static diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index 42537d0..8f171d1 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -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: sysinstall.h,v 1.158 1999/02/09 22:18:10 jkh Exp $ + * $Id: sysinstall.h,v 1.159 1999/03/19 10:54:38 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -429,6 +429,8 @@ extern int crc(int, unsigned long *, unsigned long *); extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), int (*check)(dialogMenuItem *d)); extern void deviceGetAll(void); +extern void deviceReset(void); +extern void deviceRescan(void); extern Device **deviceFind(char *name, DeviceType type); extern Device **deviceFindDescr(char *name, char *desc, DeviceType class); extern int deviceCount(Device **devs); diff --git a/usr.sbin/sysinstall/devices.c b/usr.sbin/sysinstall/devices.c index 7b7261d..0269d4e 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.87 1998/12/04 18:01:10 wpaul Exp $ + * $Id: devices.c,v 1.88 1999/01/09 18:12:06 wpaul Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -202,6 +202,25 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e return newdev; } +/* Reset the registered device chain */ +void +deviceReset(void) +{ + int i; + + for (i = 0; i < numDevs; i++) { + Devices[i]->shutdown(Devices[i]); + + /* XXX this potentially leaks Devices[i]->private if it's being + * used to point to something dynamic, but you're not supposed + * to call this routine at such times that some open instance + * has its private ptr pointing somewhere anyway. XXX + */ + free(Devices[i]); + } + Devices[numDevs = 0] = NULL; +} + /* Get all device information for devices we have attached */ void deviceGetAll(void) @@ -417,6 +436,14 @@ skipif: } } +/* Rescan all devices, after closing previous set - convenience function */ +void +deviceRescan(void) +{ + deviceReset(); + deviceGetAll(); +} + /* * Find all devices that match the criteria, allowing "wildcarding" as well * by allowing NULL or ANY values to match all. The array returned is static diff --git a/usr.sbin/sysinstall/index.c b/usr.sbin/sysinstall/index.c index 52838d9..c02d4ad 100644 --- a/usr.sbin/sysinstall/index.c +++ b/usr.sbin/sysinstall/index.c @@ -4,7 +4,7 @@ * This is probably the last program in the `sysinstall' line - the next * generation being essentially a complete rewrite. * - * $Id: index.c,v 1.62 1999/02/02 16:57:55 jkh Exp $ + * $Id: index.c,v 1.63 1999/02/15 04:57:07 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -475,13 +475,15 @@ pkg_fire(dialogMenuItem *self) else if (ie->depc == 0) { WINDOW *save = savescr(); - if (!msgYesNo("Do you really want to delete %s from the system?", kp->name)) - if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name)) + if (!msgYesNo("Do you really want to delete %s from the system?", kp->name)) { + if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name)) { msgConfirm("Warning: pkg_delete of %s failed.\n Check debug output for details.", kp->name); + } else { ie->installed = 0; index_recorddeps(FALSE, lists->root, ie); } + } restorescr(save); } else diff --git a/usr.sbin/sysinstall/options.c b/usr.sbin/sysinstall/options.c index 6d5fb3c..5365d77 100644 --- a/usr.sbin/sysinstall/options.c +++ b/usr.sbin/sysinstall/options.c @@ -4,7 +4,7 @@ * This is probably the last attempt in the `sysinstall' line, the next * generation being slated for what's essentially a complete rewrite. * - * $Id: options.c,v 1.56 1997/07/16 05:22:42 jkh Exp $ + * $Id: options.c,v 1.57 1999/02/05 22:15:51 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -141,6 +141,8 @@ static Option Options[] = { OPT_IS_VAR, GATED_PKG_PROMPT, VAR_GATED_PKG, varCheck }, { "PCNFSD package", "The name of the PCNFSD package to install if requested", OPT_IS_VAR, PCNFSD_PKG_PROMPT, VAR_PCNFSD_PKG, varCheck }, +{ "Re-scan Devices", "Re-run sysinstall's initial device probe", + OPT_IS_FUNC, deviceRescan }, { "Use Defaults", "Reset all values to startup defaults", OPT_IS_FUNC, installVarDefaults, 0, resetLogo }, { NULL }, diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index 42537d0..8f171d1 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -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: sysinstall.h,v 1.158 1999/02/09 22:18:10 jkh Exp $ + * $Id: sysinstall.h,v 1.159 1999/03/19 10:54:38 jkh Exp $ * * Copyright (c) 1995 * Jordan Hubbard. All rights reserved. @@ -429,6 +429,8 @@ extern int crc(int, unsigned long *, unsigned long *); extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d), int (*check)(dialogMenuItem *d)); extern void deviceGetAll(void); +extern void deviceReset(void); +extern void deviceRescan(void); extern Device **deviceFind(char *name, DeviceType type); extern Device **deviceFindDescr(char *name, char *desc, DeviceType class); extern int deviceCount(Device **devs); |