From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64B59C433EF for ; Thu, 23 Jun 2022 21:22:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229837AbiFWVWn (ORCPT ); Thu, 23 Jun 2022 17:22:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229581AbiFWVWk (ORCPT ); Thu, 23 Jun 2022 17:22:40 -0400 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 150894DF46 for ; Thu, 23 Jun 2022 14:22:40 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id B4D4A240029 for ; Thu, 23 Jun 2022 23:22:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1656019358; bh=13z+K4njtIfx/wWw8OlBFQPCnKQNDKrac+Iq3GVZknM=; h=From:To:Cc:Subject:Date:From; b=XYwrt/Y8l8VCCnMsrNMiKcf1w/k7bQHSg6/vf7u2MFdpJmAa6PNTuia9i8zXpc4HH MQp/Q0UWYJqcv5cJHyGsosikK/BWusCV82VyD5OjTZJ114GOTQB6lEf0Bp9hyetOJQ 0IF/vRUZa89bnToUlvpPXNmuzG4nclZdH3dp1wz2A340K4DicXMR60ttzp8U+r0UkE B8CPFKDURM/+t4Fzq47I2tCWAyi+hck9RC8Xu/RYnaOX5zkbY/ulpZ68WcB4AJD9u5 c5JIGLZzngO+vWcrPC2e+6+6BEmkfNF/RFPnWfHAZPXTQB2mMs6zQiDlZKv1ON40zt /z9Hoke5Bh2Tw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LTYB612S4z6tmb; Thu, 23 Jun 2022 23:22:38 +0200 (CEST) From: =?UTF-8?q?Daniel=20M=C3=BCller?= To: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net, kernel-team@fb.com Cc: joannelkoong@gmail.com Subject: [PATCH bpf-next v2 5/9] bpf: Add type match support Date: Thu, 23 Jun 2022 21:22:01 +0000 Message-Id: <20220623212205.2805002-6-deso@posteo.net> In-Reply-To: <20220623212205.2805002-1-deso@posteo.net> References: <20220623212205.2805002-1-deso@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org This change implements the kernel side of the "type matches" support, just calling the previously added core logic in relo_core.c. Signed-off-by: Daniel Müller --- kernel/bpf/btf.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index f08037..d06855d 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -7524,6 +7524,15 @@ int bpf_core_types_are_compat(const struct btf *local_btf, __u32 local_id, MAX_TYPES_ARE_COMPAT_DEPTH); } +#define MAX_TYPES_MATCH_DEPTH 2 + +int bpf_core_types_match(const struct btf *local_btf, u32 local_id, + const struct btf *targ_btf, u32 targ_id) +{ + return __bpf_core_types_match(local_btf, local_id, targ_btf, targ_id, + MAX_TYPES_MATCH_DEPTH); +} + static bool bpf_core_is_flavor_sep(const char *s) { /* check X___Y name pattern, where X and Y are not underscores */ -- 2.30.2