Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp280009pxy; Thu, 22 Apr 2021 01:51:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQEecyHtHCP4eCJKAfFSXg3nBFJ0cSLcBWLtXWqo7hRKHYdioKWFsS+gqKHUWRvmZIwmV4 X-Received: by 2002:a17:906:8a79:: with SMTP id hy25mr2213473ejc.461.1619081476945; Thu, 22 Apr 2021 01:51:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619081476; cv=none; d=google.com; s=arc-20160816; b=PE5xCPfNkUcwxVB3fi6EIlecr/dHJaXwg1xX9Ot1r8OvEzBdHYx+wq032GNdqsQLMu jPjqcFmM0unzj6DTd0XRDi8UqzNkMCmHnOASwpDH3DEHxpVHliuULgaQSahxSsHAGVBc Yx4H2x6CNlPrhkBKdWyc276XDF6O988hZVdWbcwEoIACN9uRjvdOdVDkkXsHY5w5c0al Db20D7WxbVudXVtlBdpGhuow7i4lmmP0uBWXG8Kb7oJidp8YK1yFqz+uSSYYuMeQpz40 hz1/NLGfsosRWmEpSptxd4FW2eSuPFzqP/xxdtqWwC10UWc0povpIN5lFDPDMbh4bIrW wicA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lR3tEJkc0UfX+rxeKczp/hoK1T+iX+xo4rtGRKTZLtc=; b=SGXhVdzgHtIhax4l4OcDo+yaJ06ZhHqmGkeA+zEOJIeDS5pQyVaD5s//LEeSzBrmMA DGXM8tZttkAf1E/jucAW6kqKKPYXWSZacdmUMH63gkpOeYRlx69Cqki/8q/ON2iz5HGx 1BhieTBojnLv1KSxSPGZXCWucDBUB5agwxuSSh+9TXLkWUiiumS+54Rqke1sPl/7oYkY vIJRmpPRM/X0TapxH3donzKUD6Jwb/sWvc6w2Mk/NwBqDvQPscvVbLwwQfIa/i8amK97 WRln9ofUsvzqPe5/1VqECUaZwOOjKAMFM7kZCGQ5A6uYk/jeh5kcnyluFcSZqRIElyAw p4Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Fpfx6yCu; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si2033530edt.42.2021.04.22.01.50.53; Thu, 22 Apr 2021 01:51:16 -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=@gmail.com header.s=20161025 header.b=Fpfx6yCu; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235513AbhDVIsG (ORCPT + 99 others); Thu, 22 Apr 2021 04:48:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235075AbhDVIsF (ORCPT ); Thu, 22 Apr 2021 04:48:05 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1617FC06174A; Thu, 22 Apr 2021 01:47:30 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id s7so43850429wru.6; Thu, 22 Apr 2021 01:47:30 -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=lR3tEJkc0UfX+rxeKczp/hoK1T+iX+xo4rtGRKTZLtc=; b=Fpfx6yCuo2IVunfhJrPBTeRrVDVlIPPskGp8xhklUUnsPp+F8+U5URXmI91VZB3C+v 3e9kYzhPE5BPLWXLmsH5fpR2ze9Xze+ouvGO+lT/cuR5WHOGhFm9hhlR4fRrasGmqKN5 Cns/ACg0NTfqejj40M+VsQguSf/hiW7MIycqUpiWHi4R2NuiHbMUcz4kBJf9mdGVfbAU PA0NcqZ/E4jb57glx9D+U3X8OXuj3DcoSLDxQWulRXWeHQKhqQFlwNA6Q7rWOd7+3RbH 1KbIaJgAzeKpB5LsB7l3pFH0qqRatf8Sof7X/cLiuGZ+uG+TZ9IPbZLtAmeUE3JDDIzc 3L6g== 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=lR3tEJkc0UfX+rxeKczp/hoK1T+iX+xo4rtGRKTZLtc=; b=ddwQIZJyTDIsBnalf+gcYehommASDKl2FCgr2kG4cMSlbyN+4lNSJJt1ZcPUJJsvYn exdYiaQWjlTzboday9r9rn+cNIsaL1/zWVHhHLaaJzmhkKxqwz/OHOMoPPEJEdH06YLk SXctfghVv1jddH4ALPh/F4Q1Jkr67MV5+To+Qv01Vw/vuD13hhEKv82DHo3zVF9HN2GT HXBe6MfxejknDK1gE9YqJVz+ZeQxi0ApzWwcGVuwEhB5+ZPfxzVfgbjMSMwC105XSTXD zqpXQWez/oWZebyaukk+wgyU0UIiY12Xb+ggvjRWE1mV1MgM9od/LOyFmoN/xMT1aeMu xOxw== X-Gm-Message-State: AOAM531R5yRQUFWiX9NoWuTzld9KEIupQs62vyizbJLLi2SZit5l84sO 9uKxNkPsisfWi3XWusxwNojcaUW+g3k= X-Received: by 2002:a5d:564a:: with SMTP id j10mr2779707wrw.108.1619081248595; Thu, 22 Apr 2021 01:47:28 -0700 (PDT) Received: from hthiery.fritz.box (ip1f1322f8.dynamic.kabel-deutschland.de. [31.19.34.248]) by smtp.gmail.com with ESMTPSA id v4sm2300553wme.14.2021.04.22.01.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Apr 2021 01:47:28 -0700 (PDT) From: Heiko Thiery To: netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Stephen Hemminger , Petr Vorel , Heiko Thiery Subject: [PATCH] lib/fs: fix issue when {name, open}_to_handle_at() is not implemented Date: Thu, 22 Apr 2021 10:46:13 +0200 Message-Id: <20210422084612.26374-1-heiko.thiery@gmail.com> X-Mailer: git-send-email 2.30.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- configure | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/fs.c | 25 ++++++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/configure b/configure index 2c363d3b..f1be9977 100755 --- a/configure +++ b/configure @@ -202,6 +202,58 @@ 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 "IP_CONFIG_NAME_TO_HANDLE_AT:=y" >>$CONFIG + echo "yes" + echo "CFLAGS += -DHAVE_NAME_TO_HANDLE_AT" >>$CONFIG + else + echo "no" + fi + rm -f $TMPDIR/name_to_handle_at_test.c $TMPDIR/name_to_handle_at_test +} + +check_open_by_handle_at() +{ + + cat >$TMPDIR/open_by_handle_at_test.c < +#include +#include +int main(int argc, char **argv) +{ + struct file_handle *fhp; + int mount_fd; + open_by_handle_at(mount_fd, fhp, O_RDONLY); + return 0; +} +EOF + if $CC -I$INCLUDE -o $TMPDIR/open_by_handle_at_test $TMPDIR/open_by_handle_at_test.c >/dev/null 2>&1; then + echo "IP_CONFIG_OPEN_BY_HANDLE_AT:=y" >>$CONFIG + echo "yes" + echo "CFLAGS += -DHAVE_OPEN_BY_HANDLE_AT" >>$CONFIG + else + echo "no" + fi + rm -f $TMPDIR/open_by_handle_at_test.c $TMPDIR/open_by_handle_at_test +} + check_ipset() { cat >$TMPDIR/ipsettest.c <