From: Eugene Syromyatnikov Date: Wed, 11 Apr 2018 11:53:54 +0000 (+0200) Subject: net: decode Bluetooth protocol names unconditionally X-Git-Tag: v4.23~203 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02114f254cd152e07f2b849877d6e003c463644a;p=strace net: decode Bluetooth protocol names unconditionally As we have all BTPROTO_* constant definitions now, there is no need to rely on bluetooth.h header anymore. * net.c (AF_BLUETOOTH): Provide a fallback definition. [HAVE_BLUETOOTH_BLUETOOTH_H]: Do not include . [!HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h". [!HAVE_BLUETOOTH_BLUETOOTH_H] (decode_sockbuf): Decode AF_BLUETOOTH. (decode_sockbuf) : Use printxval_index. * xlat/bt_protocols.in: Add "#value_indexed" directive. --- diff --git a/net.c b/net.c index d7267912..db47f65a 100644 --- a/net.c +++ b/net.c @@ -84,10 +84,10 @@ #include "xlat/inet_protocols.h" -#ifdef HAVE_BLUETOOTH_BLUETOOTH_H -# include -# include "xlat/bt_protocols.h" +#ifndef AF_BLUETOOTH +# define AF_BLUETOOTH 31 #endif +#include "xlat/bt_protocols.h" static void decode_sockbuf(struct tcb *const tcp, const int fd, const kernel_ulong_t addr, @@ -138,11 +138,9 @@ SYS_FUNC(socket) printxval(netlink_protocols, tcp->u_arg[2], "NETLINK_???"); break; -#ifdef HAVE_BLUETOOTH_BLUETOOTH_H case AF_BLUETOOTH: - printxval(bt_protocols, tcp->u_arg[2], "BTPROTO_???"); + printxval_index(bt_protocols, tcp->u_arg[2], "BTPROTO_???"); break; -#endif default: tprintf("%" PRI_klu, tcp->u_arg[2]); diff --git a/xlat/bt_protocols.in b/xlat/bt_protocols.in index 3401eaf7..a0ad0565 100644 --- a/xlat/bt_protocols.in +++ b/xlat/bt_protocols.in @@ -1,3 +1,4 @@ +#value_indexed BTPROTO_L2CAP 0 BTPROTO_HCI 1 BTPROTO_SCO 2