stand: Add devformat to return formatted string for a device
Use dv_fmtdev to return a formatted string for a device. If this is a null pointer, return the device name and unit followed by a colon (eg disk3:). Sponsored by: Netflix Reviewed by: tsoome (prior version) Differential Revision: https://reviews.freebsd.org/D35916
This commit is contained in:
parent
4d4b1a298c
commit
dc472f6702
@ -56,3 +56,14 @@ noioctl(struct open_file *f __unused, u_long cmd __unused, void *data __unused)
|
|||||||
{
|
{
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
devformat(struct devdesc *d)
|
||||||
|
{
|
||||||
|
static char name[DEV_DEVLEN];
|
||||||
|
|
||||||
|
if (d->d_dev->dv_fmtdev != NULL)
|
||||||
|
return (d->d_dev->dv_fmtdev(d));
|
||||||
|
snprintf(name, sizeof(name), "%s%d:", d->d_dev->dv_name, d->d_unit);
|
||||||
|
return (name);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user