1) If mdconfig isn't given an action argument, it assumes detach.
2) Running `mdconfig -l` without any attached devices results in mdconfig printing "md0" to standard output. Submitted by: dd [1] [1] no, not "dd(1)" but "Dima Dorfman"
This commit is contained in:
parent
9708152c20
commit
83da2a90ae
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=74044
@ -164,15 +164,16 @@ main(int argc, char **argv)
|
|||||||
i = ioctl(fd, MDIOCATTACH, &mdio);
|
i = ioctl(fd, MDIOCATTACH, &mdio);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
err(1, "ioctl(/dev/%s)", MDCTL_NAME);
|
err(1, "ioctl(/dev/%s)", MDCTL_NAME);
|
||||||
} else {
|
if (mdio.md_options & MD_AUTOUNIT)
|
||||||
|
printf("%s%d\n", MD_NAME, mdio.md_unit);
|
||||||
|
} else if (action == DETACH) {
|
||||||
if (mdio.md_options & MD_AUTOUNIT)
|
if (mdio.md_options & MD_AUTOUNIT)
|
||||||
usage();
|
usage();
|
||||||
i = ioctl(fd, MDIOCDETACH, &mdio);
|
i = ioctl(fd, MDIOCDETACH, &mdio);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
err(1, "ioctl(/dev/%s)", MDCTL_NAME);
|
err(1, "ioctl(/dev/%s)", MDCTL_NAME);
|
||||||
}
|
} else
|
||||||
if (mdio.md_options & MD_AUTOUNIT)
|
usage();
|
||||||
printf("%s%d\n", MD_NAME, mdio.md_unit);
|
|
||||||
close (fd);
|
close (fd);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user