Add proper support for the md_label into md(4) ioctl compat layer.
While I am here, declare struct md_ioctl32 as packed which allows us to stop playing tricks with sizeof(md_ioctl32)+y as well as simplifies md_pad handling. Both were necessary because of different alignment preferences on amd64 vs i386. MFC after: 4 weeks
This commit is contained in:
parent
13aa7b3b56
commit
a6497b6a8c
@ -55,8 +55,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <compat/freebsd32/freebsd32_ioctl.h>
|
||||
#include <compat/freebsd32/freebsd32_proto.h>
|
||||
|
||||
/* Cannot get exact size in 64-bit due to alignment issue of entire struct. */
|
||||
CTASSERT((sizeof(struct md_ioctl32)+4) == 436);
|
||||
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);
|
||||
@ -87,6 +86,7 @@ freebsd32_ioctl_md(struct thread *td, struct freebsd32_ioctl_args *uap,
|
||||
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
|
||||
@ -123,6 +123,7 @@ freebsd32_ioctl_md(struct thread *td, struct freebsd32_ioctl_args *uap,
|
||||
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
|
||||
|
@ -43,7 +43,7 @@ struct ioc_read_toc_entry32 {
|
||||
uint32_t data; /* struct cd_toc_entry* */
|
||||
};
|
||||
|
||||
#define MDNPAD32 MDNPAD - 1
|
||||
#define MDNPAD32 MDNPAD
|
||||
struct md_ioctl32 {
|
||||
unsigned md_version; /* Structure layout version */
|
||||
unsigned md_unit; /* unit number */
|
||||
@ -55,8 +55,9 @@ struct md_ioctl32 {
|
||||
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;
|
||||
@ -109,10 +110,10 @@ 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) + 4)
|
||||
#define MDIOCDETACH_32 _IOC(IOC_INOUT, 'm', 1, sizeof(struct md_ioctl32) + 4)
|
||||
#define MDIOCQUERY_32 _IOC(IOC_INOUT, 'm', 2, sizeof(struct md_ioctl32) + 4)
|
||||
#define MDIOCLIST_32 _IOC(IOC_INOUT, 'm', 3, sizeof(struct md_ioctl32) + 4)
|
||||
#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)
|
||||
|
Loading…
Reference in New Issue
Block a user