~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/bpf/bpftool/netlink_dumper.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
  2 // Copyright (C) 2018 Facebook
  3 
  4 #ifndef _NETLINK_DUMPER_H_
  5 #define _NETLINK_DUMPER_H_
  6 
  7 #define NET_START_OBJECT                                \
  8 {                                                       \
  9         if (json_output)                                \
 10                 jsonw_start_object(json_wtr);           \
 11 }
 12 
 13 #define NET_START_OBJECT_NESTED(name)                   \
 14 {                                                       \
 15         if (json_output) {                              \
 16                 jsonw_name(json_wtr, name);             \
 17                 jsonw_start_object(json_wtr);           \
 18         } else {                                        \
 19                 fprintf(stdout, "%s {", name);          \
 20         }                                               \
 21 }
 22 
 23 #define NET_START_OBJECT_NESTED2                        \
 24 {                                                       \
 25         if (json_output)                                \
 26                 jsonw_start_object(json_wtr);           \
 27         else                                            \
 28                 fprintf(stdout, "{");                   \
 29 }
 30 
 31 #define NET_END_OBJECT_NESTED                           \
 32 {                                                       \
 33         if (json_output)                                \
 34                 jsonw_end_object(json_wtr);             \
 35         else                                            \
 36                 fprintf(stdout, "}");                   \
 37 }
 38 
 39 #define NET_END_OBJECT                                  \
 40 {                                                       \
 41         if (json_output)                                \
 42                 jsonw_end_object(json_wtr);             \
 43 }
 44 
 45 #define NET_END_OBJECT_FINAL                            \
 46 {                                                       \
 47         if (json_output)                                \
 48                 jsonw_end_object(json_wtr);             \
 49         else                                            \
 50                 fprintf(stdout, "\n");                  \
 51 }
 52 
 53 #define NET_START_ARRAY(name, fmt_str)                  \
 54 {                                                       \
 55         if (json_output) {                              \
 56                 jsonw_name(json_wtr, name);             \
 57                 jsonw_start_array(json_wtr);            \
 58         } else {                                        \
 59                 fprintf(stdout, fmt_str, name);         \
 60         }                                               \
 61 }
 62 
 63 #define NET_END_ARRAY(endstr)                           \
 64 {                                                       \
 65         if (json_output)                                \
 66                 jsonw_end_array(json_wtr);              \
 67         else                                            \
 68                 fprintf(stdout, "%s", endstr);          \
 69 }
 70 
 71 #define NET_DUMP_UINT(name, fmt_str, val)               \
 72 {                                                       \
 73         if (json_output)                                \
 74                 jsonw_uint_field(json_wtr, name, val);  \
 75         else                                            \
 76                 fprintf(stdout, fmt_str, val);          \
 77 }
 78 
 79 #define NET_DUMP_UINT_ONLY(str)                         \
 80 {                                                       \
 81         if (json_output)                                \
 82                 jsonw_uint(json_wtr, str);              \
 83         else                                            \
 84                 fprintf(stdout, "%u ", str);            \
 85 }
 86 
 87 #define NET_DUMP_STR(name, fmt_str, str)                \
 88 {                                                       \
 89         if (json_output)                                \
 90                 jsonw_string_field(json_wtr, name, str);\
 91         else                                            \
 92                 fprintf(stdout, fmt_str, str);          \
 93 }
 94 
 95 #define NET_DUMP_STR_ONLY(str)                          \
 96 {                                                       \
 97         if (json_output)                                \
 98                 jsonw_string(json_wtr, str);            \
 99         else                                            \
100                 fprintf(stdout, "%s ", str);            \
101 }
102 
103 #endif
104 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php