Commit 37b54aed authored by Daniel T. Lee's avatar Daniel T. Lee Committed by Daniel Borkmann

samples/bpf: fix a couple of style issues in bpf_load

This commit fixes a few style problems in samples/bpf/bpf_load.c:

 - Magic string use of 'DEBUGFS'
 - Useless zero initialization of a global variable
 - Minor style fix with whitespace
Signed-off-by: default avatarDaniel T. Lee <danieltimlee@gmail.com>
Acked-by: default avatarYonghong Song <yhs@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 486d3f22
...@@ -40,7 +40,7 @@ int prog_cnt; ...@@ -40,7 +40,7 @@ int prog_cnt;
int prog_array_fd = -1; int prog_array_fd = -1;
struct bpf_map_data map_data[MAX_MAPS]; struct bpf_map_data map_data[MAX_MAPS];
int map_data_count = 0; int map_data_count;
static int populate_prog_array(const char *event, int prog_fd) static int populate_prog_array(const char *event, int prog_fd)
{ {
...@@ -65,7 +65,7 @@ static int write_kprobe_events(const char *val) ...@@ -65,7 +65,7 @@ static int write_kprobe_events(const char *val)
else else
flags = O_WRONLY | O_APPEND; flags = O_WRONLY | O_APPEND;
fd = open("/sys/kernel/debug/tracing/kprobe_events", flags); fd = open(DEBUGFS "kprobe_events", flags);
ret = write(fd, val, strlen(val)); ret = write(fd, val, strlen(val));
close(fd); close(fd);
...@@ -490,8 +490,8 @@ static int load_elf_maps_section(struct bpf_map_data *maps, int maps_shndx, ...@@ -490,8 +490,8 @@ static int load_elf_maps_section(struct bpf_map_data *maps, int maps_shndx,
/* Verify no newer features were requested */ /* Verify no newer features were requested */
if (validate_zero) { if (validate_zero) {
addr = (unsigned char*) def + map_sz_copy; addr = (unsigned char *) def + map_sz_copy;
end = (unsigned char*) def + map_sz_elf; end = (unsigned char *) def + map_sz_elf;
for (; addr < end; addr++) { for (; addr < end; addr++) {
if (*addr != 0) { if (*addr != 0) {
free(sym); free(sym);
......
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