Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
aff52e6
Documentation
LICENSES
arch
block
certs
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
accounting
arch
bootconfig
bpf
bpftool
Documentation
bash-completion
skeleton
.gitignore
Makefile
btf.c
btf_dumper.c
cfg.c
cfg.h
cgroup.c
common.c
feature.c
gen.c
iter.c
jit_disasm.c
json_writer.c
json_writer.h
link.c
main.c
main.h
map.c
map_perf_ring.c
net.c
netlink_dumper.c
netlink_dumper.h
perf.c
pids.c
prog.c
struct_ops.c
tracelog.c
xlated_dumper.c
xlated_dumper.h
resolve_btfids
runqslower
.gitignore
Makefile
Makefile.helpers
bpf_asm.c
bpf_dbg.c
bpf_exp.l
bpf_exp.y
bpf_jit_disasm.c
build
cgroup
debugging
edid
firewire
firmware
gpio
hv
iio
include
io_uring
kvm
laptop
leds
lib
memory-model
nfsd
objtool
pci
pcmcia
perf
power
scripts
spi
testing
thermal
time
usb
virtio
vm
wmi
Makefile
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
tools
/
bpf
/
bpftool
/
json_writer.h
Blame
Blame
Latest commit
History
History
73 lines (60 loc) · 2.59 KB
Breadcrumbs
linux
/
tools
/
bpf
/
bpftool
/
json_writer.h
Top
File metadata and controls
Code
Blame
73 lines (60 loc) · 2.59 KB
Raw
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ /* * Simple streaming JSON writer * * This takes care of the annoying bits of JSON syntax like the commas * after elements * * Authors: Stephen Hemminger <stephen@networkplumber.org> */ #ifndef _JSON_WRITER_H_ #define _JSON_WRITER_H_ #include <stdbool.h> #include <stdint.h> #include <stdarg.h> #include <linux/compiler.h> /* Opaque class structure */ typedef struct json_writer json_writer_t; /* Create a new JSON stream */ json_writer_t *jsonw_new(FILE *f); /* End output to JSON stream */ void jsonw_destroy(json_writer_t **self_p); /* Cause output to have pretty whitespace */ void jsonw_pretty(json_writer_t *self, bool on); /* Reset separator to create new JSON */ void jsonw_reset(json_writer_t *self); /* Add property name */ void jsonw_name(json_writer_t *self, const char *name); /* Add value */ void __printf(2, 0) jsonw_vprintf_enquote(json_writer_t *self, const char *fmt, va_list ap); void __printf(2, 3) jsonw_printf(json_writer_t *self, const char *fmt, ...); void jsonw_string(json_writer_t *self, const char *value); void jsonw_bool(json_writer_t *self, bool value); void jsonw_float(json_writer_t *self, double number); void jsonw_float_fmt(json_writer_t *self, const char *fmt, double num); void jsonw_uint(json_writer_t *self, uint64_t number); void jsonw_hu(json_writer_t *self, unsigned short number); void jsonw_int(json_writer_t *self, int64_t number); void jsonw_null(json_writer_t *self); void jsonw_lluint(json_writer_t *self, unsigned long long int num); /* Useful Combinations of name and value */ void jsonw_string_field(json_writer_t *self, const char *prop, const char *val); void jsonw_bool_field(json_writer_t *self, const char *prop, bool value); void jsonw_float_field(json_writer_t *self, const char *prop, double num); void jsonw_uint_field(json_writer_t *self, const char *prop, uint64_t num); void jsonw_hu_field(json_writer_t *self, const char *prop, unsigned short num); void jsonw_int_field(json_writer_t *self, const char *prop, int64_t num); void jsonw_null_field(json_writer_t *self, const char *prop); void jsonw_lluint_field(json_writer_t *self, const char *prop, unsigned long long int num); void jsonw_float_field_fmt(json_writer_t *self, const char *prop, const char *fmt, double val); /* Collections */ void jsonw_start_object(json_writer_t *self); void jsonw_end_object(json_writer_t *self); void jsonw_start_array(json_writer_t *self); void jsonw_end_array(json_writer_t *self); /* Override default exception handling */ typedef void (jsonw_err_handler_fn)(const char *); #endif /* _JSON_WRITER_H_ */
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
You can’t perform that action at this time.