make tcpdrop and zfsslower python3 compatible (#1817)
Make the input string of get_kprobe_functions as
bytes literal in tcpdrop and zfsslower so the
tool can be python3 compatible.
Signed-off-by: Yonghong Song <yhs@fb.com>
diff --git a/tools/zfsslower.py b/tools/zfsslower.py
index 5e1c328..8e1a0de 100755
--- a/tools/zfsslower.py
+++ b/tools/zfsslower.py
@@ -276,10 +276,10 @@
b = BPF(text=bpf_text)
# common file functions
-if BPF.get_kprobe_functions('zpl_iter'):
+if BPF.get_kprobe_functions(b'zpl_iter'):
b.attach_kprobe(event="zpl_iter_read", fn_name="trace_rw_entry")
b.attach_kprobe(event="zpl_iter_write", fn_name="trace_rw_entry")
-elif BPF.get_kprobe_functions('zpl_aio'):
+elif BPF.get_kprobe_functions(b'zpl_aio'):
b.attach_kprobe(event="zpl_aio_read", fn_name="trace_rw_entry")
b.attach_kprobe(event="zpl_aio_write", fn_name="trace_rw_entry")
else:
@@ -287,10 +287,10 @@
b.attach_kprobe(event="zpl_write", fn_name="trace_rw_entry")
b.attach_kprobe(event="zpl_open", fn_name="trace_open_entry")
b.attach_kprobe(event="zpl_fsync", fn_name="trace_fsync_entry")
-if BPF.get_kprobe_functions('zpl_iter'):
+if BPF.get_kprobe_functions(b'zpl_iter'):
b.attach_kretprobe(event="zpl_iter_read", fn_name="trace_read_return")
b.attach_kretprobe(event="zpl_iter_write", fn_name="trace_write_return")
-elif BPF.get_kprobe_functions('zpl_aio'):
+elif BPF.get_kprobe_functions(b'zpl_aio'):
b.attach_kretprobe(event="zpl_aio_read", fn_name="trace_read_return")
b.attach_kretprobe(event="zpl_aio_write", fn_name="trace_write_return")
else: