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 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/20260429-ioctl-v2-0-288639bc2427@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
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,
--
Warner Losh <imp@bsdimp.com>