Re: [PATCH v4 bpf-next 4/7] libbpf: add internal pin_name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
> +}



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux