[PATCH v2 00/17] bsd-user: upstream ioctl

Warner Losh posted 17 patches 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260429-ioctl-v2-0-288639bc2427@bsdimp.com
Maintainers: Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>
There is a newer version of this series
bsd-user/bsd-ioctl.c                  | 438 ++++++++++++++++++++++++++++++++++
bsd-user/bsd-ioctl.h                  |  14 ++
bsd-user/freebsd/os-ioctl-cmds.h      | 151 ++++++++++++
bsd-user/freebsd/os-ioctl-cryptodev.h |  74 ++++++
bsd-user/freebsd/os-ioctl-disk.h      |  41 ++++
bsd-user/freebsd/os-ioctl-filio.h     |  34 +++
bsd-user/freebsd/os-ioctl-in6_var.h   | 217 +++++++++++++++++
bsd-user/freebsd/os-ioctl-sockio.h    | 240 +++++++++++++++++++
bsd-user/freebsd/os-ioctl-ttycom.h    | 237 ++++++++++++++++++
bsd-user/freebsd/os-ioctl-types.h     | 104 ++++++++
bsd-user/syscall_defs.h               |  10 +
11 files changed, 1560 insertions(+)
[PATCH v2 00/17] bsd-user: upstream ioctl
Posted by Warner Losh 1 month ago
Again with the help of claude, harvest the ioctl changes from
bsd-user blitz branch. These are a bit messy, since ioctls tend
to be a bit messy. Ideally, all this would be generated, but
that code isn't ready yet, so we go with what we have.

Please note: All style complaints are false positives. The > 80
character ones are fine: these files are semi-generated from upstream
and fixing them makes syncing harder. Harder syncing in code that's
basically boilerplate is worse than lines that are too long for
definitions people are never going to read.

The two errors:
● b64902a56387: bsd-user: Add bsd-ioctl.c infrastructure and termios conversion
  ● checkpatch.pl: 197: ERROR: Macros with complex values should be enclosed in parenthesis
  ● checkpatch.pl: 198: ERROR: Macros with complex values should be enclosed in parenthesis
are impossible to fix: they are what they need to be for the macro
tricks that are being used. One cannot add parenthesis and have correct
code.

This is largerly unchanged from v1, which didn't get any reviews.

Signed-off-by: Warner Losh <imp@bsdimp.com>
---
Changes in v2:
- rebase forward, minor tweaks for blitz branch evolution
- Link to v1: https://lore.kernel.org/qemu-devel/20260412-ioctl-v1-0-1d998a460560@bsdimp.com

---
Stacey D. Son (10):
      bsd-user: Add FreeBSD tty ioctl definitions
      bsd-user: Add FreeBSD file I/O ioctl definitions
      bsd-user: Add FreeBSD socket ioctl definitions
      bsd-user: Add FreeBSD cryptodev ioctl definitions
      bsd-user: Add FreeBSD disk ioctl definitions
      bsd-user: Add FreeBSD IPv6 ioctl definitions
      bsd-user: Add FreeBSD ioctl type definitions
      bsd-user: Add FreeBSD ioctl command table
      bsd-user: Add bsd-ioctl.h header
      bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h

Warner Losh (7):
      bsd-user: Add bsd-ioctl.c infrastructure and termios conversion
      bsd-user: Add log_unsupported_ioctl function
      bsd-user: Add do_ioctl_unsupported function
      bsd-user: Add target_to_host_sockaddr_in6 function
      bsd-user: Add do_ioctl_in6_ifreq_sockaddr_int function
      bsd-user: Add do_bsd_ioctl main function
      bsd-user: Add init_bsd_ioctl function

 bsd-user/bsd-ioctl.c                  | 438 ++++++++++++++++++++++++++++++++++
 bsd-user/bsd-ioctl.h                  |  14 ++
 bsd-user/freebsd/os-ioctl-cmds.h      | 151 ++++++++++++
 bsd-user/freebsd/os-ioctl-cryptodev.h |  74 ++++++
 bsd-user/freebsd/os-ioctl-disk.h      |  41 ++++
 bsd-user/freebsd/os-ioctl-filio.h     |  34 +++
 bsd-user/freebsd/os-ioctl-in6_var.h   | 217 +++++++++++++++++
 bsd-user/freebsd/os-ioctl-sockio.h    | 240 +++++++++++++++++++
 bsd-user/freebsd/os-ioctl-ttycom.h    | 237 ++++++++++++++++++
 bsd-user/freebsd/os-ioctl-types.h     | 104 ++++++++
 bsd-user/syscall_defs.h               |  10 +
 11 files changed, 1560 insertions(+)
