mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
907b223651
Currently bpftool contains a mix of GPL-only and GPL or BSD2 licensed files. Make sure all files are dual licensed under GPLv2 and BSD-2-Clause. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Acked-by: Roman Gushchin <guro@fb.com> Acked-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Yonghong Song <yhs@fb.com> Acked-by: Stanislav Fomichev <sdf@google.com> Acked-by: Sean Young <sean@mess.org> Acked-by: Jiri Benc <jbenc@redhat.com> Acked-by: David Calavera <david.calavera@gmail.com> Acked-by: Andrey Ignatov <rdna@fb.com> Acked-by: Joe Stringer <joe@wand.net.nz> Acked-by: David Ahern <dsahern@gmail.com> Acked-by: Alexei Starovoitov <alexei.starovoitov@gmail.com> Acked-by: Petar Penkov <ppenkov@stanford.edu> Acked-by: Sandipan Das <sandipan@linux.ibm.com> Acked-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: John Fastabend <john.fastabend@gmail.com> Acked-by: Taeung Song <treeze.taeung@gmail.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Acked-by: Daniel Borkmann <daniel@iogearbox.net> CC: okash.khawaja@gmail.com Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
96 lines
1.8 KiB
C
96 lines
1.8 KiB
C
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
|
|
// Copyright (C) 2018 Facebook
|
|
|
|
#ifndef _NETLINK_DUMPER_H_
|
|
#define _NETLINK_DUMPER_H_
|
|
|
|
#define NET_START_OBJECT \
|
|
{ \
|
|
if (json_output) \
|
|
jsonw_start_object(json_wtr); \
|
|
}
|
|
|
|
#define NET_START_OBJECT_NESTED(name) \
|
|
{ \
|
|
if (json_output) { \
|
|
jsonw_name(json_wtr, name); \
|
|
jsonw_start_object(json_wtr); \
|
|
} else { \
|
|
fprintf(stdout, "%s {", name); \
|
|
} \
|
|
}
|
|
|
|
#define NET_START_OBJECT_NESTED2 \
|
|
{ \
|
|
if (json_output) \
|
|
jsonw_start_object(json_wtr); \
|
|
else \
|
|
fprintf(stdout, "{"); \
|
|
}
|
|
|
|
#define NET_END_OBJECT_NESTED \
|
|
{ \
|
|
if (json_output) \
|
|
jsonw_end_object(json_wtr); \
|
|
else \
|
|
fprintf(stdout, "}"); \
|
|
}
|
|
|
|
#define NET_END_OBJECT \
|
|
{ \
|
|
if (json_output) \
|
|
jsonw_end_object(json_wtr); \
|
|
}
|
|
|
|
#define NET_END_OBJECT_FINAL \
|
|
{ \
|
|
if (json_output) \
|
|
jsonw_end_object(json_wtr); \
|
|
else \
|
|
fprintf(stdout, "\n"); \
|
|
}
|
|
|
|
#define NET_START_ARRAY(name, fmt_str) \
|
|
{ \
|
|
if (json_output) { \
|
|
jsonw_name(json_wtr, name); \
|
|
jsonw_start_array(json_wtr); \
|
|
} else { \
|
|
fprintf(stdout, fmt_str, name); \
|
|
} \
|
|
}
|
|
|
|
#define NET_END_ARRAY(endstr) \
|
|
{ \
|
|
if (json_output) \
|
|
jsonw_end_array(json_wtr); \
|
|
else \
|
|
fprintf(stdout, "%s", endstr); \
|
|
}
|
|
|
|
#define NET_DUMP_UINT(name, fmt_str, val) \
|
|
{ \
|
|
if (json_output) \
|
|
jsonw_uint_field(json_wtr, name, val); \
|
|
else \
|
|
fprintf(stdout, fmt_str, val); \
|
|
}
|
|
|
|
#define NET_DUMP_STR(name, fmt_str, str) \
|
|
{ \
|
|
if (json_output) \
|
|
jsonw_string_field(json_wtr, name, str);\
|
|
else \
|
|
fprintf(stdout, fmt_str, str); \
|
|
}
|
|
|
|
#define NET_DUMP_STR_ONLY(str) \
|
|
{ \
|
|
if (json_output) \
|
|
jsonw_string(json_wtr, str); \
|
|
else \
|
|
fprintf(stdout, "%s ", str); \
|
|
}
|
|
|
|
#endif
|