aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2002-09-20 02:16:33 +0000
committerWarner Losh <imp@FreeBSD.org>2002-09-20 02:16:33 +0000
commit43832002d3321106a32a78fe06fda22f2c34213d (patch)
treebbf4b3adcfce72b29e0bb46bc3df318d2f30042b /lib
parentdfade0043c728d4943e57f68035be42b5ca2a814 (diff)
downloadsrc-43832002d3321106a32a78fe06fda22f2c34213d.tar.gz
src-43832002d3321106a32a78fe06fda22f2c34213d.zip
Expose the new kernel data structures to libdevinfo:
o Added dd_pnpinfo, dd_location, dd_devflags, dd_flags and dd_state o Copy/initialize these as necessary. o Document the changes to the interface in devinfo.3.
Notes
Notes: svn path=/head/; revision=103662
Diffstat (limited to 'lib')
-rw-r--r--lib/libdevinfo/devinfo.35
-rw-r--r--lib/libdevinfo/devinfo.c15
-rw-r--r--lib/libdevinfo/devinfo.h16
-rw-r--r--lib/libdevinfo/devinfo_var.h11
4 files changed, 41 insertions, 6 deletions
diff --git a/lib/libdevinfo/devinfo.3 b/lib/libdevinfo/devinfo.3
index ec1a5e1e05a6..de1fd6210944 100644
--- a/lib/libdevinfo/devinfo.3
+++ b/lib/libdevinfo/devinfo.3
@@ -101,6 +101,11 @@ struct devinfo_dev {
char *dd_name; /* name of device */
char *dd_desc; /* device description */
char *dd_drivername; /* name of attached driver */
+ char *dd_pnpinfo; /* pnp info from parent bus */
+ char *dd_location; /* Where bus thinks dev at */
+ uint32_t dd_devflags; /* API flags */
+ uint16_t dd_flags; /* internal dev flags */
+ device_state_t dd_state; /* attacement state of dev */
};
struct devinfo_rman {
diff --git a/lib/libdevinfo/devinfo.c b/lib/libdevinfo/devinfo.c
index 650b7f89a81e..03186291ddb4 100644
--- a/lib/libdevinfo/devinfo.c
+++ b/lib/libdevinfo/devinfo.c
@@ -218,13 +218,22 @@ devinfo_init_devices(int generation)
return(ENOMEM);
dd->dd_dev.dd_handle = udev.dv_handle;
dd->dd_dev.dd_parent = udev.dv_parent;
- snprintf(dd->dd_name, DEVINFO_STRLEN, "%s", udev.dv_name);
+ snprintf(dd->dd_name, sizeof(dd->dd_name), "%s", udev.dv_name);
dd->dd_dev.dd_name = &dd->dd_name[0];
- snprintf(dd->dd_desc, DEVINFO_STRLEN, "%s", udev.dv_desc);
+ snprintf(dd->dd_desc, sizeof(dd->dd_desc), "%s", udev.dv_desc);
dd->dd_dev.dd_desc = &dd->dd_desc[0];
- snprintf(dd->dd_drivername, DEVINFO_STRLEN, "%s",
+ snprintf(dd->dd_drivername, sizeof(dd->dd_drivername), "%s",
udev.dv_drivername);
dd->dd_dev.dd_drivername = &dd->dd_drivername[0];
+ snprintf(dd->dd_pnpinfo, sizeof(dd->dd_pnpinfo), "%s",
+ udev.dv_pnpinfo);
+ dd->dd_dev.dd_pnpinfo = &dd->dd_pnpinfo[0];
+ snprintf(dd->dd_location, sizeof(dd->dd_location), "%s",
+ udev.dv_location);
+ dd->dd_dev.dd_location = &dd->dd_location[0];
+ dd->dd_dev.dd_devflags = udev.dv_devflags;
+ dd->dd_dev.dd_flags = udev.dv_flags;
+ dd->dd_dev.dd_state = udev.dv_state;
TAILQ_INSERT_TAIL(&devinfo_dev, dd, dd_link);
}
debug("fetched %d devices", dev_idx);
diff --git a/lib/libdevinfo/devinfo.h b/lib/libdevinfo/devinfo.h
index 63188aa8e787..f31058a2353b 100644
--- a/lib/libdevinfo/devinfo.h
+++ b/lib/libdevinfo/devinfo.h
@@ -33,6 +33,17 @@
typedef __uintptr_t devinfo_handle_t;
#define DEVINFO_ROOT_DEVICE ((devinfo_handle_t)0)
+/*
+ * State of the device.
+ */
+/* XXX not sure if I want a copy here, or expose sys/bus.h */
+typedef enum devinfo_state {
+ DIS_NOTPRESENT, /* not probed or probe failed */
+ DIS_ALIVE, /* probe succeeded */
+ DIS_ATTACHED, /* attach method called */
+ DIS_BUSY /* device is open */
+} devinfo_state_t;
+
struct devinfo_dev {
devinfo_handle_t dd_handle; /* device handle */
devinfo_handle_t dd_parent; /* parent handle */
@@ -40,6 +51,11 @@ struct devinfo_dev {
char *dd_name; /* name of device */
char *dd_desc; /* device description */
char *dd_drivername; /* name of attached driver*/
+ char *dd_pnpinfo; /* pnp info from parent bus */
+ char *dd_location; /* Where bus thinks dev at */
+ uint32_t dd_devflags; /* API flags */
+ uint16_t dd_flags; /* internal dev flags */
+ devinfo_state_t dd_state; /* attacement state of dev */
};
struct devinfo_rman {
diff --git a/lib/libdevinfo/devinfo_var.h b/lib/libdevinfo/devinfo_var.h
index c5dddcc46835..73de85c57f43 100644
--- a/lib/libdevinfo/devinfo_var.h
+++ b/lib/libdevinfo/devinfo_var.h
@@ -42,9 +42,14 @@
*/
struct devinfo_i_dev {
struct devinfo_dev dd_dev;
- char dd_name[32];
- char dd_desc[32];
- char dd_drivername[32];
+ char dd_name[DEVINFO_STRLEN];
+ char dd_desc[DEVINFO_STRLEN];
+ char dd_drivername[DEVINFO_STRLEN];
+ char dd_pnpinfo[DEVINFO_STRLEN * 2];
+ char dd_location[DEVINFO_STRLEN * 2];
+ uint32_t dd_devflags;
+ uint16_t dd_flags;
+ device_state_t dd_state;
TAILQ_ENTRY(devinfo_i_dev) dd_link;
};