Switch from make_dev_alias to make_dev_alias_p since make_dev_alias_p can

gracefully fail if the /dev/megaraid_sas_ioctl_node symlink already exists.
This can happen if mfi(4) and mrsas(4) are both attached to cards and
providing Linux emulation support.  Let the first one win.  An equivalent
change needs to be done to mrsas(4).  Extra credit would be to pass the
Linux emulation call to the other driver when appropriate.  This will
probably be a rare case and the user can manually change where the symlink
points to.

MFC after:	3 days
This commit is contained in:
Doug Ambrisko 2015-06-09 15:51:11 +00:00
parent 5296d0421e
commit b5c5032066

View File

@ -369,6 +369,7 @@ mfi_attach(struct mfi_softc *sc)
int error, commsz, framessz, sensesz;
int frames, unit, max_fw_sge, max_fw_cmds;
uint32_t tb_mem_size = 0;
struct cdev *dev_t;
if (sc == NULL)
return EINVAL;
@ -763,7 +764,8 @@ mfi_attach(struct mfi_softc *sc)
sc->mfi_cdev = make_dev(&mfi_cdevsw, unit, UID_ROOT, GID_OPERATOR,
0640, "mfi%d", unit);
if (unit == 0)
make_dev_alias(sc->mfi_cdev, "megaraid_sas_ioctl_node");
make_dev_alias_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &dev_t,
sc->mfi_cdev, "%s", "megaraid_sas_ioctl_node");
if (sc->mfi_cdev != NULL)
sc->mfi_cdev->si_drv1 = sc;
SYSCTL_ADD_INT(device_get_sysctl_ctx(sc->mfi_dev),