[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181108193712.754659d7@cakuba.netronome.com>
Date: Thu, 8 Nov 2018 19:38:56 -0800
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Stanislav Fomichev <sdf@...ichev.me>
Cc: netdev@...r.kernel.org, linux-kselftest@...r.kernel.org,
ast@...nel.org, daniel@...earbox.net, shuah@...nel.org,
quentin.monnet@...ronome.com, guro@...com,
jiong.wang@...ronome.com, sdf@...gle.com,
bhole_prashant_q7@....ntt.co.jp, john.fastabend@...il.com,
jbenc@...hat.com, treeze.taeung@...il.com, yhs@...com, osk@...com,
sandipan@...ux.vnet.ibm.com
Subject: Re: [PATCH v4 bpf-next 4/7] libbpf: add internal pin_name
On Thu, 8 Nov 2018 16:22:10 -0800, Stanislav Fomichev wrote:
> @@ -261,6 +266,18 @@ static void bpf_program__exit(struct bpf_program *prog)
> prog->idx = -1;
> }
>
> +static char *__bpf_program__pin_name(struct bpf_program *prog)
> +{
> + char *name;
> +
> + name = strdup(prog->section_name);
> + for (char *p = name; p && *p; p++)
Useful patch! I'm not sure about libbpf but in the kernel we don't do
C99 variable declarations inside for loop init. Perhaps better to stick
to kernel rules than invent our own.
Also, I'm tempted to say:
char *name, *p;
name = p = strdup(prog->section_name);
while ((p = strchr(p, '/')))
*p = '_';
;)
> + if (*p == '/')
> + *p = '_';
> +
> + return name;
> +}
Powered by blists - more mailing lists