summaryrefslogtreecommitdiffstats
path: root/sys/i386
diff options
context:
space:
mode:
authorabial <abial@FreeBSD.org>1999-01-06 09:09:22 +0000
committerabial <abial@FreeBSD.org>1999-01-06 09:09:22 +0000
commitcfa7b9f775d598093947c8a98026cdc72e969260 (patch)
tree98f29873ec801702095673fe4a9ffa1ee043af44 /sys/i386
parent8b25eb3e6f1ce751a10b2f8039b65fa26644246b (diff)
downloadFreeBSD-src-cfa7b9f775d598093947c8a98026cdc72e969260.zip
FreeBSD-src-cfa7b9f775d598093947c8a98026cdc72e969260.tar.gz
Add new sysctl machdep.uc_devlist. It allows to cleanly retrieve the
list of devices which has been changed in UserConfig, without resorting to reading /dev/kmem. The data returned consist of series of struct isa_device and char dev_name[8]. Ok'd by: jkh
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/userconfig.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/sys/i386/i386/userconfig.c b/sys/i386/i386/userconfig.c
index 8b097c7..bc35323 100644
--- a/sys/i386/i386/userconfig.c
+++ b/sys/i386/i386/userconfig.c
@@ -46,7 +46,7 @@
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
- ** $Id: userconfig.c,v 1.117 1998/12/07 21:58:19 archie Exp $
+ ** $Id: userconfig.c,v 1.118 1998/12/14 06:13:41 dillon Exp $
**/
/**
@@ -114,6 +114,7 @@
#include <sys/malloc.h>
#include <sys/reboot.h>
#include <sys/linker.h>
+#include <sys/sysctl.h>
#include <machine/cons.h>
#include <machine/md_var.h>
@@ -136,6 +137,45 @@ static int userconfig_boot_parsing; /* set if we are reading from the boot instr
#define putchar(x) cnputc(x)
+static int
+sysctl_machdep_uc_devlist SYSCTL_HANDLER_ARGS
+{
+ struct isa_device *id;
+ int error=0;
+ char name[8];
+
+ if(!req->oldptr) {
+ /* Only sizing */
+ id=isa_devlist;
+ while(id) {
+ error+=sizeof(struct isa_device)+8;
+ id=id->id_next;
+ }
+ return(SYSCTL_OUT(req,0,error));
+ } else {
+ /* Output the data. The buffer is filled with consecutive
+ * struct isa_device and char buf[8], containing the name
+ * (not guaranteed to end with '\0').
+ */
+ id=isa_devlist;
+ while(id) {
+ error=sysctl_handle_opaque(oidp,id,
+ sizeof(struct isa_device),req);
+ if(error) return(error);
+ strncpy(name,id->id_driver->name,8);
+ error=sysctl_handle_opaque(oidp,name,
+ 8,req);
+ if(error) return(error);
+ id=id->id_next;
+ }
+ return(0);
+ }
+}
+
+SYSCTL_PROC( _machdep, OID_AUTO, uc_devlist, CTLFLAG_RD,
+ 0, 0, sysctl_machdep_uc_devlist, "A",
+ "List of ISA devices changed in UserConfig");
+
/*
** Obtain command input.
**
@@ -2460,7 +2500,7 @@ visuserconfig(void)
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: userconfig.c,v 1.117 1998/12/07 21:58:19 archie Exp $
+ * $Id: userconfig.c,v 1.118 1998/12/14 06:13:41 dillon Exp $
*/
#include "scbus.h"
OpenPOWER on IntegriCloud