FreeBSD: Replace legacy make_dev() interface usage
The function make_dev_s() was introduced to replace make_dev() in FreeBSD 11.0. It allows further specification of properties and flags and returns an error code on failure. Using this we can fail loading the module more gracefully than a panic in situations such as when a device named zfs already exists. We already use it for zvols. Use make_dev_s() for /dev/zfs. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #13854
This commit is contained in:
parent
e27e692bcc
commit
60d995727a
|
@ -219,9 +219,16 @@ static struct cdevsw zfs_cdevsw = {
|
||||||
int
|
int
|
||||||
zfsdev_attach(void)
|
zfsdev_attach(void)
|
||||||
{
|
{
|
||||||
zfsdev = make_dev(&zfs_cdevsw, 0x0, UID_ROOT, GID_OPERATOR, 0666,
|
struct make_dev_args args;
|
||||||
ZFS_DRIVER);
|
|
||||||
return (0);
|
make_dev_args_init(&args);
|
||||||
|
args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK;
|
||||||
|
args.mda_devsw = &zfs_cdevsw;
|
||||||
|
args.mda_cr = NULL;
|
||||||
|
args.mda_uid = UID_ROOT;
|
||||||
|
args.mda_gid = GID_OPERATOR;
|
||||||
|
args.mda_mode = 0666;
|
||||||
|
return (make_dev_s(&args, &zfsdev, ZFS_DRIVER));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue