summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sade/devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/sade/devices.c')
-rw-r--r--usr.sbin/sade/devices.c29
1 files changed, 28 insertions, 1 deletions
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
OpenPOWER on IntegriCloud