Commit 9a93bf3f authored by Hou Tao's avatar Hou Tao Committed by Alexei Starovoitov

selftests/bpf: Fix checkpatch error on empty function parameter

Fix checkpatch error: "ERROR: Bad function definition - void foo()
should probably be void foo(void)". Most replacements are done by
the following command:

  sed -i 's#\([a-z]\)()$#\1(void)#g' testing/selftests/bpf/benchs/*.c
Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211210141652.877186-3-houtao1@huawei.com
parent c5fb1993
...@@ -39,7 +39,7 @@ static int bump_memlock_rlimit(void) ...@@ -39,7 +39,7 @@ static int bump_memlock_rlimit(void)
return setrlimit(RLIMIT_MEMLOCK, &rlim_new); return setrlimit(RLIMIT_MEMLOCK, &rlim_new);
} }
void setup_libbpf() void setup_libbpf(void)
{ {
int err; int err;
......
...@@ -38,8 +38,8 @@ struct bench_res { ...@@ -38,8 +38,8 @@ struct bench_res {
struct bench { struct bench {
const char *name; const char *name;
void (*validate)(); void (*validate)(void);
void (*setup)(); void (*setup)(void);
void *(*producer_thread)(void *ctx); void *(*producer_thread)(void *ctx);
void *(*consumer_thread)(void *ctx); void *(*consumer_thread)(void *ctx);
void (*measure)(struct bench_res* res); void (*measure)(struct bench_res* res);
...@@ -54,7 +54,7 @@ struct counter { ...@@ -54,7 +54,7 @@ struct counter {
extern struct env env; extern struct env env;
extern const struct bench *bench; extern const struct bench *bench;
void setup_libbpf(); void setup_libbpf(void);
void hits_drops_report_progress(int iter, struct bench_res *res, long delta_ns); void hits_drops_report_progress(int iter, struct bench_res *res, long delta_ns);
void hits_drops_report_final(struct bench_res res[], int res_cnt); void hits_drops_report_final(struct bench_res res[], int res_cnt);
void false_hits_report_progress(int iter, struct bench_res *res, long delta_ns); void false_hits_report_progress(int iter, struct bench_res *res, long delta_ns);
...@@ -62,7 +62,8 @@ void false_hits_report_final(struct bench_res res[], int res_cnt); ...@@ -62,7 +62,8 @@ void false_hits_report_final(struct bench_res res[], int res_cnt);
void ops_report_progress(int iter, struct bench_res *res, long delta_ns); void ops_report_progress(int iter, struct bench_res *res, long delta_ns);
void ops_report_final(struct bench_res res[], int res_cnt); void ops_report_final(struct bench_res res[], int res_cnt);
static inline __u64 get_time_ns() { static inline __u64 get_time_ns(void)
{
struct timespec t; struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t); clock_gettime(CLOCK_MONOTONIC, &t);
......
...@@ -36,7 +36,7 @@ static struct count_local_ctx { ...@@ -36,7 +36,7 @@ static struct count_local_ctx {
struct counter *hits; struct counter *hits;
} count_local_ctx; } count_local_ctx;
static void count_local_setup() static void count_local_setup(void)
{ {
struct count_local_ctx *ctx = &count_local_ctx; struct count_local_ctx *ctx = &count_local_ctx;
......
...@@ -11,7 +11,7 @@ static struct ctx { ...@@ -11,7 +11,7 @@ static struct ctx {
int fd; int fd;
} ctx; } ctx;
static void validate() static void validate(void)
{ {
if (env.producer_cnt != 1) { if (env.producer_cnt != 1) {
fprintf(stderr, "benchmark doesn't support multi-producer!\n"); fprintf(stderr, "benchmark doesn't support multi-producer!\n");
...@@ -43,7 +43,7 @@ static void measure(struct bench_res *res) ...@@ -43,7 +43,7 @@ static void measure(struct bench_res *res)
res->hits = atomic_swap(&ctx.hits.value, 0); res->hits = atomic_swap(&ctx.hits.value, 0);
} }
static void setup_ctx() static void setup_ctx(void)
{ {
setup_libbpf(); setup_libbpf();
...@@ -71,36 +71,36 @@ static void attach_bpf(struct bpf_program *prog) ...@@ -71,36 +71,36 @@ static void attach_bpf(struct bpf_program *prog)
} }
} }
static void setup_base() static void setup_base(void)
{ {
setup_ctx(); setup_ctx();
} }
static void setup_kprobe() static void setup_kprobe(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.prog1); attach_bpf(ctx.skel->progs.prog1);
} }
static void setup_kretprobe() static void setup_kretprobe(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.prog2); attach_bpf(ctx.skel->progs.prog2);
} }
static void setup_rawtp() static void setup_rawtp(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.prog3); attach_bpf(ctx.skel->progs.prog3);
} }
static void setup_fentry() static void setup_fentry(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.prog4); attach_bpf(ctx.skel->progs.prog4);
} }
static void setup_fexit() static void setup_fexit(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.prog5); attach_bpf(ctx.skel->progs.prog5);
......
...@@ -88,12 +88,12 @@ const struct argp bench_ringbufs_argp = { ...@@ -88,12 +88,12 @@ const struct argp bench_ringbufs_argp = {
static struct counter buf_hits; static struct counter buf_hits;
static inline void bufs_trigger_batch() static inline void bufs_trigger_batch(void)
{ {
(void)syscall(__NR_getpgid); (void)syscall(__NR_getpgid);
} }
static void bufs_validate() static void bufs_validate(void)
{ {
if (env.consumer_cnt != 1) { if (env.consumer_cnt != 1) {
fprintf(stderr, "rb-libbpf benchmark doesn't support multi-consumer!\n"); fprintf(stderr, "rb-libbpf benchmark doesn't support multi-consumer!\n");
...@@ -132,7 +132,7 @@ static void ringbuf_libbpf_measure(struct bench_res *res) ...@@ -132,7 +132,7 @@ static void ringbuf_libbpf_measure(struct bench_res *res)
res->drops = atomic_swap(&ctx->skel->bss->dropped, 0); res->drops = atomic_swap(&ctx->skel->bss->dropped, 0);
} }
static struct ringbuf_bench *ringbuf_setup_skeleton() static struct ringbuf_bench *ringbuf_setup_skeleton(void)
{ {
struct ringbuf_bench *skel; struct ringbuf_bench *skel;
...@@ -167,7 +167,7 @@ static int buf_process_sample(void *ctx, void *data, size_t len) ...@@ -167,7 +167,7 @@ static int buf_process_sample(void *ctx, void *data, size_t len)
return 0; return 0;
} }
static void ringbuf_libbpf_setup() static void ringbuf_libbpf_setup(void)
{ {
struct ringbuf_libbpf_ctx *ctx = &ringbuf_libbpf_ctx; struct ringbuf_libbpf_ctx *ctx = &ringbuf_libbpf_ctx;
struct bpf_link *link; struct bpf_link *link;
...@@ -223,7 +223,7 @@ static void ringbuf_custom_measure(struct bench_res *res) ...@@ -223,7 +223,7 @@ static void ringbuf_custom_measure(struct bench_res *res)
res->drops = atomic_swap(&ctx->skel->bss->dropped, 0); res->drops = atomic_swap(&ctx->skel->bss->dropped, 0);
} }
static void ringbuf_custom_setup() static void ringbuf_custom_setup(void)
{ {
struct ringbuf_custom_ctx *ctx = &ringbuf_custom_ctx; struct ringbuf_custom_ctx *ctx = &ringbuf_custom_ctx;
const size_t page_size = getpagesize(); const size_t page_size = getpagesize();
...@@ -352,7 +352,7 @@ static void perfbuf_measure(struct bench_res *res) ...@@ -352,7 +352,7 @@ static void perfbuf_measure(struct bench_res *res)
res->drops = atomic_swap(&ctx->skel->bss->dropped, 0); res->drops = atomic_swap(&ctx->skel->bss->dropped, 0);
} }
static struct perfbuf_bench *perfbuf_setup_skeleton() static struct perfbuf_bench *perfbuf_setup_skeleton(void)
{ {
struct perfbuf_bench *skel; struct perfbuf_bench *skel;
...@@ -390,7 +390,7 @@ perfbuf_process_sample_raw(void *input_ctx, int cpu, ...@@ -390,7 +390,7 @@ perfbuf_process_sample_raw(void *input_ctx, int cpu,
return LIBBPF_PERF_EVENT_CONT; return LIBBPF_PERF_EVENT_CONT;
} }
static void perfbuf_libbpf_setup() static void perfbuf_libbpf_setup(void)
{ {
struct perfbuf_libbpf_ctx *ctx = &perfbuf_libbpf_ctx; struct perfbuf_libbpf_ctx *ctx = &perfbuf_libbpf_ctx;
struct perf_event_attr attr; struct perf_event_attr attr;
......
...@@ -11,7 +11,7 @@ static struct trigger_ctx { ...@@ -11,7 +11,7 @@ static struct trigger_ctx {
static struct counter base_hits; static struct counter base_hits;
static void trigger_validate() static void trigger_validate(void)
{ {
if (env.consumer_cnt != 1) { if (env.consumer_cnt != 1) {
fprintf(stderr, "benchmark doesn't support multi-consumer!\n"); fprintf(stderr, "benchmark doesn't support multi-consumer!\n");
...@@ -45,7 +45,7 @@ static void trigger_measure(struct bench_res *res) ...@@ -45,7 +45,7 @@ static void trigger_measure(struct bench_res *res)
res->hits = atomic_swap(&ctx.skel->bss->hits, 0); res->hits = atomic_swap(&ctx.skel->bss->hits, 0);
} }
static void setup_ctx() static void setup_ctx(void)
{ {
setup_libbpf(); setup_libbpf();
...@@ -67,37 +67,37 @@ static void attach_bpf(struct bpf_program *prog) ...@@ -67,37 +67,37 @@ static void attach_bpf(struct bpf_program *prog)
} }
} }
static void trigger_tp_setup() static void trigger_tp_setup(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.bench_trigger_tp); attach_bpf(ctx.skel->progs.bench_trigger_tp);
} }
static void trigger_rawtp_setup() static void trigger_rawtp_setup(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.bench_trigger_raw_tp); attach_bpf(ctx.skel->progs.bench_trigger_raw_tp);
} }
static void trigger_kprobe_setup() static void trigger_kprobe_setup(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.bench_trigger_kprobe); attach_bpf(ctx.skel->progs.bench_trigger_kprobe);
} }
static void trigger_fentry_setup() static void trigger_fentry_setup(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.bench_trigger_fentry); attach_bpf(ctx.skel->progs.bench_trigger_fentry);
} }
static void trigger_fentry_sleep_setup() static void trigger_fentry_sleep_setup(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.bench_trigger_fentry_sleep); attach_bpf(ctx.skel->progs.bench_trigger_fentry_sleep);
} }
static void trigger_fmodret_setup() static void trigger_fmodret_setup(void)
{ {
setup_ctx(); setup_ctx();
attach_bpf(ctx.skel->progs.bench_trigger_fmodret); attach_bpf(ctx.skel->progs.bench_trigger_fmodret);
...@@ -183,22 +183,22 @@ static void usetup(bool use_retprobe, bool use_nop) ...@@ -183,22 +183,22 @@ static void usetup(bool use_retprobe, bool use_nop)
ctx.skel->links.bench_trigger_uprobe = link; ctx.skel->links.bench_trigger_uprobe = link;
} }
static void uprobe_setup_with_nop() static void uprobe_setup_with_nop(void)
{ {
usetup(false, true); usetup(false, true);
} }
static void uretprobe_setup_with_nop() static void uretprobe_setup_with_nop(void)
{ {
usetup(true, true); usetup(true, true);
} }
static void uprobe_setup_without_nop() static void uprobe_setup_without_nop(void)
{ {
usetup(false, false); usetup(false, false);
} }
static void uretprobe_setup_without_nop() static void uretprobe_setup_without_nop(void)
{ {
usetup(true, false); usetup(true, false);
} }
......
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