Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 May 2015 10:42:49 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r282953 - in stable/10: sbin/devd sys/geom
Message-ID:  <201505151042.t4FAgn6S061450@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Fri May 15 10:42:48 2015
New Revision: 282953
URL: https://svnweb.freebsd.org/changeset/base/282953

Log:
  MFC r277170:
  
  Add devd(8) notifications for creation and destruction of GEOM devices.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/10/sbin/devd/devd.conf.5
  stable/10/sys/geom/geom_dev.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/devd/devd.conf.5
==============================================================================
--- stable/10/sbin/devd/devd.conf.5	Fri May 15 09:56:59 2015	(r282952)
+++ stable/10/sbin/devd/devd.conf.5	Fri May 15 10:42:48 2015	(r282953)
@@ -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

Modified: stable/10/sys/geom/geom_dev.c
==============================================================================
--- stable/10/sys/geom/geom_dev.c	Fri May 15 09:56:59 2015	(r282952)
+++ stable/10/sys/geom/geom_dev.c	Fri May 15 10:42:48 2015	(r282953)
@@ -169,12 +169,15 @@ g_dev_destroy(void *arg, int flags __unu
 	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,
 		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
 	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();
@@ -324,6 +330,8 @@ g_dev_taste(struct g_class *mp, struct g
 	}
 
 	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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505151042.t4FAgn6S061450>