[PATCH bpf-next v2 0/3] bpf: btf: print bpftool map data with btf

From: Okash Khawaja
Date: Mon Jul 02 2018 - 15:16:28 EST


Hi,

This is v2. There are two key changes which mostly affect patches 2 and 3.
First, we have two BTF outputs:

1. when -j or -p switches are supplied to a map command - this is json- and
backward- compatible
2. when neither of -j and -p is supplied - this makes no promises on json- or
backward- compatibility, and aimed for humans

Second, in addition to map dump command, map lookup command has also been
updated to print data with btf. The rules around -j and -p are same as above.

Here is a summary of changes in v2:

patch 1:
- line continuation alignment fixes + other style fixes

patch 2:
- introduce struct btf_dumper which contains context for btf_dumper operation
- line continuation alignment fixes + other style fixes
- fix SPDX licence comment style to be C++ style
- reverse christmas tree style comments
- in btf_dumper_array() ensure we end json_writer array in case of error

patch 3:
- btf output for humans is shown when neither -j nor -p is supplied
- when -j or -p are supplied, augment output with "formatted" object which shows btf data in json
- added btf output to map lookup command also
- declarations to follow reverse christmas tree style
- error message grammar fix and remove full stop
- line continuation alignment fixes + other style fixes
- reorganise do_dump_btf() to remove goto and make it clearer
- remove misleading comment about end of root json object
- add comment to explain allocation btf buffer
- brackets around else clause to harmonise with braces on if clause

Thanks,
Okash