summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2015-01-14 11:15:57 +0000
committertrasz <trasz@FreeBSD.org>2015-01-14 11:15:57 +0000
commita54e74c1820930733f3554b4b49d6d4e6ca04644 (patch)
tree59ba738daee5bacf32e209024b6589f2c317250d
parent7d12e026a4c97d90e0ca4a2d85371c1a779a7667 (diff)
downloadFreeBSD-src-a54e74c1820930733f3554b4b49d6d4e6ca04644.zip
FreeBSD-src-a54e74c1820930733f3554b4b49d6d4e6ca04644.tar.gz
Add devd(8) notifications for creation and destruction of GEOM devices.
Differential Revision: https://reviews.freebsd.org/D1211 MFC after: 1 month Sponsored by: The FreeBSD Foundation
-rw-r--r--sbin/devd/devd.conf.529
-rw-r--r--sys/geom/geom_dev.c10
2 files changed, 37 insertions, 2 deletions
diff --git a/sbin/devd/devd.conf.5 b/sbin/devd/devd.conf.5
index 311228e..9749283 100644
--- a/sbin/devd/devd.conf.5
+++ b/sbin/devd/devd.conf.5
@@ -41,7 +41,7 @@
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\"
-.Dd February 22, 2013
+.Dd January 14, 2015
.Dt DEVD.CONF 5
.Os
.Sh NAME
@@ -370,6 +370,33 @@ node is destroyed.
.El
.El
.Pp
+.It Li GEOM
+Events related to the
+.Xr geom 4
+framework.
+The difference compared to
+.Li DEVFS
+is that
+.Li GEOM
+only includes disk-like devices.
+.Bl -tag -width ".Sy Subsystem" -compact
+.It Sy Subsystem
+.It Li DEV
+.Bl -tag -width ".Li MEDIACHANGE" -compact
+.It Sy Type
+.It Li CREATE
+A
+.Xr geom 4
+device node is created.
+.It Li DESTROY
+A
+.Xr geom 4
+device node is destroyed.
+.It Li MEDIACHANGE
+Physical media has changed.
+.El
+.El
+.Pp
.It Li USB
Events related to the USB subsystem.
.Bl -tag -width ".Sy Subsystem" -compact
diff --git a/sys/geom/geom_dev.c b/sys/geom/geom_dev.c
index 6380e40..decbbe0 100644
--- a/sys/geom/geom_dev.c
+++ b/sys/geom/geom_dev.c
@@ -169,12 +169,15 @@ g_dev_destroy(void *arg, int flags __unused)
struct g_consumer *cp;
struct g_geom *gp;
struct g_dev_softc *sc;
+ char buf[SPECNAMELEN + 6];
g_topology_assert();
cp = arg;
gp = cp->geom;
sc = cp->private;
g_trace(G_T_TOPOLOGY, "g_dev_destroy(%p(%s))", cp, gp->name);
+ snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
+ devctl_notify_f("GEOM", "DEV", "DESTROY", buf, M_WAITOK);
if (cp->acr > 0 || cp->acw > 0 || cp->ace > 0)
g_access(cp, -cp->acr, -cp->acw, -cp->ace);
g_detach(cp);
@@ -209,11 +212,14 @@ g_dev_attrchanged(struct g_consumer *cp, const char *attr)
dev = sc->sc_dev;
snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf, M_WAITOK);
+ devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf, M_WAITOK);
dev = sc->sc_alias;
if (dev != NULL) {
snprintf(buf, sizeof(buf), "cdev=%s", dev->si_name);
devctl_notify_f("DEVFS", "CDEV", "MEDIACHANGE", buf,
M_WAITOK);
+ devctl_notify_f("GEOM", "DEV", "MEDIACHANGE", buf,
+ M_WAITOK);
}
return;
}
@@ -269,7 +275,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
struct g_dev_softc *sc;
int error, len;
struct cdev *dev, *adev;
- char buf[64], *val;
+ char buf[SPECNAMELEN + 6], *val;
g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name);
g_topology_assert();
@@ -326,6 +332,8 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
}
g_dev_attrchanged(cp, "GEOM::physpath");
+ snprintf(buf, sizeof(buf), "cdev=%s", gp->name);
+ devctl_notify_f("GEOM", "DEV", "CREATE", buf, M_WAITOK);
return (gp);
}
OpenPOWER on IntegriCloud