Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4740056pxj; Tue, 25 May 2021 15:27:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIeqx2PIJXG6N1wU+8lBHO4iQqH453uJEn2KqNqeqo+kIlPtWlquXhVjS6i22cxFshwNF4 X-Received: by 2002:a50:fd17:: with SMTP id i23mr35345778eds.54.1621981657319; Tue, 25 May 2021 15:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621981657; cv=none; d=google.com; s=arc-20160816; b=BOfpCuvyrwBzSQ92SRIfcqI+XE7XI6xhSsCGCVdp920ZX+c4rllnVQ9t7d3htS3CtW 7Dny4m0+UGdlxMqWGYveg7zW/sEdthFi8304uS6Ema4VWM2XB01OdIUA7R45ysRUZjYq EXPvEExD+MZnQiSCTNLCff4FuvIUFOUTSowaqLkLPo4+8ag/y1whhOde2+rqJ9Nmyi5k qfgGs8Yq7YbG08sxS+5982ScKr+rhACIBZLZh/5CVXJLG7iUifmJAB/B0OPZfOkR86x5 na5X7uOgq0bCjnYo6b8/2orRH9o4vqen4+uxepkFdMJtucXu1igDS/v/J8hDUzv5azDX mZFw== 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=gHa/jxf5ff+nHL/HwGVIpDxyxV41oUcj3iWDlxx7pRk=; b=urcB37GgJk98nVWrFJINL4/moVEuW3TnVqIlz3hjocBFf9mInYF7L/6/GkN8/jTldz 3AdGfO4NzceNzXwMkjY9banwh9ylLXn6J2jOpG1SISqa1GvYjxPZuGMfRfoqu2quwdU7 42rCykZf6XYS+UG0wZXH9g+yJouTdkZxRoyWHRgqD3lnLeUpaMouzFUXAg7G4PVHDpLt jon/T0kibiE7+u1cdOylon5LU4z/KYKiTFbhNnU1L6qFrltSD7H2ckFQUcaM5HhFNHCf /gf4s2agTZnUHu1QfJr2PGMrfBzIsfSY8fVLIe/dCtI4mCI5nAeBTY0mV5gYyycR18cI XUsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I3d89PmS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bh7si14714358ejb.383.2021.05.25.15.27.14; Tue, 25 May 2021 15:27:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I3d89PmS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233209AbhEYUF5 (ORCPT + 99 others); Tue, 25 May 2021 16:05:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231846AbhEYUFz (ORCPT ); Tue, 25 May 2021 16:05:55 -0400 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2711C061756 for ; Tue, 25 May 2021 13:04:23 -0700 (PDT) Received: by mail-io1-xd2f.google.com with SMTP id a8so24820132ioa.12 for ; Tue, 25 May 2021 13:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gHa/jxf5ff+nHL/HwGVIpDxyxV41oUcj3iWDlxx7pRk=; b=I3d89PmSYtAAmPdU4bYuuICwd51StJRpwGaGZM5j0MPCjYFxuA6KINZq2/qzt7J4rF oEafMbx80NTxz6DzoGZ5vzJhjLTnJrv0LxpzcGDsGKQzAPvIu4be39dXnzUxM18gDITV EWdnOICM7SBsjxTA0aNsqqY4lP0Q2GGT46PQg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gHa/jxf5ff+nHL/HwGVIpDxyxV41oUcj3iWDlxx7pRk=; b=t63Etr18q0Foti4tPD0eqd4HEGiDq80ExxEVBsHB2zg/FosLRz1VWArus1hQogwkC9 1iLLNIEVu1LBdSEYCa3hYx02xese4Ajx08bm9I6cwpNeX6vEklVOEm4vPuSYpjf0CfyE qusAb3cA5WwfLYPI6TPiQ8hEOhZHBhR+kvQuOVWwiPWxVDt3W26emAha8uCNhmW8456E lw/SJEB5/olFk05d1By+9LH+t1wpWGDcDJpAOJpvsz6D7C+GLeAxryozqUN5umdL9RPC eSNUJdE0ovEcSeIllvLOmi6Q0zn66KmDD2NO+5okIRYls6NMW2rUw/O8HmNz2vi2s8G/ /8dQ== X-Gm-Message-State: AOAM531lfqsbYfgogmp+yh2qDL/y83emOf3N+N6xJ2EMffueWUay8SOD 3NdRu3Ob/pzPwFSqJ2V/ONXS3WmIubjxEKLqs+6k+g== X-Received: by 2002:a6b:e91a:: with SMTP id u26mr23484337iof.83.1621973062946; Tue, 25 May 2021 13:04:22 -0700 (PDT) MIME-Version: 1.0 References: <20210525113732.2648158-1-revest@chromium.org> In-Reply-To: From: Florent Revest Date: Tue, 25 May 2021 22:04:12 +0200 Message-ID: Subject: Re: [PATCH bpf] libbpf: Move BPF_SEQ_PRINTF and BPF_SNPRINTF to bpf_helpers.h To: Andrii Nakryiko Cc: bpf , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , KP Singh , Brendan Jackman , open list Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 25, 2021 at 9:51 PM Andrii Nakryiko wrote: > > On Tue, May 25, 2021 at 4:38 AM Florent Revest wrote: > > +#define ___bpf_concat(a, b) a ## b > > +#define ___bpf_apply(fn, n) ___bpf_concat(fn, n) > > +#define ___bpf_nth(_, _1, _2, _3, _4, _5, _6, _7, _8, _9, _a, _b, _c, N, ...) N > > +#define ___bpf_narg(...) \ > > + ___bpf_nth(_, ##__VA_ARGS__, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) > > wouldn't this conflict if both bpf_tracing.h and bpf_helpers.h are > included in the same file? Oh, yeah, somehow I thought that double macro definitions wouldn't generate warnings but it would, indeed. Silly me :) > We can probably guard this block with > custom #ifdef both in bpf_helpers.h and bpf_tracing.h to avoid > dependency on order of includes? Indeed, I think the cleanest would be: #ifndef ___bpf_concat #define ___bpf_concat(a, b) a ## b #endif #ifndef ___bpf_apply etc... I'm sending a v2.