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
This commit is contained in:
Pawel Jakub Dawidek 2019-03-30 07:24:34 +00:00
parent e55624c605
commit e6b0d5eb9f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345727
2 changed files with 19 additions and 4 deletions

View File

@ -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

View File

@ -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
};
/*
@ -302,6 +304,15 @@ g_dev_attrchanged(struct g_consumer *cp, const char *attr)
}
}
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 *
g_dev_getprovider(struct cdev *dev)
{