---
base-commit: becd22fdc2a071783d9e04421526633772b3b98c
change-id: 20260411-ioctl-68c80a77ad32
prerequisite-change-id: 20260312-share-thunk-ab1585477999:v2
prerequisite-patch-id: a048e442d9dda7ee4ed1070ef5eb524e078b9a3b

Best regards,
-- 
Warner Losh <imp@bsdimp.com>


Re: [PATCH v2 00/17] bsd-user: upstream ioctl
Posted by Pierrick Bouvier 1 month ago
On 4/29/2026 7:45 AM, Warner Losh wrote:
> Again with the help of claude, harvest the ioctl changes from
> bsd-user blitz branch. These are a bit messy, since ioctls tend
> to be a bit messy. Ideally, all this would be generated, but
> that code isn't ready yet, so we go with what we have.
> 
> Please note: All style complaints are false positives. The > 80
> character ones are fine: these files are semi-generated from upstream
> and fixing them makes syncing harder. Harder syncing in code that's
> basically boilerplate is worse than lines that are too long for
> definitions people are never going to read.
> 
> The two errors:
> ● b64902a56387: bsd-user: Add bsd-ioctl.c infrastructure and termios conversion
>   ● checkpatch.pl: 197: ERROR: Macros with complex values should be enclosed in parenthesis
>   ● checkpatch.pl: 198: ERROR: Macros with complex values should be enclosed in parenthesis
> are impossible to fix: they are what they need to be for the macro
> tricks that are being used. One cannot add parenthesis and have correct
> code.
> 
> This is largerly unchanged from v1, which didn't get any reviews.
> 
> Signed-off-by: Warner Losh <imp@bsdimp.com>
> ---
> Changes in v2:
> - rebase forward, minor tweaks for blitz branch evolution
> - Link to v1: https://lore.kernel.org/qemu-devel/20260412-ioctl-v1-0-1d998a460560@bsdimp.com
> 
> ---
> Stacey D. Son (10):
>       bsd-user: Add FreeBSD tty ioctl definitions
>       bsd-user: Add FreeBSD file I/O ioctl definitions
>       bsd-user: Add FreeBSD socket ioctl definitions
>       bsd-user: Add FreeBSD cryptodev ioctl definitions
>       bsd-user: Add FreeBSD disk ioctl definitions
>       bsd-user: Add FreeBSD IPv6 ioctl definitions
>       bsd-user: Add FreeBSD ioctl type definitions
>       bsd-user: Add FreeBSD ioctl command table
>       bsd-user: Add bsd-ioctl.h header
>       bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h
> 
> Warner Losh (7):
>       bsd-user: Add bsd-ioctl.c infrastructure and termios conversion
>       bsd-user: Add log_unsupported_ioctl function
>       bsd-user: Add do_ioctl_unsupported function
>       bsd-user: Add target_to_host_sockaddr_in6 function
>       bsd-user: Add do_ioctl_in6_ifreq_sockaddr_int function
>       bsd-user: Add do_bsd_ioctl main function
>       bsd-user: Add init_bsd_ioctl function
> 
>  bsd-user/bsd-ioctl.c                  | 438 ++++++++++++++++++++++++++++++++++
>  bsd-user/bsd-ioctl.h                  |  14 ++
>  bsd-user/freebsd/os-ioctl-cmds.h      | 151 ++++++++++++
>  bsd-user/freebsd/os-ioctl-cryptodev.h |  74 ++++++
>  bsd-user/freebsd/os-ioctl-disk.h      |  41 ++++
>  bsd-user/freebsd/os-ioctl-filio.h     |  34 +++
>  bsd-user/freebsd/os-ioctl-in6_var.h   | 217 +++++++++++++++++
>  bsd-user/freebsd/os-ioctl-sockio.h    | 240 +++++++++++++++++++
>  bsd-user/freebsd/os-ioctl-ttycom.h    | 237 ++++++++++++++++++
>  bsd-user/freebsd/os-ioctl-types.h     | 104 ++++++++
>  bsd-user/syscall_defs.h               |  10 +
>  11 files changed, 1560 insertions(+)
> ---
> base-commit: becd22fdc2a071783d9e04421526633772b3b98c
> change-id: 20260411-ioctl-68c80a77ad32
> prerequisite-change-id: 20260312-share-thunk-ab1585477999:v2
> prerequisite-patch-id: a048e442d9dda7ee4ed1070ef5eb524e078b9a3b
> 
> Best regards,

