md(4): remove the unused and unusable MDIOCLIST ioctl.

It is unused, the ABI was broken in r322969, and it is broken by design
(more than MDNPAD md devices can exist and there is no way to retreive
them with this interface).

mdconfig(8) was converted to use libgeom to obtain this information
in r157160 and any other consumers of MDIOCLIST should likewise be
converted.

Reviewed by:	emaste
Relnotes:	yes
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D18936
This commit is contained in:
Brooks Davis 2019-08-16 18:57:32 +00:00
parent 0760b4c242
commit dcb235ab9e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=351132
2 changed files with 3 additions and 55 deletions

View File

@ -151,7 +151,6 @@ CTASSERT((sizeof(struct md_ioctl32)) == 436);
#define MDIOCATTACH_32 _IOC_NEWTYPE(MDIOCATTACH, struct md_ioctl32)
#define MDIOCDETACH_32 _IOC_NEWTYPE(MDIOCDETACH, struct md_ioctl32)
#define MDIOCQUERY_32 _IOC_NEWTYPE(MDIOCQUERY, struct md_ioctl32)
#define MDIOCLIST_32 _IOC_NEWTYPE(MDIOCLIST, struct md_ioctl32)
#define MDIOCRESIZE_32 _IOC_NEWTYPE(MDIOCRESIZE, struct md_ioctl32)
#endif /* COMPAT_FREEBSD32 */
@ -1876,48 +1875,6 @@ kern_mdquery(struct md_req *mdr)
return (error);
}
static int
kern_mdlist_locked(struct md_req *mdr)
{
struct md_s *sc;
int i;
sx_assert(&md_sx, SA_XLOCKED);
/*
* Write the number of md devices to mdr->md_units[0].
* Write the unit number of the first (mdr->md_units_nitems - 2)
* units to mdr->md_units[1::(mdr->md_units - 2)] and terminate the
* list with -1.
*
* XXX: There is currently no mechanism to retrieve unit
* numbers for more than (MDNPAD - 2) units.
*
* XXX: Due to the use of LIST_INSERT_HEAD in mdnew(), the
* list of visible unit numbers not stable.
*/
i = 1;
LIST_FOREACH(sc, &md_softc_list, list) {
if (i < mdr->md_units_nitems - 1)
mdr->md_units[i] = sc->unit;
i++;
}
mdr->md_units[MIN(i, mdr->md_units_nitems - 1)] = -1;
mdr->md_units[0] = i - 1;
return (0);
}
static int
kern_mdlist(struct md_req *mdr)
{
int error;
sx_xlock(&md_sx);
error = kern_mdlist_locked(mdr);
sx_xunlock(&md_sx);
return (error);
}
/* Copy members that are not userspace pointers. */
#define MD_IOCTL2REQ(mdio, mdr) do { \
(mdr)->md_unit = (mdio)->md_unit; \
@ -1958,8 +1915,7 @@ mdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
case MDIOCATTACH:
case MDIOCDETACH:
case MDIOCRESIZE:
case MDIOCQUERY:
case MDIOCLIST: {
case MDIOCQUERY: {
struct md_ioctl *mdio = (struct md_ioctl *)addr;
if (mdio->md_version != MDIOVERSION)
return (EINVAL);
@ -1976,8 +1932,7 @@ mdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
case MDIOCATTACH_32:
case MDIOCDETACH_32:
case MDIOCRESIZE_32:
case MDIOCQUERY_32:
case MDIOCLIST_32: {
case MDIOCQUERY_32: {
struct md_ioctl32 *mdio = (struct md_ioctl32 *)addr;
if (mdio->md_version != MDIOVERSION)
return (EINVAL);
@ -2019,12 +1974,6 @@ mdctlioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
#endif
error = kern_mdquery(&mdr);
break;
case MDIOCLIST:
#ifdef COMPAT_FREEBSD32
case MDIOCLIST_32:
#endif
error = kern_mdlist(&mdr);
break;
default:
error = ENOIOCTL;
}

View File

@ -64,7 +64,7 @@ struct md_ioctl {
int md_fwheads; /* firmware heads */
int md_fwsectors; /* firmware sectors */
char *md_label; /* label of the device */
int md_pad[MDNPAD]; /* storage for MDIOCLIST */
int md_pad[MDNPAD]; /* padding */
};
#define MD_NAME "md"
@ -81,7 +81,6 @@ struct md_ioctl {
#define MDIOCATTACH _IOWR('m', 0, struct md_ioctl) /* attach disk */
#define MDIOCDETACH _IOWR('m', 1, struct md_ioctl) /* detach disk */
#define MDIOCQUERY _IOWR('m', 2, struct md_ioctl) /* query status */
#define MDIOCLIST _IOWR('m', 3, struct md_ioctl) /* query status */
#define MDIOCRESIZE _IOWR('m', 4, struct md_ioctl) /* resize disk */
#define MD_CLUSTER 0x01 /* Don't cluster */