static void handle_map_pins()

in cli/bpfcov.c [906:944]


static void handle_map_pins(struct root_args *args, struct argp_state *state, bool unpin)
{
    int p;
    for (p = 0; p < NUM_PINNED_MAPS; p++)
    {
        if (access(args->pin[p], F_OK) == 0)
        {
            if (unpin)
            {
                log_warn(args, "unpinning existing map '%s'\n", args->pin[p]);
                if (unlink(args->pin[p]) != 0)
                {
                    if (state)
                    {
                        argp_error(state, "could not unpin map '%s'", args->pin[p]);
                    }
                    else
                    {
                        log_fata(args, "could not unpin map '%s'\n", args->pin[p]);
                    }
                }
            }
        }
        else
        {
            if (!unpin)
            {
                if (state)
                {
                    argp_error(state, "could not access map '%s'", args->pin[p]);
                }
                else
                {
                    log_fata(args, "could not access map '%s'\n", args->pin[p]);
                }
            }
        }
    }
}