提交 067cae47 编写于 作者: M Martin KaFai Lau 提交者: David S. Miller

bpf: Use char in prog and map name

Instead of u8, use char for prog and map name.  It can avoid the
userspace tool getting compiler's signess warning.  The
bpf_prog_aux, bpf_map, bpf_attr, bpf_prog_info and
bpf_map_info are changed.
Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
Acked-by: NAlexei Starovoitov <ast@fb.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 473d9734
...@@ -56,7 +56,7 @@ struct bpf_map { ...@@ -56,7 +56,7 @@ struct bpf_map {
struct work_struct work; struct work_struct work;
atomic_t usercnt; atomic_t usercnt;
struct bpf_map *inner_map_meta; struct bpf_map *inner_map_meta;
u8 name[BPF_OBJ_NAME_LEN]; char name[BPF_OBJ_NAME_LEN];
}; };
/* function argument constraints */ /* function argument constraints */
...@@ -189,7 +189,7 @@ struct bpf_prog_aux { ...@@ -189,7 +189,7 @@ struct bpf_prog_aux {
struct bpf_prog *prog; struct bpf_prog *prog;
struct user_struct *user; struct user_struct *user;
u64 load_time; /* ns since boottime */ u64 load_time; /* ns since boottime */
u8 name[BPF_OBJ_NAME_LEN]; char name[BPF_OBJ_NAME_LEN];
union { union {
struct work_struct work; struct work_struct work;
struct rcu_head rcu; struct rcu_head rcu;
......
...@@ -230,7 +230,7 @@ union bpf_attr { ...@@ -230,7 +230,7 @@ union bpf_attr {
__u32 numa_node; /* numa node (effective only if __u32 numa_node; /* numa node (effective only if
* BPF_F_NUMA_NODE is set). * BPF_F_NUMA_NODE is set).
*/ */
__u8 map_name[BPF_OBJ_NAME_LEN]; char map_name[BPF_OBJ_NAME_LEN];
}; };
struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
...@@ -253,7 +253,7 @@ union bpf_attr { ...@@ -253,7 +253,7 @@ union bpf_attr {
__aligned_u64 log_buf; /* user supplied buffer */ __aligned_u64 log_buf; /* user supplied buffer */
__u32 kern_version; /* checked when prog_type=kprobe */ __u32 kern_version; /* checked when prog_type=kprobe */
__u32 prog_flags; __u32 prog_flags;
__u8 prog_name[BPF_OBJ_NAME_LEN]; char prog_name[BPF_OBJ_NAME_LEN];
}; };
struct { /* anonymous struct used by BPF_OBJ_* commands */ struct { /* anonymous struct used by BPF_OBJ_* commands */
...@@ -888,7 +888,7 @@ struct bpf_prog_info { ...@@ -888,7 +888,7 @@ struct bpf_prog_info {
__u32 created_by_uid; __u32 created_by_uid;
__u32 nr_map_ids; __u32 nr_map_ids;
__aligned_u64 map_ids; __aligned_u64 map_ids;
__u8 name[BPF_OBJ_NAME_LEN]; char name[BPF_OBJ_NAME_LEN];
} __attribute__((aligned(8))); } __attribute__((aligned(8)));
struct bpf_map_info { struct bpf_map_info {
...@@ -898,7 +898,7 @@ struct bpf_map_info { ...@@ -898,7 +898,7 @@ struct bpf_map_info {
__u32 value_size; __u32 value_size;
__u32 max_entries; __u32 max_entries;
__u32 map_flags; __u32 map_flags;
__u8 name[BPF_OBJ_NAME_LEN]; char name[BPF_OBJ_NAME_LEN];
} __attribute__((aligned(8))); } __attribute__((aligned(8)));
/* User bpf_sock_ops struct to access socket values and specify request ops /* User bpf_sock_ops struct to access socket values and specify request ops
......
...@@ -230,7 +230,7 @@ union bpf_attr { ...@@ -230,7 +230,7 @@ union bpf_attr {
__u32 numa_node; /* numa node (effective only if __u32 numa_node; /* numa node (effective only if
* BPF_F_NUMA_NODE is set). * BPF_F_NUMA_NODE is set).
*/ */
__u8 map_name[BPF_OBJ_NAME_LEN]; char map_name[BPF_OBJ_NAME_LEN];
}; };
struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */ struct { /* anonymous struct used by BPF_MAP_*_ELEM commands */
...@@ -253,7 +253,7 @@ union bpf_attr { ...@@ -253,7 +253,7 @@ union bpf_attr {
__aligned_u64 log_buf; /* user supplied buffer */ __aligned_u64 log_buf; /* user supplied buffer */
__u32 kern_version; /* checked when prog_type=kprobe */ __u32 kern_version; /* checked when prog_type=kprobe */
__u32 prog_flags; __u32 prog_flags;
__u8 prog_name[BPF_OBJ_NAME_LEN]; char prog_name[BPF_OBJ_NAME_LEN];
}; };
struct { /* anonymous struct used by BPF_OBJ_* commands */ struct { /* anonymous struct used by BPF_OBJ_* commands */
...@@ -871,7 +871,7 @@ struct bpf_prog_info { ...@@ -871,7 +871,7 @@ struct bpf_prog_info {
__u32 created_by_uid; __u32 created_by_uid;
__u32 nr_map_ids; __u32 nr_map_ids;
__aligned_u64 map_ids; __aligned_u64 map_ids;
__u8 name[BPF_OBJ_NAME_LEN]; char name[BPF_OBJ_NAME_LEN];
} __attribute__((aligned(8))); } __attribute__((aligned(8)));
struct bpf_map_info { struct bpf_map_info {
...@@ -881,7 +881,7 @@ struct bpf_map_info { ...@@ -881,7 +881,7 @@ struct bpf_map_info {
__u32 value_size; __u32 value_size;
__u32 max_entries; __u32 max_entries;
__u32 map_flags; __u32 map_flags;
__u8 name[BPF_OBJ_NAME_LEN]; char name[BPF_OBJ_NAME_LEN];
} __attribute__((aligned(8))); } __attribute__((aligned(8)));
/* User bpf_sock_ops struct to access socket values and specify request ops /* User bpf_sock_ops struct to access socket values and specify request ops
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册