Ignore warnings about overridden initialization of hwaddr_sizes
As hwaddr_sizes array is explicitly initialized this way,
ignore potential warnings reported by gcc -Woverride-init
and clang -Winitializer-overrides.
* gcc_compat.h (CLANG_PREREQ): New macro.
(DIAG_PUSH_IGNORE_OVERRIDE_INIT, DIAG_POP_IGNORE_OVERRIDE_INIT): New
macros non-trivially defined for gcc >= 4.2 and clang >= 2.8.
* sock.c (print_ifreq): Use them to ignore warnings about overridden
initialization of hwaddr_sizes array.
* tests/execve.c (main): Explicitly mark q_envp variable as used
to workaround clang -Wunneeded-internal-declaration bug.
* tests/execveat.c (main): Likewise.
* tests/nsyscalls.c (main): Explicitly mark syscallent variable as used
to workaround clang -Wunneeded-internal-declaration bug.
* xlat/af_packet_versions.in: New file.
* netlink_packet_diag.c: Include "xlat/af_packet_versions.h".
(decode_packet_diag_req): sdiag_protocol shouldn't be decoded as a protocol,
currently it should be set to 0.
(decode_packet_diag_info): Decode pdi_version field using af_packet_versions
xlat; decode pdi_index field as an interface index.
(packet_diag_msg_nla_decoders) <PACKET_DIAG_UID>: Decode using
decode_nla_uid.
(decode_packet_diag_msg): Decode pdiag_num as an low-level protocol.
* tests/netlink_sock_diag.c: Update expected output.
* tests/nlattr_packet_diag_msg.c: Likewise.
sockaddr: add X.25 socket address decoding support
* sockaddr.c: Include <linux/x25.h>.
(print_sockaddr_data_x25): New function.
(sa_printers) <[AF_X25]>: New socket address handler.
* tests/net-sockaddr.c (check_x25): New function.
(main): Use it to check X.25 socket address decoding.
net: add support for AX.25 protocols and socket option names decoding
* xlat/ax25_protocols.in: New file.
* xlat/sock_ax25_options.in: Likewise.
* net.c: Include "xlat/ax25_protocols.h" and "xlat/sock_ax25_options.h".
* (SYS_FUNC(socket)): <[AF_AX25]>: Print protocol name using
ax25_protocols xlat.
(print_sockopt_fd_level_name) <[SOL_AX25]>: Print socket option name
using sock_ax25_options xlat.
* defs.h (print_ax25_addr): New prototype.
* print_fields.h (PRINT_FIELD_AX25_ADDR): New macro.
* sockaddr.c: Include <linux/ax25.h>.
(check_ax25_address, ax25_addr2str, print_ax25_addr_raw,
print_ax25_addr, print_sockaddr_data_ax25): New functions.
(sa_printers) <[AF_AX25]>: New printer.
* tests/net-sockaddr.c (AX25_ADDR): New macro.
(check_ax25): New function.
(main): Use it to check AX.25 socket address decoding.
In order to be able to obtain sanitised device name internally.
* defs.h (get_ifname): New declaration.
* print_ifindex.c (get_ifname): Refactor, leaving out addition
of if_nametoindex("") part.
(sprint_ifname): New function, adds if_nametoindex("")
to get_ifname's output.
(print_ifindex): Use sprint_ifname instead of get_ifname.
socketutils: store more information in protocols table
This also allows getting rid of all these *_v[46]_get calls.
* socketutils.c (unix_get, inet_get, netlink_gen): Add family, protocol,
and proto_name paramteres, use them where appropriate.
(tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Remove.
(protocols): Add family and proto fields to the structure, call inet_get
for IP/IPv6 protocols.
(get_sockaddr_by_inode_uncached): Update protocols->get calls.
netlink: honor custom xlat style setting during nlmsg flags printing
Commit v4.23~343 introduced xlat style argument to printflags_ex, but
XLAT_STYLE_DEFAULT was introduced only in the next commit v4.23~342,
which led to missing out fixing the sole external user of this
peculiar extended interface.
* netlink.c (decode_nlmsg_flags): Use XLAT_STYLE_DEFAULT instead of
XLAT_STYLE_ABBREV in printflags_ex call.
xlat: add ability to specify a default string to print_xlat_ex
In order to avoid dealing with xlat verbosity styles outside xlat code
as much as possible.
* defs.h (xlat_style_private_flag_bits): Rename from
print_array_flag_bits, add PXF_DEFAULT_STR_BIT.
(xlat_style_private_flags): Rename from print_array_flags, add
FLAG_(PXF_DEFAULT_STR).
* xlat.c (print_xlat_ex): Handle PXF_DEFAULT_STR by interpreting str
as a default value (print both value and str in XLAT_STYLE_ABBREV).
netlink_smc_diag: decode SMC_DIAG_SHUTDOWN attribute value
* xlat/sock_shutdown_flags.in: New file.
* netlink_smc_diag.c: Include "xlat/sock_shutdown_flags.h".
(decode_smc_diag_shutdown): New function.
(smc_diag_msg_nla_decoders) <[SMC_DIAG_SHUTDOWN]>: Use
decode_smc_diag_shutdown.
* tests/nlattr_smc_diag_msg.c: Add checks for SMC_DIAG_SHUTDOWN.
xlat: add BPF_PROG_TYPE_SK_REUSEPORT to bpf_prog_types.in
* xlat/bpf_prog_types.in (BPF_PROG_TYPE_SK_REUSEPORT): New constant,
introduced by Linux commit v4.19-rc1~140^2~24^2~2^2~5.
* tests/bpf.c: Update expected output.
* xlat/bpf_map_types.in (BPF_MAP_TYPE_CGROUP_STORAGE): New constant,
introduced by Linux commit v4.19-rc1~140^2~108^2~3^2~12.
(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY): New constant, introduced by Linux
commit v4.19-rc1~140^2~24^2~2^2~6.
* tests/bpf.c: Update expected output.
netlink_smc_diag: add SMC_DIAG_FALLBACK attribute support
Introduced by Linux commit v4.19-rc1~140^2~253^2~1.
* linux/smc_diag.h (SMC_DIAG_FALLBACK): New enumeration item.
(struct smc_diag_fallback): New type definition.
* netlink_smc_diag.c: Include "xlat/smc_decl_codes.h".
(decode_smc_diag_fallback): New function.
(smc_diag_msg_nla_decoders) <[SMC_DIAG_FALLBACK]>: New decoder, calls
decode_smc_diag_fallback.
* tests/nlattr_smc_diag_msg.c: Add checks for SMC_DIAG_FALLBACK
attribute decoding.
* xlat/smc_decl_codes.in: New file.
* xlat/smc_diag_attrs.in (SMC_DIAG_FALLBACK): New constant.
* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_FWHT): New constant, introduced by
Linux commit v4.19-rc1~137^2~221.
(V4L2_PIX_FMT_SBGGR14P, V4L2_PIX_FMT_SGBRG14P, V4L2_PIX_FMT_SGRBG14P,
V4L2_PIX_FMT_SRGGB14P): New constants, introduced by Linux commit
v4.19-rc1~137^2~97.
(V4L2_PIX_FMT_Y10P): New constant, introduced by Linux commit
v4.19-rc1~137^2~95.
* xlat/nt_descriptor_types.in (NT_VMCOREDD): New named constant,
introduced by Linux commit v4.18-rc1~114^2~252^2~2.
(NT_MIPS_DSP): New named constant, introduced by Linux commit
v4.19-rc1~42^2~63.
(NT_MIPS_FP_MODE): New named constant, introduced by Linux commit
v4.19-rc1~42^2~62.
rtnl_link: decode named constants for IFLA_XDP_ATTACHED attribute value
* xlat/rtnl_ifla_xdp_attached_mode.in: New file.
* rtnl_link.c: Include "xlat/rtnl_ifla_xdp_attached_mode.h".
(decode_ifla_xdp_attached): New function.
(ifla_xdp_nla_decoders) <[IFLA_XDP_ATTACHED]>: Use
decode_ifla_xdp_attached instead of decode_nla_u8.
* tests/nlattr_ifla_xdp.c: Add checks for IFLA_XDP_ATTACHED decoding.
Introduced by Linux commit v4.19-rc1~140^2~364^2~6^2~6.
* xlat/rtnl_ifla_xdp_attrs.in (IFLA_XDP_DRV_PROG_ID,
IFLA_XDP_SKB_PROG_ID, IFLA_XDP_HW_PROG_ID): New constants.
* rtnl_link.c (ifla_xdp_nla_decoders): Add decoders for
IFLA_XDP_DRV_PROG_ID, IFLA_XDP_SKB_PROG_ID, and IFLA_XDP_HW_PROG_ID.
* tests/nlattr_ifla_xdp.c: Add checks for new attributes.
* xlat/v4l2_control_ids.in (V4L2_CID_MPEG_VIDEO_VP8_PROFILE): Renamed
from V4L2_CID_MPEG_VIDEO_VPX_PROFILE (the latter is now a synonym),
by Linux commit v4.19-rc1~137^2~270.
(V4L2_CID_MPEG_VIDEO_VP9_PROFILE): New constant, introduced by Linux
commit v4.19-rc1~137^2~269.
As smc_diag.h is bundled, there is little sense to build AF_SMC support
conditionally.
* netlink_smc_diag.c [!AF_SMC]: Include xlat/addrfams.h under
XLAT_MACROS_ONLY, enable the rest of file.
* netlink_sock_diag.c: Include xlat/addrfams.h under XLAT_MACROS_ONLY.
(diag_decoders): Remove "ifdef AF_SMC" condition for [AF_SMC], reorder
in accordance with address family values.
* tests/nlattr_smc_diag_msg.c [!AF_SMC]: Define AF_SMC to 43, enable
the rest of test.
Dmitry V. Levin [Tue, 14 Aug 2018 13:43:34 +0000 (13:43 +0000)]
strace.c: introduce struct tcb_wait_data
Introduce a new structure to pass information between next_event(),
restart_delayed_tcb(), and dispatch_event().
This is going to be used by a subsequent change of next_event().
* strace.c (struct tcb_wait_data): New type.
(next_event): Remove parameters, return a pointer
to const struct tcb_wait_data. Return NULL instead of TE_BREAK.
(dispatch_event): Replace all parameters with a pointer
to const struct tcb_wait_data, obtain the trace event, siginfo,
and status from its fields.
(restart_delayed_tcb): Add local struct tcb_wait_data variable
with te field set to TE_RESTART, pass it to dispatch_event().
(main): Remove status and si variables, update next_event()
and dispatch_event() invocations.
Zhibin Li [Wed, 1 Aug 2018 09:53:57 +0000 (17:53 +0800)]
evdev: fix decoding of EVIOCGBIT(0, ...)
There is a comment in drivers/input/evdev.c which says:
/* EV_SYN==0 is EV_CNT, _not_ SYN_CNT, see EVIOCGBIT */
That is, EVIOCGBIT(0, ...) should return a bit mask with supported
event types instead of SYN_* event codes.
* defs.h (evdev_ev): New prototype.
* evdev.c: Include "xlat/evdev_ev.h" and remove "xlat/evdev_sync.h".
(bit_ioctl) <case EV_SYN>: Replace EV_SYN with 0, use evdev_ev
with XT_SORTED in decode_bitset invocation instead.
* ioctl.c: Do not include "xlat/evdev_ev.h".
(evdev_decode_number): Print nr == 0x20 as "0" instead of "EV_SYN".
* tests/ioctl_evdev.c (main): Use 0 instead of EV_SYN in EVIOCGBIT
output.
* xlat/evdev_sync.in: Remove.
Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org> Fixes: v4.10~89 "Add decoding for evdev ioctls"
* xlat/kvm_cap.in: New file.
* kvm.c: Include "xlat/kvm_cap.h".
(kvm_ioctl_decode_check_extension): New function.
(kvm_ioctl): Use it.
* tests/ioctl_kvm_run_common.c (main): Check decoding
of KVM_CHECK_EXTENSION command.
Signed-off-by: Pierre Marsais <pierre.marsais@lse.epita.fr>
Dmitry V. Levin [Sat, 18 Aug 2018 07:22:47 +0000 (07:22 +0000)]
xlat: workaround V4L2_CID_USER_IMX_BASE Linux kernel ABI breakage
Linux kernel commit v4.18-rc2-106-g421860b9d47053badce4b247576fa48df9ab4c48
has changed the value of V4L2_CID_USER_IMX_BASE constant introduced
by commit v4.13-rc1~141^2~121 because the old value was already used
by V4L2_CID_USER_MAX217X_BASE.
This is of course an ABI breakage that affects Linux kernels starting
with 4.13 and up to 4.18, as well as their LTS derivatives.
Since the imx driver didn't provide any public control ID definitions,
it looks like the best way to handle this situation is to pretend that
the old value of V4L2_CID_USER_IMX_BASE didn't exist.