diff options
author | Ryan Moeller <[email protected]> | 2022-09-08 13:40:18 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-09-08 10:40:18 -0700 |
commit | 60d995727a19104a2832d475f5c0861ffbae2c97 (patch) | |
tree | ec76c385fc60cdb7a93d1807a3d846f5c8a25e3d | |
parent | e27e692bcc2c3e5b79f60ef16a2183f2231ff012 (diff) |
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 <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #13854
-rw-r--r-- | module/os/freebsd/zfs/kmod_core.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/module/os/freebsd/zfs/kmod_core.c b/module/os/freebsd/zfs/kmod_core.c index 2b808357e..020ef6a39 100644 --- a/module/os/freebsd/zfs/kmod_core.c +++ b/module/os/freebsd/zfs/kmod_core.c @@ -219,9 +219,16 @@ static struct cdevsw zfs_cdevsw = { int zfsdev_attach(void) { - zfsdev = make_dev(&zfs_cdevsw, 0x0, UID_ROOT, GID_OPERATOR, 0666, - ZFS_DRIVER); - return (0); + struct make_dev_args args; + + 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 |