@@ -105,7 +105,7 @@ void libbpf_print(enum libbpf_print_level level, const char *format, ...)
105
105
err = action; \
106
106
if (err) \
107
107
goto out; \
108
- } while(0)
108
+ } while (0)
109
109
110
110
111
111
/* Copied from tools/perf/util/util.h */
@@ -965,8 +965,7 @@ static int bpf_object__init_user_maps(struct bpf_object *obj, bool strict)
965
965
obj -> path , nr_maps , data -> d_size );
966
966
967
967
if (!data -> d_size || nr_maps == 0 || (data -> d_size % nr_maps ) != 0 ) {
968
- pr_warn ("unable to determine map definition size "
969
- "section %s, %d maps in %zd bytes\n" ,
968
+ pr_warn ("unable to determine map definition size section %s, %d maps in %zd bytes\n" ,
970
969
obj -> path , nr_maps , data -> d_size );
971
970
return - EINVAL ;
972
971
}
@@ -1030,12 +1029,11 @@ static int bpf_object__init_user_maps(struct bpf_object *obj, bool strict)
1030
1029
* incompatible.
1031
1030
*/
1032
1031
char * b ;
1032
+
1033
1033
for (b = ((char * )def ) + sizeof (struct bpf_map_def );
1034
1034
b < ((char * )def ) + map_def_sz ; b ++ ) {
1035
1035
if (* b != 0 ) {
1036
- pr_warn ("maps section in %s: \"%s\" "
1037
- "has unrecognized, non-zero "
1038
- "options\n" ,
1036
+ pr_warn ("maps section in %s: \"%s\" has unrecognized, non-zero options\n" ,
1039
1037
obj -> path , map_name );
1040
1038
if (strict )
1041
1039
return - EINVAL ;
@@ -1073,7 +1071,8 @@ skip_mods_and_typedefs(const struct btf *btf, __u32 id, __u32 *res_id)
1073
1071
*/
1074
1072
static bool get_map_field_int (const char * map_name , const struct btf * btf ,
1075
1073
const struct btf_type * def ,
1076
- const struct btf_member * m , __u32 * res ) {
1074
+ const struct btf_member * m , __u32 * res )
1075
+ {
1077
1076
const struct btf_type * t = skip_mods_and_typedefs (btf , m -> type , NULL );
1078
1077
const char * name = btf__name_by_offset (btf , m -> name_off );
1079
1078
const struct btf_array * arr_info ;
@@ -1387,7 +1386,8 @@ static int bpf_object__init_user_btf_maps(struct bpf_object *obj, bool strict,
1387
1386
for (i = 0 ; i < vlen ; i ++ ) {
1388
1387
err = bpf_object__init_user_btf_map (obj , sec , i ,
1389
1388
obj -> efile .btf_maps_shndx ,
1390
- data , strict , pin_root_path );
1389
+ data , strict ,
1390
+ pin_root_path );
1391
1391
if (err )
1392
1392
return err ;
1393
1393
}
@@ -1673,12 +1673,14 @@ static int bpf_object__elf_collect(struct bpf_object *obj, bool relaxed_maps,
1673
1673
if (strcmp (name , ".text" ) == 0 )
1674
1674
obj -> efile .text_shndx = idx ;
1675
1675
err = bpf_object__add_program (obj , data -> d_buf ,
1676
- data -> d_size , name , idx );
1676
+ data -> d_size ,
1677
+ name , idx );
1677
1678
if (err ) {
1678
1679
char errmsg [STRERR_BUFSIZE ];
1679
- char * cp = libbpf_strerror_r (- err , errmsg ,
1680
- sizeof (errmsg ));
1680
+ char * cp ;
1681
1681
1682
+ cp = libbpf_strerror_r (- err , errmsg ,
1683
+ sizeof (errmsg ));
1682
1684
pr_warn ("failed to alloc program %s (%s): %s" ,
1683
1685
name , obj -> path , cp );
1684
1686
return err ;
@@ -1828,7 +1830,7 @@ static int bpf_program__record_reloc(struct bpf_program *prog,
1828
1830
}
1829
1831
1830
1832
if (insn -> code != (BPF_LD | BPF_IMM | BPF_DW )) {
1831
- pr_warn ("bpf: relocation: invalid relo for insns[%d].code 0x%x\n" ,
1833
+ pr_warn ("invalid relo for insns[%d].code 0x%x\n" ,
1832
1834
insn_idx , insn -> code );
1833
1835
return - LIBBPF_ERRNO__RELOC ;
1834
1836
}
@@ -2145,7 +2147,7 @@ bpf_object__probe_global_data(struct bpf_object *obj)
2145
2147
2146
2148
static int bpf_object__probe_btf_func (struct bpf_object * obj )
2147
2149
{
2148
- const char strs [] = "\0int\0x\0a" ;
2150
+ static const char strs [] = "\0int\0x\0a" ;
2149
2151
/* void x(int a) {} */
2150
2152
__u32 types [] = {
2151
2153
/* int */
@@ -2171,7 +2173,7 @@ static int bpf_object__probe_btf_func(struct bpf_object *obj)
2171
2173
2172
2174
static int bpf_object__probe_btf_datasec (struct bpf_object * obj )
2173
2175
{
2174
- const char strs [] = "\0x\0.data" ;
2176
+ static const char strs [] = "\0x\0.data" ;
2175
2177
/* static int a; */
2176
2178
__u32 types [] = {
2177
2179
/* int */
@@ -5112,7 +5114,7 @@ int libbpf_prog_type_by_name(const char *name, enum bpf_prog_type *prog_type,
5112
5114
* expected_attach_type = section_names [i ].expected_attach_type ;
5113
5115
return 0 ;
5114
5116
}
5115
- pr_warn ("failed to guess program type based on ELF section name '%s'\n" , name );
5117
+ pr_warn ("failed to guess program type from ELF section '%s'\n" , name );
5116
5118
type_names = libbpf_get_type_names (false);
5117
5119
if (type_names != NULL ) {
5118
5120
pr_info ("supported section(type) names are:%s\n" , type_names );
@@ -6338,7 +6340,8 @@ static struct bpf_prog_info_array_desc bpf_prog_info_array_desc[] = {
6338
6340
6339
6341
};
6340
6342
6341
- static __u32 bpf_prog_info_read_offset_u32 (struct bpf_prog_info * info , int offset )
6343
+ static __u32 bpf_prog_info_read_offset_u32 (struct bpf_prog_info * info ,
6344
+ int offset )
6342
6345
{
6343
6346
__u32 * array = (__u32 * )info ;
6344
6347
@@ -6347,7 +6350,8 @@ static __u32 bpf_prog_info_read_offset_u32(struct bpf_prog_info *info, int offse
6347
6350
return - (int )offset ;
6348
6351
}
6349
6352
6350
- static __u64 bpf_prog_info_read_offset_u64 (struct bpf_prog_info * info , int offset )
6353
+ static __u64 bpf_prog_info_read_offset_u64 (struct bpf_prog_info * info ,
6354
+ int offset )
6351
6355
{
6352
6356
__u64 * array = (__u64 * )info ;
6353
6357
0 commit comments