Hi Warner,

a few checkpatch warnings:
https://github.com/p-b-o/qemu-ci/actions/runs/25116258138/job/73604077805

Regards,
Pierrick

Re: [PATCH v2 00/17] bsd-user: upstream ioctl
Posted by Warner Losh 1 month ago
On Wed, Apr 29, 2026 at 4:52 PM Pierrick Bouvier <
pierrick.bouvier@oss.qualcomm.com> wrote:

> On 4/29/2026 7:45 AM, Warner Losh wrote:
> > Again with the help of claude, harvest the ioctl changes from
> > bsd-user blitz branch. These are a bit messy, since ioctls tend
> > to be a bit messy. Ideally, all this would be generated, but
> > that code isn't ready yet, so we go with what we have.
> >
> > Please note: All style complaints are false positives. The > 80
> > character ones are fine: these files are semi-generated from upstream
> > and fixing them makes syncing harder. Harder syncing in code that's
> > basically boilerplate is worse than lines that are too long for
> > definitions people are never going to read.
> >
> > The two errors:
> > ● b64902a56387: bsd-user: Add bsd-ioctl.c infrastructure and termios
> conversion
> >   ● checkpatch.pl: 197: ERROR: Macros with complex values should be
> enclosed in parenthesis
> >   ● checkpatch.pl: 198: ERROR: Macros with complex values should be
> enclosed in parenthesis
> > are impossible to fix: they are what they need to be for the macro
> > tricks that are being used. One cannot add parenthesis and have correct
> > code.
> >
> > This is largerly unchanged from v1, which didn't get any reviews.
> >
> > Signed-off-by: Warner Losh <imp@bsdimp.com>
> > ---
> > Changes in v2:
> > - rebase forward, minor tweaks for blitz branch evolution
> > - Link to v1:
> https://lore.kernel.org/qemu-devel/20260412-ioctl-v1-0-1d998a460560@bsdimp.com
> >
> > ---
> > Stacey D. Son (10):
> >       bsd-user: Add FreeBSD tty ioctl definitions
> >       bsd-user: Add FreeBSD file I/O ioctl definitions
> >       bsd-user: Add FreeBSD socket ioctl definitions
> >       bsd-user: Add FreeBSD cryptodev ioctl definitions
> >       bsd-user: Add FreeBSD disk ioctl definitions
> >       bsd-user: Add FreeBSD IPv6 ioctl definitions
> >       bsd-user: Add FreeBSD ioctl type definitions
> >       bsd-user: Add FreeBSD ioctl command table
> >       bsd-user: Add bsd-ioctl.h header
> >       bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h
> >
> > Warner Losh (7):
> >       bsd-user: Add bsd-ioctl.c infrastructure and termios conversion
> >       bsd-user: Add log_unsupported_ioctl function
> >       bsd-user: Add do_ioctl_unsupported function
> >       bsd-user: Add target_to_host_sockaddr_in6 function
> >       bsd-user: Add do_ioctl_in6_ifreq_sockaddr_int function
> >       bsd-user: Add do_bsd_ioctl main function
> >       bsd-user: Add init_bsd_ioctl function
> >
> >  bsd-user/bsd-ioctl.c                  | 438
> ++++++++++++++++++++++++++++++++++
> >  bsd-user/bsd-ioctl.h                  |  14 ++
> >  bsd-user/freebsd/os-ioctl-cmds.h      | 151 ++++++++++++
> >  bsd-user/freebsd/os-ioctl-cryptodev.h |  74 ++++++
> >  bsd-user/freebsd/os-ioctl-disk.h      |  41 ++++
> >  bsd-user/freebsd/os-ioctl-filio.h     |  34 +++
> >  bsd-user/freebsd/os-ioctl-in6_var.h   | 217 +++++++++++++++++
> >  bsd-user/freebsd/os-ioctl-sockio.h    | 240 +++++++++++++++++++
> >  bsd-user/freebsd/os-ioctl-ttycom.h    | 237 ++++++++++++++++++
> >  bsd-user/freebsd/os-ioctl-types.h     | 104 ++++++++
> >  bsd-user/syscall_defs.h               |  10 +
> >  11 files changed, 1560 insertions(+)
> > ---
> > base-commit: becd22fdc2a071783d9e04421526633772b3b98c
> > change-id: 20260411-ioctl-68c80a77ad32
> > prerequisite-change-id: 20260312-share-thunk-ab1585477999:v2
> > prerequisite-patch-id: a048e442d9dda7ee4ed1070ef5eb524e078b9a3b
> >
> > Best regards,
>
> Hi Warner,
>
> a few checkpatch warnings:
> https://github.com/p-b-o/qemu-ci/actions/runs/25116258138/job/73604077805


