1 #define _GNU_SOURCE
2
3 #include <stdio.h>
4 #include <linux/bpf.h>
5 #include <unistd.h>
6 #include <bpf/bpf.h>
7 #include "bpf_load.h"
8
main(int argc,char ** argv)9 int main(int argc, char **argv)
10 {
11 FILE *f;
12 char filename[256];
13 char command[256];
14 int ret;
15
16 if (!argv[1]) {
17 fprintf(stderr, "ERROR: Run with the btrfs device argument!\n");
18 return 0;
19 }
20
21 snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
22
23 if (load_bpf_file(filename)) {
24 printf("%s", bpf_log_buf);
25 return 1;
26 }
27
28 snprintf(command, 256, "mount %s tmpmnt/", argv[1]);
29 f = popen(command, "r");
30 ret = pclose(f);
31
32 return ret ? 0 : 1;
33 }
34