From patchwork Fri Apr 30 06:26:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Thiery X-Patchwork-Id: 12232651 X-Patchwork-Delegate: dsahern@gmail.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A0FDC433ED for ; Fri, 30 Apr 2021 06:27:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C830E61406 for ; Fri, 30 Apr 2021 06:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230296AbhD3G14 (ORCPT ); Fri, 30 Apr 2021 02:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbhD3G1z (ORCPT ); Fri, 30 Apr 2021 02:27:55 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FEB8C06174A; Thu, 29 Apr 2021 23:27:07 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id zg3so21958255ejb.8; Thu, 29 Apr 2021 23:27:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8xs0dLpLOjPpVnPASrxUlEldZYCSMQdMwxiE4uRpAVE=; b=pu4dCg8wMqoLaZPNo8l7m4HVzy2AtSPH3urmWWJi6lxKe3sQB0YkCFA92/ekiD3Nmj H+Gjtagm5Nq99uGgYAbTcrO7Cz3c7uNT+wFofH9KFOR4sUe0QjFWlpMVsyGFts7XfsrT FS5ztKRbjzsA3Nen6RKla4rc5ELSL0ddt5WvwOZPO1m4VD6Sq7sZsqWOWp6aeAhW1YtH ocURZNj2SPULTShaGB9+EgwAADrEjTKdxpK8RBy3Q6zJAiFkW3JYmv9o/AED9yJ97oJT w8U70NxkBBZo+qXE3BzTLbwhRFrUMNdhU+bFhN2LAKRO4CKaLtsLDVIDONNVm+H6hUgc 01bQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=8xs0dLpLOjPpVnPASrxUlEldZYCSMQdMwxiE4uRpAVE=; b=mqImM7fgBRvMBJwZF5zQs6gmr7MXmPBxjfuDz5bmFOFb1NwnISGpZabCnBh1NbFQoA 2z2udPokH7MsEnO/VYPoY87yCh5JK08fE8lsPJsEooT2552fGgNT8HaPZL+qiIiJuXDP eQcjLGZPNJdnDDPUEoMWwg4UIOz1l5sihwPPBQu7LA5NZa+1UhOHI6wXLQOqrMMhGP8J p7tay4O8RF/XlJSMiL86zcBXswG2zika190NXNge8+S9Oh2FLlP5upj4zXBsggnZw/8j X7q9Bgn6sVfwmCdGFyH8wJQcVKS0noBe0TA7KjmmZZFFimufDRdkUxaQB5V6sUGbVKdX Wv6g== X-Gm-Message-State: AOAM530h0Fn0YCyx2QQZvoPFAtUussEWP0q2lk45yw0Nt5kPuwY4Rm04 zoDmccM7C4CaSF3zH8fPnisTFXdfmPm17zhS X-Google-Smtp-Source: ABdhPJyN2Zjlu4gMwzZK3/UIZfzpjM6SXt3u0by49Vj39i49qf/OqoNGtvzB807YpqspQntGeEiOuQ== X-Received: by 2002:a17:906:2287:: with SMTP id p7mr2432792eja.377.1619764025915; Thu, 29 Apr 2021 23:27:05 -0700 (PDT) Received: from hthiery.kontron.local ([213.135.10.150]) by smtp.gmail.com with ESMTPSA id p4sm1340958ejr.81.2021.04.29.23.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Apr 2021 23:27:05 -0700 (PDT) From: Heiko Thiery To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Stephen Hemminger , Petr Vorel , Heiko Thiery Subject: [PATCH iproute2-next v2] lib/fs: fix issue when {name,open}_to_handle_at() is not implemented Date: Fri, 30 Apr 2021 08:26:33 +0200 Message-Id: <20210430062632.21304-1-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: dsahern@gmail.com With commit d5e6ee0dac64b64e the usage of functions name_to_handle_at() and open_by_handle_at() are introduced. But these function are not available e.g. in uclibc-ng < 1.0.35. To have a backward compatibility check for the availability in the configure script and in case of absence do a direct syscall. Signed-off-by: Heiko Thiery --- v2: - small correction to subject - removed IP_CONFIG_HANDLE_AT:=y option since it is not required - fix indentation in check function - removed empty lines (thanks to Petr Vorel) - add #define _GNU_SOURCE in check (thanks to Petr Vorel) - check only for name_to_handle_at (thanks to Peter Vorel) configure | 28 ++++++++++++++++++++++++++++ lib/fs.c | 21 +++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/configure b/configure index 2c363d3b..179eae08 100755 --- a/configure +++ b/configure @@ -202,6 +202,31 @@ EOF rm -f $TMPDIR/setnstest.c $TMPDIR/setnstest } +check_name_to_handle_at() +{ + cat >$TMPDIR/name_to_handle_at_test.c < +#include +#include +int main(int argc, char **argv) +{ + struct file_handle *fhp; + int mount_id, flags, dirfd; + char *pathname; + name_to_handle_at(dirfd, pathname, fhp, &mount_id, flags); + return 0; +} +EOF + if $CC -I$INCLUDE -o $TMPDIR/name_to_handle_at_test $TMPDIR/name_to_handle_at_test.c >/dev/null 2>&1; then + echo "yes" + echo "CFLAGS += -DHAVE_HANDLE_AT" >>$CONFIG + else + echo "no" + fi + rm -f $TMPDIR/name_to_handle_at_test.c $TMPDIR/name_to_handle_at_test +} + check_ipset() { cat >$TMPDIR/ipsettest.c <