[PATCH strace] Implement decoding of RXRPC_* control messages
Dmitry V. Levin
ldv at strace.io
Tue May 9 08:00:42 UTC 2023
Hi,
On Fri, May 05, 2023 at 02:57:15PM +0100, David Howells wrote:
[...]
> @@ -212,6 +233,25 @@ print_cmsg_ip_origdstaddr(struct tcb *tcp, const void *cmsg_data,
> print_sockaddr(tcp, cmsg_data, addr_len);
> }
>
> +static void
> +print_cmsg_rxrpc_user_call_id(struct tcb *tcp, const void *cmsg_data,
> + const unsigned int data_len)
> +{
> + const unsigned int *p = cmsg_data;
> +
> + /* Size is "unsigned long" but we might be stracing a 32-bit program
> + * from a 64-bit strace or vice versa.
> + */
> + if (data_len == 4)
> + print_local_array_ex(tcp, p, 1, 4,
> + print_xint_array_member, NULL, 0, NULL, NULL);
> + else if (data_len == 8)
> + print_local_array_ex(tcp, p, 1, 8,
> + print_xint_array_member, NULL, 0, NULL, NULL);
> + else
> + print_cmsg_xint(tcp, cmsg_data, data_len);
> +}
> +
I suppose a switch statement would be more concise in this case.
> diff --git a/src/xlat/rxrpc_cmsg_types.in b/src/xlat/rxrpc_cmsg_types.in
> new file mode 100644
> index 000000000..7e045b5a6
> --- /dev/null
> +++ b/src/xlat/rxrpc_cmsg_types.in
> @@ -0,0 +1,12 @@
> +RXRPC_USER_CALL_ID 1
> +RXRPC_ABORT 2
> +RXRPC_ACK 3
> +RXRPC_NET_ERROR 5
> +RXRPC_BUSY 6
> +RXRPC_LOCAL_ERROR 7
> +RXRPC_NEW_CALL 8
> +RXRPC_EXCLUSIVE_CALL 10
> +RXRPC_UPGRADE_SERVICE 11
> +RXRPC_TX_LENGTH 12
> +RXRPC_SET_CALL_TIMEOUT 13
> +RXRPC_CHARGE_ACCEPT 14
Looks like this table would benefit from #value_indexed.
By the way, would it make sense to list RXRPC_ACCEPT here as well, even
though it was removed from the kernel by commit v4.9-rc1~127^2~247^2?
And the last but not least, do you have any ideas how this new decoder
could be tested?
--
ldv
More information about the Strace-devel
mailing list