Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp501201imn; Fri, 29 Jul 2022 13:44:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR54xHr4PxSWFk1Tqf28RuhjPw+cVXdKoQ/K9nZJsLHR6Ty3AYAodHQAcknrpjC159iQxc5U X-Received: by 2002:a17:90b:4b50:b0:1f0:5643:fa5c with SMTP id mi16-20020a17090b4b5000b001f05643fa5cmr6883003pjb.131.1659127477136; Fri, 29 Jul 2022 13:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659127477; cv=none; d=google.com; s=arc-20160816; b=YZTk0JD0p8vFQx5DVokLEfqMWeuE5UrhloqJ6Ad31oyUOXiIY+fIJ0p3lQyE+jVqD5 GK9SMOWNhV+yjAJSirzAl6NBXT9bpN+AP2r9tNBelCCvtU0t1qj3xoKX0tQMUN+7BmEI TsHj2i+Y1ii01cPkJuhmi7jLPhUxdS9ypKzNhWItAhi/P7GBuacnQqgP/0pIQbVv6fZl Jq6wBTZhWPhV+uqYiyE1ShDLScf0w5gOuHcEhTsH/B6uwC75pGfWdBxXg3mCzaHc3fMR 52tpOPrnkFr2gvcs/TWRr7gyFY0zk9AnsYJW+KKFgGfYtBQ0BzPT9S8nB/2nViMPKqHK JkNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=idAIy7+0S11QYa5sGcSX6gc9lPvRo9Vp3l0WAuHQtjk=; b=i7UnPmHYyZKON4a0UG/9wuDMJXSQ9KN/vNH0yzRaSmJkytYXgYUpEC0HjFuqj4TyMH mGP3svR4bMrtugt3MUkY2jThY7ZbiJVtpXx8cEBGWPl7j3FKbjShhUK0MhFh5dhqybsM RjKb67GlUkr14OHH4poZYtcdFmQbDyiCnA7GSxTT5oKf4psYdrAjAy06P6lIzYya9GeT hTknFqEuwPDkWFmCroE4Es5xbScQWeSjFY+vKpxYI3UL+d0Dd3JB7Ky0c4curjyfyN0F CghegCgAdORET2anm50ka6EzJinP3dM0EFn0vbTYojpL+P+nN/Wl4su0PUeCF4TQxeg5 Zyag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PMFaHTHQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a635909000000b00419a2de79b6si5289944pgb.305.2022.07.29.13.44.22; Fri, 29 Jul 2022 13:44:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=PMFaHTHQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239180AbiG2UUP (ORCPT + 99 others); Fri, 29 Jul 2022 16:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbiG2UUN (ORCPT ); Fri, 29 Jul 2022 16:20:13 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 662EFB874 for ; Fri, 29 Jul 2022 13:20:11 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id f11-20020a17090a4a8b00b001f2f7e32d03so7814715pjh.0 for ; Fri, 29 Jul 2022 13:20:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=idAIy7+0S11QYa5sGcSX6gc9lPvRo9Vp3l0WAuHQtjk=; b=PMFaHTHQa+PrAa0+3LB0YE2Gw3DO46zUmMLxgR5INe3c+vUatwzrBO/Quyv7D7kKIZ MiB6o3DlmAIna/epLhM8AagB7AATmiOJW5lgRVY1ldZbPfk6+ZuZOd+mWxpJRPwHmHvK G5675hLDgJcFqZ6fJSBHJNdZxpDapVRjBAaxZ1TgY1nr4TuFlGNcte5o1kXBPZy1zoIU pejl+FRpY27xM7h3VKQkIel6sunkXnYcguxcWOPLoX3EchVU8nrnnEHuQL73COaquSBG RNU+5NOL07s0GgIaQfkMmVltngB2RAJPQaMDE/f5wk9OZg0RwF1A3XJB71AZYR6ONm2q g59Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=idAIy7+0S11QYa5sGcSX6gc9lPvRo9Vp3l0WAuHQtjk=; b=BM95WBNdzgTmUR/ptzSAjTDG6Un7onqOlHFtTeOqfj99H++dO6Rr1KSveKHFKIyrPD 0PNNkh42rVMhRA0SGw94tJ5mOc2QtPm1SVlfoX6MR4d/vbemem3a/lMDsi90RwxQo9Hv uVQ4+vtTJTNl1Kw55ehl2joQ6DTIK37OUu/vnfojwcVpiy7RLvVTK/H8ys+3FG8gtdpO lSEVbzhSCtUqka+sFOZdN4UrFatkpdb2TP2HmFNXzS+TUJ1DD/TbbVonZMywuU69bdCa ojOtUZNEXIxbHzzxgHubg2RWPHsPqmslQtuyT97Hqa0HsFoEF0Z9VoecjgjCXTxZ+EJ4 tiTg== X-Gm-Message-State: ACgBeo3ZZRtJzxxK5ZmJyjTUZvM5zv3k0xK7LB/hKrnSqcp3zSRwhpxl 198TPhc7fxoSu12jZM3qWQmdzQ== X-Received: by 2002:a17:90a:ba11:b0:1f2:38ec:3be3 with SMTP id s17-20020a17090aba1100b001f238ec3be3mr5810238pjr.177.1659126010749; Fri, 29 Jul 2022 13:20:10 -0700 (PDT) Received: from google.com (223.103.125.34.bc.googleusercontent.com. [34.125.103.223]) by smtp.gmail.com with ESMTPSA id x22-20020aa78f16000000b0052cec54e3b8sm467009pfr.215.2022.07.29.13.20.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jul 2022 13:20:10 -0700 (PDT) Date: Fri, 29 Jul 2022 20:20:05 +0000 From: Joe Burton To: Andrii Nakryiko Cc: Joe Burton , Andrii Nakryiko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf , open list Subject: Re: [PATCH v2 bpf-next] libbpf: Add bpf_obj_get_opts() Message-ID: References: <20220719194028.4180569-1-jevburton.kernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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, Jul 27, 2022 at 04:02:43PM -0700, Andrii Nakryiko wrote: Applied both of these in v3, which I'll send out in a moment. Thanks for the feedback! > > int bpf_obj_get(const char *pathname) > > +{ > > + LIBBPF_OPTS(bpf_obj_get_opts, opts); > > if you were doing it this way, here should be an empty line. But > really you can/should just pass NULL instead of opts in this case. > > +struct bpf_obj_get_opts { > > + size_t sz; /* size of this struct for forward/backward compatibility */ > > + > > + __u32 file_flags; > > please add size_t :0; to avoid non-zero-initialized padding (we do it > in a lot of other opts structs) > TIL about this trick. Very clever.