Make mlxcontrol work with more than one system drive:
- When searching for the next system drive, return the next one instead of always returning the first one. - Plug fd lead and make sure that the MLX_NEXT_CHILD ioctl is called on the controller fd, not the disk's one. While there, fix a cut-n-pase error in a warning. Reviewed by: jhb Approved by: kan (mentor) MFC after: 1 month
This commit is contained in:
parent
3d0f3248ea
commit
29e6fa3a7f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182965
@ -760,7 +760,7 @@ mlx_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int32_t flag, struct threa
|
|||||||
if (sc->mlx_sysdrive[i].ms_disk != 0) {
|
if (sc->mlx_sysdrive[i].ms_disk != 0) {
|
||||||
/* looking for the next one we come across? */
|
/* looking for the next one we come across? */
|
||||||
if (*arg == -1) {
|
if (*arg == -1) {
|
||||||
*arg = device_get_unit(sc->mlx_sysdrive[0].ms_disk);
|
*arg = device_get_unit(sc->mlx_sysdrive[i].ms_disk);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
/* we want the one after this one */
|
/* we want the one after this one */
|
||||||
|
@ -628,7 +628,7 @@ cmd_rebuild(int argc, char *argv[])
|
|||||||
warnx("drive rebuild or consistency check is already in progress on this controller");
|
warnx("drive rebuild or consistency check is already in progress on this controller");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
warn("ioctl MLXD_CHECKASYNC");
|
warn("ioctl MLXD_REBUILDASYNC");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -79,16 +79,18 @@ void
|
|||||||
mlxd_foreach_ctrlr(int unit, void *arg)
|
mlxd_foreach_ctrlr(int unit, void *arg)
|
||||||
{
|
{
|
||||||
struct mlxd_foreach_action *ma = (struct mlxd_foreach_action *)arg;
|
struct mlxd_foreach_action *ma = (struct mlxd_foreach_action *)arg;
|
||||||
int i, fd;
|
int i, fd, ctrlfd;
|
||||||
|
|
||||||
/* Get the device */
|
/* Get the device */
|
||||||
if ((fd = open(ctrlrpath(unit), 0)) < 0)
|
if ((ctrlfd = open(ctrlrpath(unit), 0)) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = -1; ;) {
|
for (i = -1; ;) {
|
||||||
/* Get the unit number of the next child device */
|
/* Get the unit number of the next child device */
|
||||||
if (ioctl(fd, MLX_NEXT_CHILD, &i) < 0)
|
if (ioctl(ctrlfd, MLX_NEXT_CHILD, &i) < 0) {
|
||||||
|
close(ctrlfd);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* check that we can open this unit */
|
/* check that we can open this unit */
|
||||||
if ((fd = open(drivepath(i), 0)) >= 0)
|
if ((fd = open(drivepath(i), 0)) >= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user