From patchwork Thu Feb 22 16:12:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roxana Nicolescu X-Patchwork-Id: 1902846 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TgdTX3Ghcz23d2 for ; Fri, 23 Feb 2024 03:12:48 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rdBgd-0002hQ-5v; Thu, 22 Feb 2024 16:12:39 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rdBgZ-0002fN-8C for kernel-team@lists.ubuntu.com; Thu, 22 Feb 2024 16:12:35 +0000 Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 5887140606 for ; Thu, 22 Feb 2024 16:12:34 +0000 (UTC) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-1dbde77b6f1so52978355ad.1 for ; Thu, 22 Feb 2024 08:12:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708618353; x=1709223153; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=02LZ/2fOnybhvn2xGyrKbrirw3y9pbP60D65CTGOo5U=; b=E2uhXmB5OF69HGG0DG07SXYadRK2QJabrgxZEmcggDpjt6fgMe+wx2GIrblk7Sobhz AWSDr+8KDGvGLcceCZZxImRaLYgW4sqoCJJ3SfIImkdI/Lnurrz8VKUcKgOyhoM5HExo 2pMoo8DBgnoz4gmQCaADp6kI3IDL8XnDFxmGeAsg6g4KUqYAr+aMgSAW4YMt1JAgLZ12 lUfYHwsUCmz1YpMmVY0gF036WA8j/dAuTRrcYN9KpExjVtStC3L0+dE4v4vKeXHsEt3Z ef8JTIFweN7+r+2jE0DGlz8W0gs9KrBROcGaLBplQL9lt0vFYHpzRs9/NK4g0izlYlWR kwcA== X-Gm-Message-State: AOJu0YzVUEgPhxbdFCEjxvn+U8G81ViydCErWzZAR1vA3eh0IfheIsn4 pADYehbZelhEpDQCGWJx0C4qjw5BjUzSKJSy1/qMcaAUsYdaDF60L6kpdhsPwl3Lasb4xbWH6Z0 2xalOgtZ27uIo58tLbVOGQQ9YsXsmm+0mvWOUfjLmiDlu7ZsFs/OS2S9ODyzharlfpuCfvbUjWU LdJFi9dJajFAUa X-Received: by 2002:a17:902:e801:b0:1dc:30ab:406b with SMTP id u1-20020a170902e80100b001dc30ab406bmr5997931plg.13.1708618352964; Thu, 22 Feb 2024 08:12:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIRi55Z5qGEFIN+zTC/GXsCP3LKYXXf/fOduEppxYVEGfXg56ESxUphtcrRpuaWmytr89xnA== X-Received: by 2002:a17:902:e801:b0:1dc:30ab:406b with SMTP id u1-20020a170902e80100b001dc30ab406bmr5997913plg.13.1708618352672; Thu, 22 Feb 2024 08:12:32 -0800 (PST) Received: from work.lan ([2001:67c:1560:8007::aac:c490]) by smtp.gmail.com with ESMTPSA id t11-20020a170902dccb00b001db598be5b6sm10047964pll.186.2024.02.22.08.12.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 08:12:32 -0800 (PST) From: Roxana Nicolescu To: kernel-team@lists.ubuntu.com Subject: [SRU][J][PATCH 1/1] libbpf: Rename DECLARE_LIBBPF_OPTS into LIBBPF_OPTS Date: Thu, 22 Feb 2024 17:12:18 +0100 Message-Id: <20240222161218.118394-2-roxana.nicolescu@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222161218.118394-1-roxana.nicolescu@canonical.com> References: <20240222161218.118394-1-roxana.nicolescu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Andrii Nakryiko BugLink: https://bugs.launchpad.net/bugs/2054567 It's confusing that libbpf-provided helper macro doesn't start with LIBBPF. Also "declare" vs "define" is confusing terminology, I can never remember and always have to look up previous examples. Bypass both issues by renaming DECLARE_LIBBPF_OPTS into a short and clean LIBBPF_OPTS. To avoid breaking existing code, provide: #define DECLARE_LIBBPF_OPTS LIBBPF_OPTS in libbpf_legacy.h. We can decide later if we ever want to remove it or we'll keep it forever because it doesn't add any maintainability burden. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Acked-by: Dave Marchevsky Link: https://lore.kernel.org/bpf/20211103220845.2676888-2-andrii@kernel.org (cherry picked from commit be80e9cdbca8ac66d09e0e24e0bd41d992362a0b) Signed-off-by: Roxana Nicolescu --- tools/lib/bpf/bpf.h | 1 + tools/lib/bpf/libbpf_common.h | 2 +- tools/lib/bpf/libbpf_legacy.h | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h index 49bd43b998c8..02e690862cfa 100644 --- a/tools/lib/bpf/bpf.h +++ b/tools/lib/bpf/bpf.h @@ -29,6 +29,7 @@ #include #include "libbpf_common.h" +#include "libbpf_legacy.h" #ifdef __cplusplus extern "C" { diff --git a/tools/lib/bpf/libbpf_common.h b/tools/lib/bpf/libbpf_common.h index 947d8bd8a7bb..770b11b4c0e1 100644 --- a/tools/lib/bpf/libbpf_common.h +++ b/tools/lib/bpf/libbpf_common.h @@ -30,7 +30,7 @@ * including any extra padding, it with memset() and then assigns initial * values provided by users in struct initializer-syntax as varargs. */ -#define DECLARE_LIBBPF_OPTS(TYPE, NAME, ...) \ +#define LIBBPF_OPTS(TYPE, NAME, ...) \ struct TYPE NAME = ({ \ memset(&NAME, 0, sizeof(struct TYPE)); \ (struct TYPE) { \ diff --git a/tools/lib/bpf/libbpf_legacy.h b/tools/lib/bpf/libbpf_legacy.h index df0d03dcffab..5914867c509a 100644 --- a/tools/lib/bpf/libbpf_legacy.h +++ b/tools/lib/bpf/libbpf_legacy.h @@ -51,6 +51,7 @@ enum libbpf_strict_mode { LIBBPF_API int libbpf_set_strict_mode(enum libbpf_strict_mode mode); +#define DECLARE_LIBBPF_OPTS LIBBPF_OPTS #ifdef __cplusplus } /* extern "C" */