Include more information about the device in the devadded and
devremoved events. This reduces the races around these events. We now include the pnp info in both. This lets one do more interesting thigns with devd on device insertion. Submitted by: Bernd Walter
This commit is contained in:
parent
782ece3862
commit
37b4e4f471
@ -617,7 +617,25 @@ bad:
|
||||
static void
|
||||
devadded(device_t dev)
|
||||
{
|
||||
devaddq("+", device_get_nameunit(dev), dev);
|
||||
char *pnp = NULL;
|
||||
char *tmp = NULL;
|
||||
|
||||
pnp = malloc(1024, M_BUS, M_NOWAIT);
|
||||
if (pnp == NULL)
|
||||
goto fail;
|
||||
tmp = malloc(1024, M_BUS, M_NOWAIT);
|
||||
if (tmp == NULL)
|
||||
goto fail;
|
||||
*pnp = '\0';
|
||||
bus_child_pnpinfo_str(dev, pnp, 1024);
|
||||
snprintf(tmp, 1024, "%s %s", device_get_nameunit(dev), pnp);
|
||||
devaddq("+", tmp, dev);
|
||||
fail:
|
||||
if (pnp != NULL)
|
||||
free(pnp, M_BUS);
|
||||
if (tmp != NULL)
|
||||
free(tmp, M_BUS);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -627,7 +645,25 @@ devadded(device_t dev)
|
||||
static void
|
||||
devremoved(device_t dev)
|
||||
{
|
||||
devaddq("-", device_get_nameunit(dev), dev);
|
||||
char *pnp = NULL;
|
||||
char *tmp = NULL;
|
||||
|
||||
pnp = malloc(1024, M_BUS, M_NOWAIT);
|
||||
if (pnp == NULL)
|
||||
goto fail;
|
||||
tmp = malloc(1024, M_BUS, M_NOWAIT);
|
||||
if (tmp == NULL)
|
||||
goto fail;
|
||||
*pnp = '\0';
|
||||
bus_child_pnpinfo_str(dev, pnp, 1024);
|
||||
snprintf(tmp, 1024, "%s %s", device_get_nameunit(dev), pnp);
|
||||
devaddq("-", tmp, dev);
|
||||
fail:
|
||||
if (pnp != NULL)
|
||||
free(pnp, M_BUS);
|
||||
if (tmp != NULL)
|
||||
free(tmp, M_BUS);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user