On 2/1/19 2:52 PM, Alexei Starovoitov wrote:
> On Fri, Feb 01, 2019 at 02:06:16PM -0800, Yonghong Song wrote:
>> A global function libbpf_debug_print, which is invisible
>> outside the shared library, is defined to print based
>> on levels. The pr_warning, pr_info and pr_debug
>> macros are moved into the newly created header
>> common.h. So any .c file including common.h can
>> use these macros directly.
> 
> s/common.h/util.h/ ?
> 
> I understand that util.h is libbpf's internal header, but still
> I'm worried that such file name is too generic and if users
> get their header paths wrong they may pick it by accident.
> May be call it libbpf_util.h instead?

Will change to libbpf_util.h.

>>
>> Currently btf__new and btf_ext__new API has an argument getting
>> __pr_debug function pointer into btf.c so the debugging information
>> can be printed there. This patch removed this parameter
>> from btf__new and btf_ext__new and directly using pr_debug in btf.c.
>>
>> Another global function libbpf_dprint_level_available, also
>> invisible outside the shared library, can test
>> whether a particular level debug printing is
>> available or not. It is used in btf.c to
>> test whether DEBUG level debug printing is availabl or not,
>> based on which the log buffer will be allocated when loading
>> btf to the kernel.
>>
>> Signed-off-by: Yonghong Song <y...@fb.com>
> ...
>> diff --git a/tools/lib/bpf/util.h b/tools/lib/bpf/util.h
>> new file mode 100644
>> index 000000000000..3ae80f486875
>> --- /dev/null
>> +++ b/tools/lib/bpf/util.h
>> @@ -0,0 +1,32 @@
>> +/* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */
>> +/* Copyright (c) 2019 Facebook */
>> +
>> +#ifndef __LIBBPF_COMMON_H
>> +#define __LIBBPF_COMMON_H
> 
> s/COMMON/new name/

Will change.

> 
>> +
>> +#include <stdbool.h>
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +extern void libbpf_debug_print(enum libbpf_print_level level,
>> +                           const char *format, ...)
>> +    __attribute__((format(printf, 2, 3)));
> 
> May be shorten the name to libbpf_print ?
> Such name will match enum libbpf_print_level and libbpf_set_print.

Will change to libbpf_print.
Thanks!

Reply via email to