From patchwork Thu Jun 20 14:18:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 1119484 X-Patchwork-Delegate: chrubis@suse.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.linux.it (client-ip=213.254.12.146; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cWYSjMpe"; dkim-atps=neutral Received: from picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45V3nh0lYQz9s7h for ; Fri, 21 Jun 2019 00:18:15 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 7451C2988E4 for ; Thu, 20 Jun 2019 16:18:13 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-2.smtp.seeweb.it (in-2.smtp.seeweb.it [217.194.8.2]) by picard.linux.it (Postfix) with ESMTP id 207FE2987AF for ; Thu, 20 Jun 2019 16:18:11 +0200 (CEST) Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by in-2.smtp.seeweb.it (Postfix) with ESMTPS id B9C4D601A99 for ; Thu, 20 Jun 2019 16:18:10 +0200 (CEST) Received: by mail-wm1-x341.google.com with SMTP id 207so3280673wma.1 for ; Thu, 20 Jun 2019 07:18:10 -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; bh=+kQmCOseqLv6Jl2b+T9jD3YQ8itIJxPX1X7+U80daGE=; b=cWYSjMpeUIEpJzurGb+55YR160OfdD21SWzXBjinOc+Z1Q81K2BhRVMPpbKMLh7Cho WPzA/qfTHgByCya/tfGQrSpC7MgJIqYjcOINeFcWCVYLmTT7zmcCrQhmDD3DqDEOt897 8rPDHVsJIeYOoydBYrw1ehxsy81f5IHMGxpojPWGPljp5pghlx9H8Me0l6T2n+WcmfvA abQ+BKQJrPVM1calgDuDwYIHQUIerB2i/kj6UKNDRlSKiFFkjIk8Ntl5hqIbImH031C1 vTcPbMk6dqEs+2bXLiPI6KRs04JZr66LgSaO2G0Aq0++2NmVYh45I7wFFId8zN8iTjWH GSMg== 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; bh=+kQmCOseqLv6Jl2b+T9jD3YQ8itIJxPX1X7+U80daGE=; b=dMhWPNAQvTzMiGWno2b/sHnvmzqyEP9a62MfUgdBK3ODqZRu9pSYmJYzS0y1EZykVc DDEfIZfEAwemhrE/NpuJM6NyErkY/rr23mRz/MZhK8sxYskE+XOC2Pj3/ac2r/gREayl WfeKSpflKeIDDlKbQxV7K9goZR26fxZW4olkwjDXOO8HwPvOEgQFoaJxQwIuUgxT2q2z o666NR8MbliklIUTMv26hFUTnTnJW4FttgBZDGDGgb9x2dg6ACNwzilkitJszH8T4KGQ OZyZescAACCufRt+PU6dj/kNRkxslc3/KB7cVDd2ocxtgT6if0+MjnuLvgqDh1iTUdk/ 7z8w== X-Gm-Message-State: APjAAAWhVl/1NqGBnBgkkkbERcvODx4MugGmRk56b4zrwjLCCGv90GEX gDyFyuXJraRvaI5Wa9dPyTdRqZ5/ X-Google-Smtp-Source: APXvYqyRwi1SA2xJZWZ+q/VvtSRX3/m6uSMlS2kxJhLoxk9r1cjFI0mF+JZNXSLrpm4V3NtMPY5Jxw== X-Received: by 2002:a1c:ef10:: with SMTP id n16mr2832126wmh.134.1561040290189; Thu, 20 Jun 2019 07:18:10 -0700 (PDT) Received: from amir-ThinkPad-T480.ctera.local (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id q12sm18946525wrp.50.2019.06.20.07.18.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Jun 2019 07:18:09 -0700 (PDT) From: Amir Goldstein To: Petr Vorel Date: Thu, 20 Jun 2019 17:18:04 +0300 Message-Id: <20190620141804.20902-1-amir73il@gmail.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: clamav-milter 0.99.2 at in-2.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.1 required=7.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, SPF_HELO_NONE, SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-2.smtp.seeweb.it Cc: Jan Kara , ltp@lists.linux.it Subject: [LTP] [PATCH] syscalls/fanotify: fix build errors on centos 6 X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.18 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Do not try to build fanotify1[35] and helpers when system does not support name_to_handle_at(). Signed-off-by: Amir Goldstein --- Petr, This patch is on top of Matthew's series. Please see if it fixed build errors you reported in centos 6. Thanks, Amir. testcases/kernel/syscalls/fanotify/fanotify.h | 16 +++++++--------- testcases/kernel/syscalls/fanotify/fanotify13.c | 4 ++++ testcases/kernel/syscalls/fanotify/fanotify15.c | 4 ++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h index f9803c1cc..1c7623d3b 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify.h +++ b/testcases/kernel/syscalls/fanotify/fanotify.h @@ -125,21 +125,22 @@ struct fanotify_event_info_header { uint16_t len; }; +#ifdef HAVE_NAME_TO_HANDLE_AT struct fanotify_event_info_fid { struct fanotify_event_info_header hdr; __kernel_fsid_t fsid; unsigned char handle[0]; }; - +#endif #endif +#ifdef HAVE_NAME_TO_HANDLE_AT /* - * Helper function used to obtain __kernel_fsid_t and file_handle objects - * for a given path. Used by test files correlated to FAN_REPORT_FID - * functionality. + * Helper function used to obtain fsid and file_handle for a given path. + * Used by test files correlated to FAN_REPORT_FID functionality. */ static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid, - struct file_handle *handle) + struct file_handle *handle) { int mount_id; struct statfs stats; @@ -149,7 +150,6 @@ static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid, "statfs(%s, ...) failed", path); memcpy(fsid, &stats.f_fsid, sizeof(stats.f_fsid)); -#ifdef HAVE_NAME_TO_HANDLE_AT if (name_to_handle_at(AT_FDCWD, path, handle, &mount_id, 0) == -1) { if (errno == EOPNOTSUPP) { tst_brk(TCONF, @@ -159,10 +159,8 @@ static inline void fanotify_get_fid(const char *path, __kernel_fsid_t *fsid, tst_brk(TBROK | TERRNO, "name_to_handle_at(AT_FDCWD, %s, ...) failed", path); } -#else - tst_brk(TCONF, "name_to_handle_at() is not implmented"); -#endif /* HAVE_NAME_TO_HANDLE_AT */ } +#endif /* HAVE_NAME_TO_HANDLE_AT */ #define INIT_FANOTIFY_MARK_TYPE(t) \ { FAN_MARK_ ## t, "FAN_MARK_" #t } diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c index 8f9baacfa..e5681c804 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify13.c +++ b/testcases/kernel/syscalls/fanotify/fanotify13.c @@ -38,6 +38,7 @@ #define FILE_PATH_ONE MOUNT_PATH"/"FILE_ONE #define FILE_PATH_TWO MOUNT_PATH"/"FILE_TWO +#if defined(HAVE_NAME_TO_HANDLE_AT) struct event_t { unsigned long long expected_mask; __kernel_fsid_t fsid; @@ -323,6 +324,9 @@ static struct tst_test test = { .all_filesystems = 1 }; +#else + TST_TEST_TCONF("System does not have required name_to_handle_at() support"); +#endif #else TST_TEST_TCONF("System does not have required fanotify support"); #endif diff --git a/testcases/kernel/syscalls/fanotify/fanotify15.c b/testcases/kernel/syscalls/fanotify/fanotify15.c index 6981b7891..e9e926078 100644 --- a/testcases/kernel/syscalls/fanotify/fanotify15.c +++ b/testcases/kernel/syscalls/fanotify/fanotify15.c @@ -35,6 +35,7 @@ #define FILE1 TEST_DIR"/file1" #define FILE2 TEST_DIR"/file2" +#if defined(HAVE_NAME_TO_HANDLE_AT) struct event_t { unsigned long long mask; __kernel_fsid_t fsid; @@ -241,6 +242,9 @@ static struct tst_test test = { .cleanup = do_cleanup }; +#else + TST_TEST_TCONF("System does not have required name_to_handle_at() support"); +#endif #else TST_TEST_TCONF("System does not have required fanotify support"); #endif