qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 4/4] linux-user: Add support for FDGETFDCSTAT ioctl


From: Laurent Vivier
Subject: Re: [PATCH v2 4/4] linux-user: Add support for FDGETFDCSTAT ioctl
Date: Tue, 18 Feb 2020 22:18:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

Le 24/01/2020 à 16:47, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <address@hidden>
> 
> FDGETFDCSTAT's third agrument is a pointer to the structure:
> 
> struct floppy_fdc_state {
>     int spec1;
>     int spec2;
>     int dtr;
>     unsigned char version;
>     unsigned char dor;
>     unsigned long address;
>     unsigned int rawcmd:2;
>     unsigned int reset:1;
>     unsigned int need_configure:1;
>     unsigned int perp_mode:2;
>     unsigned int has_fifo:1;
>     unsigned int driver_version;
>     unsigned char track[4];
> };
> 
> defined in Linux kernel header <linux/fd.h>.
> 
> Since there is a fields of the structure of type 'unsigned long', there is
> a need to define "target_format_descr". Also, five fields rawcmd, reset,
> need_configure, perp_mode, and has_fifo are all just bitfields and are
> part od a single 'unsigned int' field.
> 
> Signed-off-by: Aleksandar Markovic <address@hidden>
> ---
>  linux-user/ioctls.h        |  2 ++
>  linux-user/syscall_defs.h  | 18 ++++++++++++++++++
>  linux-user/syscall_types.h | 12 ++++++++++++
>  3 files changed, 32 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index adc07ad..b3bbe6a 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -145,6 +145,8 @@
>       IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
>       IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
>       IOCTL(FDRESET, 0, TYPE_NULL)
> +     IOCTL(FDGETFDCSTAT, IOC_R,
> +           MK_PTR(MK_STRUCT(STRUCT_target_floppy_fdc_state)))
>       IOCTL(FDRAWCMD, 0, TYPE_NULL)
>       IOCTL(FDTWADDLE, 0, TYPE_NULL)
>       IOCTL(FDEJECT, 0, TYPE_NULL)
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index ae4c048..e08e5bc 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -933,6 +933,23 @@ struct target_rtc_pll_info {
>  
>  /* From <linux/fd.h> */
>  
> +struct target_floppy_fdc_state {
> +    int spec1;                      /* spec1 value last used */
> +    int spec2;                      /* spec2 value last used */
> +    int dtr;
> +    unsigned char version;          /* FDC version code */
> +    unsigned char dor;
> +    abi_ulong address;              /* io address */
> +    unsigned int rawcmd:2;
> +    unsigned int reset:1;
> +    unsigned int need_configure:1;
> +    unsigned int perp_mode:2;
> +    unsigned int has_fifo:1;
> +    unsigned int driver_version;    /* version code for floppy driver */
> +    unsigned char track[4];
> +};
> +

use abi_int/abi_uint rather than "int/unsigned int".

Thanks,
Laurent



reply via email to

[Prev in Thread] Current Thread [Next in Thread]