summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/os/modconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/uts/common/os/modconf.c')
-rw-r--r--usr/src/uts/common/os/modconf.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/usr/src/uts/common/os/modconf.c b/usr/src/uts/common/os/modconf.c
index 35eb1c6825..2992567207 100644
--- a/usr/src/uts/common/os/modconf.c
+++ b/usr/src/uts/common/os/modconf.c
@@ -57,6 +57,7 @@
#include <sys/kcpc.h>
#include <sys/cpc_pcbe.h>
#include <sys/kstat.h>
+#include <sys/fs/sdev_node.h>
extern int moddebug;
@@ -216,6 +217,17 @@ struct mod_ops mod_dacfops = {
};
/*
+ * /dev fs modules
+ */
+static int mod_infodev(struct modldev *, struct modlinkage *, int *);
+static int mod_installdev(struct modldev *, struct modlinkage *);
+static int mod_removedev(struct modldev *, struct modlinkage *);
+
+struct mod_ops mod_devfsops = {
+ mod_installdev, mod_removedev, mod_infodev
+};
+
+/*
* PCBE (Performance Counter BackEnd) modules.
*/
static int mod_installpcbe(struct modlpcbe *, struct modlinkage *);
@@ -483,6 +495,41 @@ mod_removepcbe(struct modlpcbe *modl, struct modlinkage *modlp)
return (EBUSY);
}
+/*
+ * manage /dev fs modules
+ */
+/*ARGSUSED*/
+static int
+mod_infodev(struct modldev *modl, struct modlinkage *modlp, int *p0)
+{
+ if (mod_getctl(modlp) == NULL) {
+ *p0 = -1;
+ return (0); /* module is not yet installed */
+ }
+
+ *p0 = 0;
+ return (0);
+}
+
+static int
+mod_installdev(struct modldev *modl, struct modlinkage *modlp)
+{
+ struct modctl *mcp;
+
+ if ((mcp = mod_getctl(modlp)) == NULL)
+ return (EINVAL);
+ return (sdev_module_register(mcp->mod_modname, modl->dev_ops));
+}
+
+/*
+ * /dev modules are not unloadable.
+ */
+/*ARGSUSED*/
+static int
+mod_removedev(struct modldev *modl, struct modlinkage *modlp)
+{
+ return (EBUSY);
+}
/*
* Install a new driver