There's two sets of warnings. The thunk.c warnings are irrelevant: thunk.c
is
a verbaitm copy of linux-user/thunk.c since that was how I was told to
share it.
It shows up in the CI as the first commit, but it's an already reviewed
patch. Those
won't be fixed because it's inefficnet to reformat code I'm verbatim
copying.
The inclusion of this patch is the series is an artifact of b4 and having
this
series be based on that prior series I've not put into a pull request yet.

The other warnings are documented in this message and are false positives.
The macros can't be written in any way other than how they are written.

Warner


>
> Regards,
> Pierrick
>
Re: [PATCH v2 00/17] bsd-user: upstream ioctl
Posted by Pierrick Bouvier 1 month ago
On 4/29/2026 7:14 PM, Warner Losh wrote:
> 
> 
> On Wed, Apr 29, 2026 at 4:52 PM Pierrick Bouvier
> <pierrick.bouvier@oss.qualcomm.com
> <mailto:pierrick.bouvier@oss.qualcomm.com>> wrote:
> 
>     On 4/29/2026 7:45 AM, Warner Losh wrote:
>     > Again with the help of claude, harvest the ioctl changes from
>     > bsd-user blitz branch. These are a bit messy, since ioctls tend
>     > to be a bit messy. Ideally, all this would be generated, but
>     > that code isn't ready yet, so we go with what we have.
>     >
>     > Please note: All style complaints are false positives. The > 80
>     > character ones are fine: these files are semi-generated from upstream
>     > and fixing them makes syncing harder. Harder syncing in code that's
>     > basically boilerplate is worse than lines that are too long for
>     > definitions people are never going to read.
>     >
>     > The two errors:
>     > ● b64902a56387: bsd-user: Add bsd-ioctl.c infrastructure and
>     termios conversion
>     >   ● checkpatch.pl <http://checkpatch.pl>: 197: ERROR: Macros with
>     complex values should be enclosed in parenthesis
>     >   ● checkpatch.pl <http://checkpatch.pl>: 198: ERROR: Macros with
>     complex values should be enclosed in parenthesis
>     > are impossible to fix: they are what they need to be for the macro
>     > tricks that are being used. One cannot add parenthesis and have
>     correct
>     > code.
>     >
>     > This is largerly unchanged from v1, which didn't get any reviews.
>     >
>     > Signed-off-by: Warner Losh <imp@bsdimp.com <mailto:imp@bsdimp.com>>
>     > ---
>     > Changes in v2:
>     > - rebase forward, minor tweaks for blitz branch evolution
>     > - Link to v1: https://lore.kernel.org/qemu-devel/20260412-ioctl-
>     v1-0-1d998a460560@bsdimp.com <https://lore.kernel.org/qemu-
>     devel/20260412-ioctl-v1-0-1d998a460560@bsdimp.com>
>     >
>     > ---
>     > Stacey D. Son (10):
>     >       bsd-user: Add FreeBSD tty ioctl definitions
>     >       bsd-user: Add FreeBSD file I/O ioctl definitions
>     >       bsd-user: Add FreeBSD socket ioctl definitions
>     >       bsd-user: Add FreeBSD cryptodev ioctl definitions
>     >       bsd-user: Add FreeBSD disk ioctl definitions
>     >       bsd-user: Add FreeBSD IPv6 ioctl definitions
>     >       bsd-user: Add FreeBSD ioctl type definitions
>     >       bsd-user: Add FreeBSD ioctl command table
>     >       bsd-user: Add bsd-ioctl.h header
>     >       bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h
>     >
>     > Warner Losh (7):
>     >       bsd-user: Add bsd-ioctl.c infrastructure and termios conversion
>     >       bsd-user: Add log_unsupported_ioctl function
>     >       bsd-user: Add do_ioctl_unsupported function
>     >       bsd-user: Add target_to_host_sockaddr_in6 function
>     >       bsd-user: Add do_ioctl_in6_ifreq_sockaddr_int function
>     >       bsd-user: Add do_bsd_ioctl main function
>     >       bsd-user: Add init_bsd_ioctl function
>     >
>     >  bsd-user/bsd-ioctl.c                  | 438 +++++++++++++++++++++
>     +++++++++++++
>     >  bsd-user/bsd-ioctl.h                  |  14 ++
>     >  bsd-user/freebsd/os-ioctl-cmds.h      | 151 ++++++++++++
>     >  bsd-user/freebsd/os-ioctl-cryptodev.h |  74 ++++++
>     >  bsd-user/freebsd/os-ioctl-disk.h      |  41 ++++
>     >  bsd-user/freebsd/os-ioctl-filio.h     |  34 +++
>     >  bsd-user/freebsd/os-ioctl-in6_var.h   | 217 +++++++++++++++++
>     >  bsd-user/freebsd/os-ioctl-sockio.h    | 240 +++++++++++++++++++
>     >  bsd-user/freebsd/os-ioctl-ttycom.h    | 237 ++++++++++++++++++
>     >  bsd-user/freebsd/os-ioctl-types.h     | 104 ++++++++
>     >  bsd-user/syscall_defs.h               |  10 +
>     >  11 files changed, 1560 insertions(+)
>     > ---
>     > base-commit: becd22fdc2a071783d9e04421526633772b3b98c
>     > change-id: 20260411-ioctl-68c80a77ad32
>     > prerequisite-change-id: 20260312-share-thunk-ab1585477999:v2
>     > prerequisite-patch-id: a048e442d9dda7ee4ed1070ef5eb524e078b9a3b
>     >
>     > Best regards,
> 
>     Hi Warner,
> 
>     a few checkpatch warnings:
>     https://github.com/p-b-o/qemu-ci/actions/runs/25116258138/
>     job/73604077805 <https://github.com/p-b-o/qemu-ci/actions/
>     runs/25116258138/job/73604077805>
> 
> 
> There's two sets of warnings. The thunk.c warnings are irrelevant:
> thunk.c is
> a verbaitm copy of linux-user/thunk.c since that was how I was told to
> share it.
> It shows up in the CI as the first commit, but it's an already reviewed
> patch. Those
> won't be fixed because it's inefficnet to reformat code I'm verbatim
> copying.
> The inclusion of this patch is the series is an artifact of b4 and
> having this
> series be based on that prior series I've not put into a pull request yet.
> 
> The other warnings are documented in this message and are false positives.
> The macros can't be written in any way other than how they are written.
>

