From: Laurent Vivier <laurent@vivier.eu>
To: Aleksandar Markovic <aleksandar.m.mail@gmail.com>
Cc: Aleksandar Markovic <aleksandar.markovic@rt-rk.com>,
riku.voipio@iki.fi, qemu-devel@nongnu.org,
amarkovic@wavecomp.com
Subject: Re: [Qemu-devel] [PATCH v6 8/8] linux-user: Add support for FDSETEMSGTRESH, FDSETMAXERRS, and FDGETMAXERRS ioctls
Date: Tue, 10 Sep 2019 21:24:22 +0200 [thread overview]
Message-ID: <96a8f78e-5b75-bd4d-4740-a736e35a4d77@vivier.eu> (raw)
In-Reply-To: <CAL1e-=hT6_gDa1U5jC=0HCRo37PR44zBxXH3OU8=XF6pEE=ofA@mail.gmail.com>
Le 10/09/2019 à 21:15, Aleksandar Markovic a écrit :
>
> 10.09.2019. 20.58, aleksandar.m.mail@gmail.com
> <mailto:aleksandar.m.mail@gmail.com> је написао/ла:
>>
>>
>> 06.09.2019. 12.47, "Laurent Vivier" <laurent@vivier.eu
> <mailto:laurent@vivier.eu>> је написао/ла:
>> >
>> > Le 04/09/2019 à 14:59, Aleksandar Markovic a écrit :
>> > > From: Aleksandar Markovic <amarkovic@wavecomp.com
> <mailto:amarkovic@wavecomp.com>>
>> > >
>> > > FDSETEMSGTRESH, FDSETMAXERRS, and FDGETMAXERRS ioctls are commands
>> > > for controlling error reporting of a floppy drive.
>> > >
>> > > Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com
> <mailto:amarkovic@wavecomp.com>>
>> > > ---
>> > > linux-user/ioctls.h | 2 ++
>> > > linux-user/syscall_defs.h | 19 +++++++++++++++++++
>> > > linux-user/syscall_types.h | 7 +++++++
>> > > 3 files changed, 28 insertions(+)
>> > >
>> > > diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
>> > > index 622874b..0c75d03 100644
>> > > --- a/linux-user/ioctls.h
>> > > +++ b/linux-user/ioctls.h
>> > > @@ -118,6 +118,8 @@
>> > > IOCTL(FDFMTTRK, IOC_W, MK_PTR(MK_STRUCT(STRUCT_format_descr)))
>> > > IOCTL(FDFMTEND, 0, TYPE_NULL)
>> > > IOCTL(FDFLUSH, 0, TYPE_NULL)
>> > > + IOCTL(FDSETMAXERRS, IOC_W,
> MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
>> > > + IOCTL(FDGETMAXERRS, IOC_R,
> MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
>> >
>> > where is FDSETEMSGTRESH?
>> >
>> > > IOCTL(FDRESET, 0, TYPE_NULL)
>> > > IOCTL(FDRAWCMD, 0, TYPE_NULL)
>> > > IOCTL(FDTWADDLE, 0, TYPE_NULL)
>> > > diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
>> > > index 834a085..7c5b614 100644
>> > > --- a/linux-user/syscall_defs.h
>> > > +++ b/linux-user/syscall_defs.h
>> > > @@ -890,12 +890,31 @@ struct target_pollfd {
>> > >
>> > > /* From <linux/fd.h> */
>> > >
>> > > +struct target_floppy_max_errors {
>> > > + abi_uint abort;
>> > > + abi_uint read_track;
>> > > + abi_uint reset;
>> > > + abi_uint recal;
>> > > + abi_uint reporting;
>> > > +};
>> >
>> > You don't need this, you can use floppy_max_errors from <linux/fd.h>.
>> >
>> > But you can define it if you want because it is used to know the size of
>> > the target structure (and if alignment or data types differ it can
>> > mismatch. With "int" it's not the case).
>> >
>>
>> Laurent, thanks for the review, I'll correct this in the next version.
>>
>> Just a follow-up question:
>>
>> If the structure of related to a (not-yet-supported in QEMU) ioctl was:
>>
>> struct hd_geometry {
>> unsigned char heads;
>> unsigned char sectors;
>> unsigned short cylinders;
>> unsigned long start;
>> };
>>
>> ... would "target_hd_geometry" be needed, or not?
>>
>
> Actually, that ioctl is already implemented in QEMU (HDIO_GETGEO),
> without defining target_hd_geometry. Is this fine?
No, for instance you can check it:
#include <stdio.h>
#include <stddef.h>
#include <linux/hdreg.h>
int main(void)
{
printf("heads %zd\n", offsetof(struct hd_geometry, heads));
printf("sectors %zd\n", offsetof(struct hd_geometry, sectors));
printf("cylinders %zd\n", offsetof(struct hd_geometry, cylinders));
printf("start %zd\n", offsetof(struct hd_geometry, start));
}
$ cc -o test_align test_align.c
on i386:
$ ./test_align
heads 0
sectors 1
cylinders 2
start 4
on x86_64:
$ ./test_align
heads 0
sectors 1
cylinders 2
start 8
Thanks,
Laurent
next prev parent reply other threads:[~2019-09-10 19:25 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-04 12:59 [Qemu-devel] [PATCH v6 0/8] linux-user: Misc patches for 4.2 Aleksandar Markovic
2019-09-04 12:59 ` [Qemu-devel] [PATCH v6 1/8] linux-user: Add support for semtimedop() syscall Aleksandar Markovic
2019-09-04 13:16 ` Aleksandar Markovic
2019-09-06 9:59 ` Laurent Vivier
2019-09-04 12:59 ` [Qemu-devel] [PATCH v6 2/8] linux-user: Add support for RNDRESEEDCRNG ioctl Aleksandar Markovic
2019-09-10 8:33 ` Laurent Vivier
2019-09-04 12:59 ` [Qemu-devel] [PATCH v6 3/8] linux-user: Add support for FIOGETOWN and FIOSETOWN ioctls Aleksandar Markovic
2019-09-06 10:18 ` Laurent Vivier
2019-09-10 8:34 ` Laurent Vivier
2019-09-10 10:00 ` Aleksandar Markovic
2019-09-04 12:59 ` [Qemu-devel] [PATCH v6 4/8] linux user: Add support for FDFLUSH ioctl Aleksandar Markovic
2019-09-10 8:39 ` Laurent Vivier
2019-09-04 12:59 ` [Qemu-devel] [PATCH v6 5/8] linux-user: Add support for FDMSGON and FDMSGOFF ioctls Aleksandar Markovic
2019-09-06 10:20 ` Laurent Vivier
2019-09-10 8:41 ` Laurent Vivier
2019-09-04 12:59 ` [Qemu-devel] [PATCH v6 6/8] linux-user: Add support for FDRESET, FDRAWCMD, FDTWADDLE, and FDEJECT ioctls Aleksandar Markovic
2019-09-06 10:21 ` Laurent Vivier
2019-09-10 8:42 ` Laurent Vivier
2019-09-04 12:59 ` [Qemu-devel] [PATCH v6 7/8] linux-user: Add support for FDFMTBEG, FDFMTTRK, and FDFMTEND ioctls Aleksandar Markovic
2019-09-06 10:30 ` Laurent Vivier
2019-09-06 10:38 ` Laurent Vivier
2019-09-04 12:59 ` [Qemu-devel] [PATCH v6 8/8] linux-user: Add support for FDSETEMSGTRESH, FDSETMAXERRS, and FDGETMAXERRS ioctls Aleksandar Markovic
2019-09-06 10:47 ` Laurent Vivier
2019-09-10 18:59 ` Aleksandar Markovic
2019-09-10 19:15 ` Aleksandar Markovic
2019-09-10 19:24 ` Laurent Vivier [this message]
2019-09-10 19:15 ` Laurent Vivier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=96a8f78e-5b75-bd4d-4740-a736e35a4d77@vivier.eu \
--to=laurent@vivier.eu \
--cc=aleksandar.m.mail@gmail.com \
--cc=aleksandar.markovic@rt-rk.com \
--cc=amarkovic@wavecomp.com \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).