Skip to content

bsd-user: upstream ioctl

Warner Losh qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected] change-id 20260411-ioctl-68c80a77ad32

Versions newest first

  1. v3 Latest19 patches 2 repliesIn review
  2. v217 patches 21 repliesSuperseded
  3. v117 patches 0 repliesSuperseded

Changes in v3 from the cover letter · 16 lines

- Fix numerous small errors in types found by claude code review:
- remove duplicate net/ethernet.h include
- remove duplicate TARGET_SIOCGVH definition
- fix lock_user issue in do_ioctl_in6_ifreq_sockaddr_int to copy it
- fix unlock_user issue in do_ioctl_in6_ifreq_sockaddr_int to use correct size
- remove duplicate TARGET_IFNAMSIZ definition
- Provide struct target_crypto_op
- Use abi types not native in several places (same size though)
- Fix logical error in ioctl encoding using TARGET_ forms if IF* constants
- Fix ieee80211req definition for ioctls to use SHROT instead of INT for int16 types
- fix lagg_reqport_lacp_opreq and lagg_reqall_lacp_opreq thunks to match structure def
- sync to latest freebsd and delete obsolete crypto
- Use abi_ types more consistently
- sync to latest disk ioctls
- Somehow foled all that into the same number of patches (since it just reflect blitz fixes and we don't need that history in qemu-project master).
- Link to v2: https://lore.kernel.org/qemu-devel/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19bsd-user: ioctl: add common definitionsbsd-user/freebsd/os-ioctl-ioccom.h+43 -01 reply
2/19bsd-user: Add FreeBSD tty ioctl definitionsbsd-user/freebsd/os-ioctl-ttycom.h+239 -00 replies
3/19bsd-user: Add FreeBSD file I/O ioctl definitionsbsd-user/freebsd/os-ioctl-filio.h+34 -00 replies
4/19bsd-user: Add FreeBSD socket ioctl definitionsbsd-user/freebsd/os-ioctl-sockio.h+246 -00 replies
5/19bsd-user: Add FreeBSD cryptodev ioctl definitionsbsd-user/freebsd/os-ioctl-cryptodev.h+84 -00 replies
6/19bsd-user: Add FreeBSD disk ioctl definitionsbsd-user/freebsd/os-ioctl-disk.h+52 -00 replies
7/19bsd-user: Add FreeBSD IPv6 ioctl definitionsbsd-user/freebsd/os-ioctl-in6_var.h+226 -00 replies
8/19bsd-user: Add FreeBSD ioctl type definitionsbsd-user/freebsd/os-ioctl-types.h+109 -00 replies
9/19bsd-user: Add FreeBSD ioctl command tablebsd-user/freebsd/os-ioctl-cmds.h+149 -00 replies
10/19bsd-user: Add bsd-ioctl.h headerbsd-user/bsd-ioctl.h+14 -00 replies
11/19bsd-user: Add target_sockaddr and safe_ioctl to syscall_defs.hbsd-user/syscall_defs.h+14 -00 replies
12/19bsd-user: Add bsd-ioctl.c infrastructure and termios conversionbsd-user/bsd-ioctl.c+219 -00 replies
13/19bsd-user: Add log_unsupported_ioctl functionbsd-user/bsd-ioctl.c+24 -00 replies
14/19bsd-user: Add do_ioctl_unsupported functionbsd-user/bsd-ioctl.c+8 -00 replies
15/19bsd-user: Add target_to_host_sockaddr_in6 functionbsd-user/bsd-ioctl.c+11 -00 replies
16/19bsd-user: Add do_ioctl_in6_ifreq_sockaddr_int functionbsd-user/bsd-ioctl.c+32 -00 replies
17/19bsd-user: Add do_bsd_ioctl main functionbsd-user/bsd-ioctl.c+100 -00 replies
18/19bsd-user: Add init_bsd_ioctl functionbsd-user/bsd-ioctl.c+42 -00 replies
19/19bsd-user: Add call to do_bsd_ioctl and add bsd-ioctl.c to the buildbsd-user/freebsd/os-syscall.c bsd-user/meson.build+10 -01 reply

Reviews trailers per patch

All 19 patches have a Reviewed-by or Acked-by.

PatchPierrick Bouvier
1/19R-b
2/19R-b
3/19R-b
4/19R-b
5/19R-b
6/19R-b
7/19R-b
8/19R-b
9/19R-b
10/19R-b
11/19R-b
12/19R-b
13/19R-b
14/19R-b
15/19R-b
16/19R-b
17/19R-b
18/19R-b
19/19R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 00/19] bsd-user: upstream ioctl

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.

---
Changes in v3:
- Fix numerous small errors in types found by claude code review:
- remove duplicate net/ethernet.h include
- remove duplicate TARGET_SIOCGVH definition
- fix lock_user issue in do_ioctl_in6_ifreq_sockaddr_int to copy it
- fix unlock_user issue in do_ioctl_in6_ifreq_sockaddr_int to use correct size
- remove duplicate TARGET_IFNAMSIZ definition
- Provide struct target_crypto_op
- Use abi types not native in several places (same size though)
- Fix logical error in ioctl encoding using TARGET_ forms if IF* constants
- Fix ieee80211req definition for ioctls to use SHROT instead of INT for int16 types
- fix lagg_reqport_lacp_opreq and lagg_reqall_lacp_opreq thunks to match structure def
- sync to latest freebsd and delete obsolete crypto
- Use abi_ types more consistently
- sync to latest disk ioctls
- Somehow foled all that into the same number of patches (since it just reflect blitz fixes and we don't need that history in qemu-project master).
- Link to v2: https://lore.kernel.org/qemu-devel/[email protected]

Changes in v2:
- rebase forward, minor tweaks for blitz branch evolution
- Link to v1: https://lore.kernel.org/qemu-devel/[email protected]

---
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

Stacey Son (1):
bsd-user: ioctl: add common definitions

Warner Losh (8):
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: Add call to do_bsd_ioctl and add bsd-ioctl.c to the build

 bsd-user/bsd-ioctl.c                  | 436 ++++++++++++++++++++++++++++++++++
 bsd-user/bsd-ioctl.h                  |  14 ++
 bsd-user/freebsd/os-ioctl-cmds.h      | 149 ++++++++++++
 bsd-user/freebsd/os-ioctl-cryptodev.h |  84 +++++++
 bsd-user/freebsd/os-ioctl-disk.h      |  52 ++++
 bsd-user/freebsd/os-ioctl-filio.h     |  34 +++
 bsd-user/freebsd/os-ioctl-in6_var.h   | 226 ++++++++++++++++++
 bsd-user/freebsd/os-ioctl-ioccom.h    |  43 ++++
 bsd-user/freebsd/os-ioctl-sockio.h    | 246 +++++++++++++++++++
 bsd-user/freebsd/os-ioctl-ttycom.h    | 239 +++++++++++++++++++
 bsd-user/freebsd/os-ioctl-types.h     | 109 +++++++++
 bsd-user/freebsd/os-syscall.c         |   9 +
 bsd-user/meson.build                  |   1 +
 bsd-user/syscall_defs.h               |  14 ++
 14 files changed, 1656 insertions(+)

---
base-commit: becd22fdc2a071783d9e04421526633772b3b98c
change-id: 20260411-ioctl-68c80a77ad32
prerequisite-change-id: 20260312-share-thunk-ab1585477999:v2
prerequisite-patch-id: a048e442d9dda7ee4ed1070ef5eb524e078b9a3b

Best regards,

Signature · 1 line
Warner Losh <[email protected]>