Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1569379pxb; Tue, 8 Feb 2022 22:36:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJygqC5eaGqYlAxS87cFIg9a/oCI9Pwx5yAZdOsiAbt/bD9xspbYwW9+zohRW2Dy//Ak8ckQ X-Received: by 2002:a62:7e06:: with SMTP id z6mr737643pfc.60.1644388591950; Tue, 08 Feb 2022 22:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644388591; cv=none; d=google.com; s=arc-20160816; b=sKCus0abfV0qt2ktPSAQPdN03ND+wMiSOFM0aWqgyefiTj0igJC22U7yEaz6L4y0yP XGtDz8dbbd/bp0j9/CYE+lIlz2wnIXryoZoHDXa5/sbbRf/u/qQVMLLzeq+9XPIVjvib OXd5YSGSKJ4cJBkgsGUnQpn9j3mIjpkCbYiBAviBsjKNS6cmBpTMvUz3zd+elw6Ujnr/ QQaM7ageKEF0TRBRIj/lhSUFf0psImw3hGsWvQyKIpYe1FXTIQAGiPFeLbmJSbW3lQqC Zj9NSu9Rjb6sv57nYBDVYc49D1R2F2tzxA2spJHxODDeRexurTndsQJLCngP2GRZcvVs BupQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=7jtyMgwW9BiDXzVcsfLl4AZbikM19XjQ9hiGnvokWMA=; b=G326s6Fs0ONWMGczL/J5qk6ddxBD5E1MNVk4bYBhJPVsXnDUm2v5pSxQPEBynCxlYg O5zSZR133pjUnTTw+RLqqqMwfliL/fIZCYB/EXAhDXZC9y4mOOa/pxtOAe3KcvbpXvwL c9bwB7UuD8+3BRcFeNyaXZWGBowUCDtZ56gkNiZ0/MRJz0om9n9ylTo0jHL3DM3macbZ cYVwFLQw/E9uSWl15Z31eV8DjMj9RN8J3BgQu4/ogWaSXqUmjTt7nQDSJKlYIrAmUg/y SptaRrV1iPM8n3breC2yTPzyK0nRb2gEQ9W13TRIDBjXq9YKVxLdRD49ZDJbT6PeoIxU EHdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CiRHBjQt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l70si2836797pge.800.2022.02.08.22.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Feb 2022 22:36:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CiRHBjQt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E523DE0301B2; Tue, 8 Feb 2022 22:14:35 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237925AbiBGTAv (ORCPT + 99 others); Mon, 7 Feb 2022 14:00:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235273AbiBGS7h (ORCPT ); Mon, 7 Feb 2022 13:59:37 -0500 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0830C0401DA; Mon, 7 Feb 2022 10:59:36 -0800 (PST) Received: by mail-il1-x131.google.com with SMTP id h11so3765908ilq.9; Mon, 07 Feb 2022 10:59:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7jtyMgwW9BiDXzVcsfLl4AZbikM19XjQ9hiGnvokWMA=; b=CiRHBjQtNzSnZEJcfHoXO90rUIjdZIEt79PeC16IliCiyQMzsQDTJ1TMwy+l2gMlQk wZRTJ0z4EvVMyeqnoovxpia5LFqoMoGQB2zSVQIok4GjJIsUEEOUmKdNAbDfyE3SjgfN jILi46aTquk55TXGAFF9xEu0wK33RYQe1qTV/A5xJfqqQ12RqozgFYDUMA0Jo+zeu9LV uvpPvs9GC2MIIFkZyteMAFfEJnV+0NCA7PXVu1WtCloMc2y2ru7XPqip5V8X2RR72bSC JMC70FKeV2CLDRRGxclfmfn6RG2JVDMdab/wKuoSNdvXFMbns4zkkXrx+E9noLM71Gip vkVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7jtyMgwW9BiDXzVcsfLl4AZbikM19XjQ9hiGnvokWMA=; b=yRNWyyTRpzQNkuC002hj7U4m+0Iu2Mc61hHfDcWP7S/dMf1gFZ1hUWW7i9GRUaNnUQ fZLQB+vHCP7RZYw+iFf2xHZ9zc3kIZ1eqDCTBKgVTi93YVAih9tHYT0VV7mxxtjnhLGD 8/61hBGRoI3sg3Ow6/Dx2KIm6y/jL0KLu5mn7H1voNoASbzMzPZav8GyvcwKjg3zf6zs n/zo4ZQJ6SMBGNXx/2BKKdRPXjYiiC1a/P0nypGlfJeD+PrGUAFobn631tUOFDdGw+tv f4Axkydr4TATfhp9Q7XhVjDKAVz4SUbSw5KU3U8KeIN9CLm1+COXFKVmVQkrTieAvhel FJTQ== X-Gm-Message-State: AOAM532l/LSxYwyG7jz+++uT9fBSfNoWsH7C5GpRPljMqwaYQOF612xw K3pxzzVYLFq2dqeboLogqgur8SPC3VYezSt0RN8= X-Received: by 2002:a05:6e02:1b81:: with SMTP id h1mr453086ili.239.1644260376142; Mon, 07 Feb 2022 10:59:36 -0800 (PST) MIME-Version: 1.0 References: <20220202135333.190761-1-jolsa@kernel.org> <20220202135333.190761-5-jolsa@kernel.org> In-Reply-To: <20220202135333.190761-5-jolsa@kernel.org> From: Andrii Nakryiko Date: Mon, 7 Feb 2022 10:59:24 -0800 Message-ID: Subject: Re: [PATCH 4/8] libbpf: Add libbpf__kallsyms_parse function To: Jiri Olsa Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Masami Hiramatsu , Networking , bpf , lkml , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Steven Rostedt , Jiri Olsa Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 2, 2022 at 5:54 AM Jiri Olsa wrote: > > Move the kallsyms parsing in internal libbpf__kallsyms_parse > function, so it can be used from other places. > > It will be used in following changes. > > Signed-off-by: Jiri Olsa > --- > tools/lib/bpf/libbpf.c | 62 ++++++++++++++++++++------------- > tools/lib/bpf/libbpf_internal.h | 5 +++ > 2 files changed, 43 insertions(+), 24 deletions(-) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 1b0936b016d9..7d595cfd03bc 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -7165,12 +7165,10 @@ static int bpf_object__sanitize_maps(struct bpf_object *obj) > return 0; > } > > -static int bpf_object__read_kallsyms_file(struct bpf_object *obj) > +int libbpf__kallsyms_parse(void *arg, kallsyms_cb_t cb) please call it libbpf_kallsyms_parse(), internal APIs don't use "object oriented" double underscore separator also this "arg" is normally called "ctx" in similar APIs in libbpf and is passed the last, can you please adjust all that for consistency? > { > char sym_type, sym_name[500]; > unsigned long long sym_addr; > - const struct btf_type *t; > - struct extern_desc *ext; > int ret, err = 0; > FILE *f; > [...]