Yep, I noted that.
And saw *after* that first commit was not from this series.

> Warner
>  
> 
> 
>     Regards,
>     Pierrick
> 


Re: [PATCH v2 00/17] bsd-user: upstream ioctl
Posted by Pierrick Bouvier 1 month ago
On 4/29/2026 3:52 PM, Pierrick Bouvier wrote:
> On 4/29/2026 7:45 AM, Warner Losh wrote:
>> Again with the help of claude, harvest the ioctl changes from
>> bsd-user blitz branch. These are a bit messy, since ioctls tend
>> to be a bit messy. Ideally, all this would be generated, but
>> that code isn't ready yet, so we go with what we have.
>>
>> Please note: All style complaints are false positives. The > 80
>> character ones are fine: these files are semi-generated from upstream
>> and fixing them makes syncing harder. Harder syncing in code that's
>> basically boilerplate is worse than lines that are too long for
>> definitions people are never going to read.
>>
>> The two errors:
>> ● b64902a56387: bsd-user: Add bsd-ioctl.c infrastructure and termios conversion
>>   ● checkpatch.pl: 197: ERROR: Macros with complex values should be enclosed in parenthesis
>>   ● checkpatch.pl: 198: ERROR: Macros with complex values should be enclosed in parenthesis
>> are impossible to fix: they are what they need to be for the macro
>> tricks that are being used. One cannot add parenthesis and have correct
>> code.
>>
>> This is largerly unchanged from v1, which didn't get any reviews.
>>
>> Signed-off-by: Warner Losh <imp@bsdimp.com>
>> ---
>> Changes in v2:
>> - rebase forward, minor tweaks for blitz branch evolution
>> - Link to v1: https://lore.kernel.org/qemu-devel/20260412-ioctl-v1-0-1d998a460560@bsdimp.com
>>
>> ---
>> Stacey D. Son (10):
>>       bsd-user: Add FreeBSD tty ioctl definitions
>>       bsd-user: Add FreeBSD file I/O ioctl definitions
>>       bsd-user: Add FreeBSD socket ioctl definitions
>>       bsd-user: Add FreeBSD cryptodev ioctl definitions
>>       bsd-user: Add FreeBSD disk ioctl definitions
>>       bsd-user: Add FreeBSD IPv6 ioctl definitions
>>       bsd-user: Add FreeBSD ioctl type definitions
>>       bsd-user: Add FreeBSD ioctl command table
>>       bsd-user: Add bsd-ioctl.h header
>>       bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.h
>>
>> Warner Losh (7):
>>       bsd-user: Add bsd-ioctl.c infrastructure and termios conversion
>>       bsd-user: Add log_unsupported_ioctl function
>>       bsd-user: Add do_ioctl_unsupported function
>>       bsd-user: Add target_to_host_sockaddr_in6 function
>>       bsd-user: Add do_ioctl_in6_ifreq_sockaddr_int function
>>       bsd-user: Add do_bsd_ioctl main function
>>       bsd-user: Add init_bsd_ioctl function
>>
>>  bsd-user/bsd-ioctl.c                  | 438 ++++++++++++++++++++++++++++++++++
>>  bsd-user/bsd-ioctl.h                  |  14 ++
>>  bsd-user/freebsd/os-ioctl-cmds.h      | 151 ++++++++++++
>>  bsd-user/freebsd/os-ioctl-cryptodev.h |  74 ++++++
>>  bsd-user/freebsd/os-ioctl-disk.h      |  41 ++++
>>  bsd-user/freebsd/os-ioctl-filio.h     |  34 +++
>>  bsd-user/freebsd/os-ioctl-in6_var.h   | 217 +++++++++++++++++
>>  bsd-user/freebsd/os-ioctl-sockio.h    | 240 +++++++++++++++++++
>>  bsd-user/freebsd/os-ioctl-ttycom.h    | 237 ++++++++++++++++++
>>  bsd-user/freebsd/os-ioctl-types.h     | 104 ++++++++
>>  bsd-user/syscall_defs.h               |  10 +
>>  11 files changed, 1560 insertions(+)
>> ---
>> base-commit: becd22fdc2a071783d9e04421526633772b3b98c
>> change-id: 20260411-ioctl-68c80a77ad32
>> prerequisite-change-id: 20260312-share-thunk-ab1585477999:v2
>> prerequisite-patch-id: a048e442d9dda7ee4ed1070ef5eb524e078b9a3b
>>
>> Best regards,
> 
> Hi Warner,
> 
> a few checkpatch warnings:
> https://github.com/p-b-o/qemu-ci/actions/runs/25116258138/job/73604077805
> 
> Regards,
> Pierrick

First commit seems to not belong to this series, but taken from
prerequisite-change-id. I didn't know b4 shazam would be follow, but
that's great and much more convenient than the custom Based-on tag QEMU
devs are used to.