svn commit: r345727 - in head: sbin/devd sys/geom
Pawel Jakub Dawidek
pjd at FreeBSD.org
Tue Sep 3 14:06:14 UTC 2019
Author: pjd
Date: Sat Mar 30 07:24:34 2019
New Revision: 345727
URL: https://svnweb.freebsd.org/changeset/base/345727
Log:
Introduce new event SIZECHANGE within GEOM system to inform about GEOM
providers mediasize changes.
While here, use GEOM nomenclature to describe providers instead of calling
them device nodes.
Obtained from: Fudo Security
Tested in: AWS
Modified:
head/sbin/devd/devd.conf.5
head/sys/geom/geom_dev.c
Modified: head/sbin/devd/devd.conf.5
==============================================================================
--- head/sbin/devd/devd.conf.5 Sat Mar 30 07:20:28 2019 (r345726)
+++ head/sbin/devd/devd.conf.5 Sat Mar 30 07:24:34 2019 (r345727)
@@ -41,7 +41,7 @@
.\" ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
.\" SOFTWARE.
.\"
-.Dd July 20, 2018
+.Dd March 29, 2019
.Dt DEVD.CONF 5
.Os
.Sh NAME
@@ -432,15 +432,19 @@ only includes disk-like devices.
.It Li CREATE
A
.Xr geom 4
-device node is created.
+provider is created.
.It Li DESTROY
A
.Xr geom 4
-device node is destroyed.
+provider is destroyed.
.It Li GEOM::physpath
The physical path of a device has changed.
.It Li MEDIACHANGE
Physical media has changed.
+.It Li SIZECHANGE
+A
+.Xr geom 4
+provider size has changed.
.El
.El
.Pp
Modified: head/sys/geom/geom_dev.c
==============================================================================
--- head/sys/geom/geom_dev.c Sat Mar 30 07:20:28 2019 (r345726)
+++ head/sys/geom/geom_dev.c Sat Mar 30 07:24:34 2019 (r345727)
@@ -92,6 +92,7 @@ static g_fini_t g_dev_fini;
static g_taste_t g_dev_taste;
static g_orphan_t g_dev_orphan;
static g_attrchanged_t g_dev_attrchanged;
+static g_resize_t g_dev_resize;
static struct g_class g_dev_class = {
.name = "DEV",
@@ -100,7 +101,8 @@ static struct g_class g_dev_class = {
.fini = g_dev_fini,
.taste = g_dev_taste,
.orphan = g_dev_orphan,
- .attrchanged = g_dev_attrchanged
+ .attrchanged = g_dev_attrchanged,
+ .resize = g_dev_resize
};
/*
@@ -300,6 +302,15 @@ g_dev_attrchanged(struct g_consumer *cp, const char *a
g_dev_set_physpath(cp);
return;
}
+}
+
+static void
+g_dev_resize(struct g_consumer *cp)
+{
+ char buf[SPECNAMELEN + 6];
+
+ snprintf(buf, sizeof(buf), "cdev=%s", cp->provider->name);
+ devctl_notify_f("GEOM", "DEV", "SIZECHANGE", buf, M_WAITOK);
}
struct g_provider *
More information about the svn-src-all
mailing list