aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2018-03-27 16:07:54 +0000
committerBrooks Davis <brooks@FreeBSD.org>2018-03-27 16:07:54 +0000
commit026cac821351142e0130eea17b1ba0e082ecbc69 (patch)
tree190290030ec6c1f4f5cc8ba1e627d6c76dcdb5a3 /sys/compat
parentf137973487f6170f8cb3285ec58aed46e9e3e6f9 (diff)
downloadsrc-026cac821351142e0130eea17b1ba0e082ecbc69.tar.gz
src-026cac821351142e0130eea17b1ba0e082ecbc69.zip
Move 32-bit compat for md(4) ioctls into the md code.
This is more correct in that ioctl commands have no meaning until they hit the handler associated with the file descriptor. Add support for MDIOCRESIZE_32 which was missed when it was added. Reviewed by: cem, kib, markj (various versions) Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14714
Notes
Notes: svn path=/head/; revision=331623
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/freebsd32/freebsd32_ioctl.c85
-rw-r--r--sys/compat/freebsd32/freebsd32_ioctl.h20
2 files changed, 0 insertions, 105 deletions
diff --git a/sys/compat/freebsd32/freebsd32_ioctl.c b/sys/compat/freebsd32/freebsd32_ioctl.c
index 4a5476849f2e..793e4b4e5892 100644
--- a/sys/compat/freebsd32/freebsd32_ioctl.c
+++ b/sys/compat/freebsd32/freebsd32_ioctl.c
@@ -42,7 +42,6 @@ __FBSDID("$FreeBSD$");
#include <sys/file.h>
#include <sys/ioccom.h>
#include <sys/malloc.h>
-#include <sys/mdioctl.h>
#include <sys/memrange.h>
#include <sys/pciio.h>
#include <sys/proc.h>
@@ -58,89 +57,12 @@ __FBSDID("$FreeBSD$");
#include <compat/freebsd32/freebsd32_ioctl.h>
#include <compat/freebsd32/freebsd32_proto.h>
-CTASSERT((sizeof(struct md_ioctl32)) == 436);
CTASSERT(sizeof(struct ioc_read_toc_entry32) == 8);
CTASSERT(sizeof(struct mem_range_op32) == 12);
CTASSERT(sizeof(struct pci_conf_io32) == 36);
CTASSERT(sizeof(struct pci_match_conf32) == 44);
CTASSERT(sizeof(struct pci_conf32) == 44);
-
-static int
-freebsd32_ioctl_md(struct thread *td, struct freebsd32_ioctl_args *uap,
- struct file *fp)
-{
- struct md_ioctl mdv;
- struct md_ioctl32 md32;
- u_long com = 0;
- int i, error;
-
- if (uap->com & IOC_IN) {
- if ((error = copyin(uap->data, &md32, sizeof(md32)))) {
- return (error);
- }
- CP(md32, mdv, md_version);
- CP(md32, mdv, md_unit);
- CP(md32, mdv, md_type);
- PTRIN_CP(md32, mdv, md_file);
- CP(md32, mdv, md_mediasize);
- CP(md32, mdv, md_sectorsize);
- CP(md32, mdv, md_options);
- CP(md32, mdv, md_base);
- CP(md32, mdv, md_fwheads);
- CP(md32, mdv, md_fwsectors);
- PTRIN_CP(md32, mdv, md_label);
- } else if (uap->com & IOC_OUT) {
- /*
- * Zero the buffer so the user always
- * gets back something deterministic.
- */
- bzero(&mdv, sizeof mdv);
- }
-
- switch (uap->com) {
- case MDIOCATTACH_32:
- com = MDIOCATTACH;
- break;
- case MDIOCDETACH_32:
- com = MDIOCDETACH;
- break;
- case MDIOCQUERY_32:
- com = MDIOCQUERY;
- break;
- case MDIOCLIST_32:
- com = MDIOCLIST;
- break;
- default:
- panic("%s: unknown MDIOC %#x", __func__, uap->com);
- }
- error = fo_ioctl(fp, com, (caddr_t)&mdv, td->td_ucred, td);
- if (error == 0 && (com & IOC_OUT)) {
- CP(mdv, md32, md_version);
- CP(mdv, md32, md_unit);
- CP(mdv, md32, md_type);
- PTROUT_CP(mdv, md32, md_file);
- CP(mdv, md32, md_mediasize);
- CP(mdv, md32, md_sectorsize);
- CP(mdv, md32, md_options);
- CP(mdv, md32, md_base);
- CP(mdv, md32, md_fwheads);
- CP(mdv, md32, md_fwsectors);
- PTROUT_CP(mdv, md32, md_label);
- if (com == MDIOCLIST) {
- /*
- * Use MDNPAD, and not MDNPAD32. Padding is
- * allocated and used by compat32 ABI.
- */
- for (i = 0; i < MDNPAD; i++)
- CP(mdv, md32, md_pad[i]);
- }
- error = copyout(&md32, uap->data, sizeof(md32));
- }
- return error;
-}
-
-
static int
freebsd32_ioctl_ioc_read_toc(struct thread *td,
struct freebsd32_ioctl_args *uap, struct file *fp)
@@ -414,13 +336,6 @@ freebsd32_ioctl(struct thread *td, struct freebsd32_ioctl_args *uap)
}
switch (uap->com) {
- case MDIOCATTACH_32: /* FALLTHROUGH */
- case MDIOCDETACH_32: /* FALLTHROUGH */
- case MDIOCQUERY_32: /* FALLTHROUGH */
- case MDIOCLIST_32:
- error = freebsd32_ioctl_md(td, uap, fp);
- break;
-
case CDIOREADTOCENTRYS_32:
error = freebsd32_ioctl_ioc_read_toc(td, uap, fp);
break;
diff --git a/sys/compat/freebsd32/freebsd32_ioctl.h b/sys/compat/freebsd32/freebsd32_ioctl.h
index 40b8bb63be34..1e3c4a6956a6 100644
--- a/sys/compat/freebsd32/freebsd32_ioctl.h
+++ b/sys/compat/freebsd32/freebsd32_ioctl.h
@@ -45,22 +45,6 @@ struct ioc_read_toc_entry32 {
uint32_t data; /* struct cd_toc_entry* */
};
-#define MDNPAD32 MDNPAD
-struct md_ioctl32 {
- unsigned md_version; /* Structure layout version */
- unsigned md_unit; /* unit number */
- enum md_types md_type; /* type of disk */
- caddr_t32 md_file; /* pathname of file to mount */
- off_t md_mediasize; /* size of disk in bytes */
- unsigned md_sectorsize; /* sectorsize */
- unsigned md_options; /* options */
- u_int64_t md_base; /* base address */
- int md_fwheads; /* firmware heads */
- int md_fwsectors; /* firmware sectors */
- caddr_t32 md_label; /* label of the device */
- int md_pad[MDNPAD32]; /* padding for future ideas */
-} __attribute__((__packed__));
-
struct fiodgname_arg32 {
int len;
caddr_t32 buf;
@@ -112,10 +96,6 @@ struct pci_conf_io32 {
};
#define CDIOREADTOCENTRYS_32 _IOWR('c', 5, struct ioc_read_toc_entry32)
-#define MDIOCATTACH_32 _IOC(IOC_INOUT, 'm', 0, sizeof(struct md_ioctl32))
-#define MDIOCDETACH_32 _IOC(IOC_INOUT, 'm', 1, sizeof(struct md_ioctl32))
-#define MDIOCQUERY_32 _IOC(IOC_INOUT, 'm', 2, sizeof(struct md_ioctl32))
-#define MDIOCLIST_32 _IOC(IOC_INOUT, 'm', 3, sizeof(struct md_ioctl32))
#define FIODGNAME_32 _IOW('f', 120, struct fiodgname_arg32)
#define MEMRANGE_GET32 _IOWR('m', 50, struct mem_range_op32)
#define MEMRANGE_SET32 _IOW('m', 51, struct mem_range_op32)