Commit 3ba742e5 authored by Paul Chaignon's avatar Paul Chaignon

tools: Fix compilation error due to rewriter update

Since ad2d0d9f, the bcc rewriter is able to track more external
pointers going through maps.  xfsslower and zfsslower were relying on
the rewriter not being able to replace some dereferences.  This
commit takes this into account and removes two unnecessary calls to
bpf_probe_read.
parent b8fccc5f
...@@ -187,10 +187,7 @@ static int trace_return(struct pt_regs *ctx, int type) ...@@ -187,10 +187,7 @@ static int trace_return(struct pt_regs *ctx, int type)
bpf_get_current_comm(&data.task, sizeof(data.task)); bpf_get_current_comm(&data.task, sizeof(data.task));
// workaround (rewriter should handle file to d_name in one step): // workaround (rewriter should handle file to d_name in one step):
struct dentry *de = NULL; struct qstr qs = valp->fp->f_path.dentry->d_name;
struct qstr qs = {};
bpf_probe_read(&de, sizeof(de), &valp->fp->f_path.dentry);
bpf_probe_read(&qs, sizeof(qs), (void *)&de->d_name);
if (qs.len == 0) if (qs.len == 0)
return 0; return 0;
bpf_probe_read(&data.file, sizeof(data.file), (void *)qs.name); bpf_probe_read(&data.file, sizeof(data.file), (void *)qs.name);
......
...@@ -190,11 +190,7 @@ static int trace_return(struct pt_regs *ctx, int type) ...@@ -190,11 +190,7 @@ static int trace_return(struct pt_regs *ctx, int type)
data.offset = valp->offset; data.offset = valp->offset;
bpf_get_current_comm(&data.task, sizeof(data.task)); bpf_get_current_comm(&data.task, sizeof(data.task));
// workaround (rewriter should handle file to d_name in one step): struct qstr qs = valp->fp->f_path.dentry->d_name;
struct dentry *de = NULL;
struct qstr qs = {};
bpf_probe_read(&de, sizeof(de), &valp->fp->f_path.dentry);
bpf_probe_read(&qs, sizeof(qs), (void *)&de->d_name);
if (qs.len == 0) if (qs.len == 0)
return 0; return 0;
bpf_probe_read(&data.file, sizeof(data.file), (void *)qs.name); bpf_probe_read(&data.file, sizeof(data.file), (void *)qs.name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment