Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966590AbbLQFX6 (ORCPT ); Thu, 17 Dec 2015 00:23:58 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:46446 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966543AbbLQFXz (ORCPT ); Thu, 17 Dec 2015 00:23:55 -0500 From: Wang Nan To: , , , , , , , , , , , CC: , , Wang Nan Subject: [PATCH 04/10] bpf tools: Switch to uapi style type names Date: Thu, 17 Dec 2015 05:23:08 +0000 Message-ID: <1450329794-161948-5-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.3.4 In-Reply-To: <1450329794-161948-1-git-send-email-wangnan0@huawei.com> References: <1450329794-161948-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.567246D7.00EE,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ab57a7df2770b8412c82114526e3f775 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2286 Lines: 68 Types "u64, u32" don't exist in uapi header (linux/types.h). Because of that directly include bpf.h causes error. This patch fixes this by replacing all occurrences of "u32, u64" in API to "__u32, __u64". The later can be found in 'uapi/linux/types.h' so it would be safe for normal program (other than perf). Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo --- tools/lib/bpf/bpf.c | 4 ++-- tools/lib/bpf/bpf.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 88e6a46..e0dccea 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c @@ -57,7 +57,7 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size, int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns, size_t insns_cnt, const char *license, - u32 kern_version, char *log_buf, size_t log_buf_sz) + __u32 kern_version, char *log_buf, size_t log_buf_sz) { int fd; union bpf_attr attr; @@ -85,7 +85,7 @@ int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns, } int bpf_map_update_elem(int fd, void *key, void *value, - u64 flags) + __u64 flags) { union bpf_attr attr; diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h index 00cfeae..01a421a 100644 --- a/tools/lib/bpf/bpf.h +++ b/tools/lib/bpf/bpf.h @@ -8,6 +8,7 @@ #ifndef __BPF_BPF_H #define __BPF_BPF_H +#include #include int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size, @@ -17,9 +18,9 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size, #define BPF_LOG_BUF_SIZE 65536 int bpf_load_program(enum bpf_prog_type type, const struct bpf_insn *insns, size_t insns_cnt, const char *license, - u32 kern_version, char *log_buf, + __u32 kern_version, char *log_buf, size_t log_buf_sz); int bpf_map_update_elem(int fd, void *key, void *value, - u64 flags); + __u64 flags); #endif -- 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/