summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2003-07-02 16:01:38 +0000
committerjhb <jhb@FreeBSD.org>2003-07-02 16:01:38 +0000
commitea0bd1523805444400e26e89587d5f1a933ff7dd (patch)
treec41ae7e0b724b9b46a22f66ebca87ec6a645403f /sys
parentedf662e5b9b8021849069f367722be529ea4104a (diff)
downloadFreeBSD-src-ea0bd1523805444400e26e89587d5f1a933ff7dd.zip
FreeBSD-src-ea0bd1523805444400e26e89587d5f1a933ff7dd.tar.gz
Add a resource_disabled() helper function that returns true (non-zero) if
a specified resource has been disabled via a non-zero 'disabled' hint and false otherwise.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_hints.c14
-rw-r--r--sys/sys/bus.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/sys/kern/subr_hints.c b/sys/kern/subr_hints.c
index 93a1391..0aeb553 100644
--- a/sys/kern/subr_hints.c
+++ b/sys/kern/subr_hints.c
@@ -365,3 +365,17 @@ resource_find_dev(int *anchor, const char *name, int *unit,
*anchor = newln;
return ret;
}
+
+/*
+ * Check to see if a device is disabled via a disabled hint.
+ */
+int
+resource_disabled(const char *name, int unit)
+{
+ int error, value;
+
+ error = resource_int_value(name, unit, "disabled", &value);
+ if (error)
+ return (0);
+ return (value);
+}
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index 4500591..9de2a4c 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -353,6 +353,7 @@ int resource_long_value(const char *name, int unit, const char *resname,
long *result);
int resource_string_value(const char *name, int unit, const char *resname,
const char **result);
+int resource_disabled(const char *name, int unit);
int resource_find_match(int *anchor, const char **name, int *unit,
const char *resname, const char *value);
int resource_find_dev(int *anchor, const char *name, int *unit,
OpenPOWER on IntegriCloud