}
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);
return 0;
}
-int qosify_loader_init(bool force_init)
+int qosify_loader_init(void)
{
static const struct {
const char *suffix;
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]);
}
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;
}
{
fprintf(stderr, "Usage: %s [options]\n"
"Options:\n"
- " -f: force reload of BPF programs\n"
" -l <file> Load defaults from <file>\n"
" -o only load program/maps without running as daemon\n"
"\n", progname);
int main(int argc, char **argv)
{
const char *load_file = NULL;
- bool force_init = false;
bool oneshot = false;
int ch;
while ((ch = getopt(argc, argv, "fl:o")) != -1) {
switch (ch) {
case 'f':
- force_init = true;
break;
case 'l':
load_file = optarg;
}
}
- if (qosify_loader_init(force_init))
+ if (qosify_loader_init())
return 2;
if (qosify_map_init())
extern int qosify_map_timeout;
extern struct qosify_config config;
-int qosify_loader_init(bool force_init);
+int qosify_loader_init(void);
int qosify_map_init(void);
int qosify_map_dscp_value(const char *val);