pull out enums from main BPF class to avoid namespace collisions
authorDave Marchevsky <davemarchevsky@fb.com>
Wed, 16 Jun 2021 00:53:03 +0000 (17:53 -0700)
committeryonghong-song <ys114321@gmail.com>
Wed, 16 Jun 2021 06:33:55 +0000 (23:33 -0700)
commit2731825b9327a9a720f2ef92ed891ce0525a8dc3
tree08895d744c129baf8b76015da32d16b10222e6f0
parentdc1bceb8c891069745517cb2b444a8c4853e71ce
pull out enums from main BPF class to avoid namespace collisions

In #3479, the `bpf_attach_type` enum was pulled into the `BPF` class so
that its members could be used in `attach_func` and `detach_func`
functions introduced to the Python API.

Unfortunately this caused a redefinition of BPF.XDP, which was similarly
pulled in from `bpf_prog_type` enum, thus breaking program loading
(#3489).

Let's pull these enum- and flag-type class variables out into their own
wrapper classes. For backwards compatibility, keep them all (except for
`bpf_attach_type`, which was merged 2 days ago) defined in the BPF
class, but add a comment to not continue doing this.
docs/reference_guide.md
examples/networking/sockmap.py
src/python/bcc/__init__.py