From patchwork Thu Dec 17 05:23:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 58524 Delivered-To: patch@linaro.org Received: by 10.112.89.199 with SMTP id bq7csp152176lbb; Wed, 16 Dec 2015 21:24:52 -0800 (PST) X-Received: by 10.66.240.4 with SMTP id vw4mr69508808pac.9.1450329892157; Wed, 16 Dec 2015 21:24:52 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h78si9921028pfd.42.2015.12.16.21.24.51; Wed, 16 Dec 2015 21:24:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966739AbbLQFYu (ORCPT + 29 others); Thu, 17 Dec 2015 00:24:50 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:46475 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966550AbbLQFX4 (ORCPT ); Thu, 17 Dec 2015 00:23:56 -0500 Received: from 172.24.1.49 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.49]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DBB89435; Thu, 17 Dec 2015 13:23:34 +0800 (CST) Received: from linux-4hy3.site (10.107.193.248) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Thu, 17 Dec 2015 13:23:21 +0800 From: Wang Nan To: , , , , , , , , , , , CC: , , Wang Nan Subject: [PATCH 03/10] bpf tools: Add const decoretor to 'license' and 'insns' for bpf_load_program() Date: Thu, 17 Dec 2015 05:23:07 +0000 Message-ID: <1450329794-161948-4-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 X-Originating-IP: [10.107.193.248] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.567246D8.0008, 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: 20d55b6009a45b53ead1202c0810fa77 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Actually 'license' and 'insns' are const pointer. Before this patch using 'bpf_load_program(... "GPL", ...)' triggers a warning, which is unnecessary. This patch makes these two arguments const pointers. Signed-off-by: Wang Nan Cc: Arnaldo Carvalho de Melo --- tools/lib/bpf/bpf.c | 8 ++++---- tools/lib/bpf/bpf.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) -- 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/ diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 1f91cc9..88e6a46 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c @@ -55,8 +55,8 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size, return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr)); } -int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns, - size_t insns_cnt, char *license, +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) { int fd; @@ -65,8 +65,8 @@ int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns, bzero(&attr, sizeof(attr)); attr.prog_type = type; attr.insn_cnt = (__u32)insns_cnt; - attr.insns = ptr_to_u64(insns); - attr.license = ptr_to_u64(license); + attr.insns = ptr_to_u64((void *)insns); + attr.license = ptr_to_u64((void *)license); attr.log_buf = ptr_to_u64(NULL); attr.log_size = 0; attr.log_level = 0; diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h index a764655..00cfeae 100644 --- a/tools/lib/bpf/bpf.h +++ b/tools/lib/bpf/bpf.h @@ -15,8 +15,8 @@ int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size, /* Recommend log buffer size */ #define BPF_LOG_BUF_SIZE 65536 -int bpf_load_program(enum bpf_prog_type type, struct bpf_insn *insns, - size_t insns_cnt, char *license, +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);