1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

geom_dev: Use kenv 'dumpdev' in the same way as rc/etc.d/dumpon

Skip a /dev/ prefix, if one is present, when checking for matching
device names for dump.

Suggested by:	avg
Reviewed by:	markj
Sponsored by:	EMC / Isilon Storage Division
Differential Revision:	https://reviews.freebsd.org/D3725
This commit is contained in:
Conrad Meyer 2015-09-23 21:08:52 +00:00
parent 533fbec505
commit b4d7290796
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288153

View File

@ -124,6 +124,7 @@ g_dev_fini(struct g_class *mp)
{
freeenv(dumpdev);
dumpdev = NULL;
}
static int
@ -152,10 +153,16 @@ g_dev_setdumpdev(struct cdev *dev, struct thread *td)
static void
init_dumpdev(struct cdev *dev)
{
const char *devprefix = "/dev/", *devname;
size_t len;
if (dumpdev == NULL)
return;
if (strcmp(devtoname(dev), dumpdev) != 0)
len = strlen(devprefix);
devname = devtoname(dev);
if (strcmp(devname, dumpdev) != 0 &&
(strncmp(dumpdev, devprefix, len) != 0 ||
strcmp(devname, dumpdev + len) != 0))
return;
if (g_dev_setdumpdev(dev, curthread) == 0) {
freeenv(dumpdev);