map: fix copy-paste error in codepoints map
[project/qosify.git] / loader.c
index 539aae4713dccab7f3e4c22ce80d1e28173612cc..0b9449f1afae6db1634ad4dd6ada204b6d373519 100644 (file)
--- a/loader.c
+++ b/loader.c
@@ -39,24 +39,17 @@ static void qosify_fill_rodata(struct bpf_object *obj, uint32_t flags)
 }
 
 static int
-qosify_create_program(const char *suffix, uint32_t flags, bool *force_init)
+qosify_create_program(const char *suffix, uint32_t flags)
 {
        DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts,
                .pin_root_path = CLASSIFY_DATA_PATH,
        );
        struct bpf_program *prog;
        struct bpf_object *obj;
-       struct stat st;
        char path[256];
        int err;
 
        snprintf(path, sizeof(path), CLASSIFY_PIN_PATH "_" "%s", suffix);
-       if (!*force_init) {
-               if (stat(path, &st) == 0)
-                       return 0;
-
-               *force_init = true;
-       }
 
        obj = bpf_object__open_file(CLASSIFY_PROG_PATH, &opts);
        err = libbpf_get_error(obj);
@@ -95,7 +88,7 @@ qosify_create_program(const char *suffix, uint32_t flags, bool *force_init)
        return 0;
 }
 
-int qosify_loader_init(bool force_init)
+int qosify_loader_init(void)
 {
        static const struct {
                const char *suffix;
@@ -109,8 +102,7 @@ int qosify_loader_init(bool force_init)
        glob_t g;
        int i;
 
-       if (force_init &&
-           glob(CLASSIFY_DATA_PATH "/*", 0, NULL, &g) == 0) {
+       if (glob(CLASSIFY_DATA_PATH "/*", 0, NULL, &g) == 0) {
                for (i = 0; i < g.gl_pathc; i++)
                        unlink(g.gl_pathv[i]);
        }
@@ -121,8 +113,7 @@ int qosify_loader_init(bool force_init)
        qosify_init_env();
 
        for (i = 0; i < ARRAY_SIZE(progs); i++) {
-               if (qosify_create_program(progs[i].suffix, progs[i].flags,
-                                     &force_init))
+               if (qosify_create_program(progs[i].suffix, progs[i].flags))
                        return -1;
        }