From patchwork Thu Aug 16 08:45:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Yang X-Patchwork-Id: 958156 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=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=cn.fujitsu.com Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41rg0g4C8pz9s47 for ; Thu, 16 Aug 2018 18:46:11 +1000 (AEST) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 554C03E64D2 for ; Thu, 16 Aug 2018 10:46:08 +0200 (CEST) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-3.smtp.seeweb.it (in-3.smtp.seeweb.it [217.194.8.3]) by picard.linux.it (Postfix) with ESMTP id 8A9403E64D0 for ; Thu, 16 Aug 2018 10:46:03 +0200 (CEST) Received: from heian.cn.fujitsu.com (mail.cn.fujitsu.com [183.91.158.132]) by in-3.smtp.seeweb.it (Postfix) with ESMTP id A67BA1A00F6C for ; Thu, 16 Aug 2018 10:46:02 +0200 (CEST) X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="43532036" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 16 Aug 2018 16:45:54 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id 994C44B6EC66; Thu, 16 Aug 2018 16:45:51 +0800 (CST) Received: from RHEL7U5Alpha_SERVER.g08.fujitsu.local (10.167.220.156) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.399.0; Thu, 16 Aug 2018 16:45:55 +0800 From: Xiao Yang To: Date: Thu, 16 Aug 2018 16:45:44 +0800 Message-ID: <1534409147-29519-1-git-send-email-yangx.jy@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <20180815114220.GA26923@rei> References: <20180815114220.GA26923@rei> MIME-Version: 1.0 X-Originating-IP: [10.167.220.156] X-yoursite-MailScanner-ID: 994C44B6EC66.AA144 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: yangx.jy@cn.fujitsu.com X-Spam-Status: No, score=0.0 required=7.0 tests=none autolearn=disabled version=3.4.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-3.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-3.smtp.seeweb.it Cc: ltp@lists.linux.it Subject: [LTP] [PATCH v2 1/4] lib/tst_path_has_mnt_flags.c: Factor out tst_path_has_mnt_flags() for new API 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: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" We can use existed tst_path_has_mnt_flags() to check whether a path is on a filesystem that is mounted with specified flags, so ensure that the function can also be used by new API. Signed-off-by: Xiao Yang --- include/old/test.h | 13 +------------ include/tst_path_has_mnt_flags.h | 22 ++++++++++++++++++++++ include/tst_test.h | 1 + 3 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 include/tst_path_has_mnt_flags.h diff --git a/include/old/test.h b/include/old/test.h index 5eef304..25d7152 100644 --- a/include/old/test.h +++ b/include/old/test.h @@ -64,6 +64,7 @@ #include "old_tmpdir.h" #include "tst_minmax.h" #include "tst_get_bad_addr.h" +#include "tst_path_has_mnt_flags.h" /* * Ensure that NUMSIGS is defined. @@ -236,18 +237,6 @@ unsigned short tst_get_unused_port(void (cleanup_fn)(void), const char *tst_strsig(int sig); const char *tst_strerrno(int err); -/* lib/tst_path_has_mnt_flags.c - * - * Check whether a path is on a filesystem that is mounted with - * specified flags - * @path: path to file, if path is NULL tst_tmpdir is used. - * @flags: NULL or NULL terminated array of mount flags - * - * Return: 0..n - number of flags matched - */ -int tst_path_has_mnt_flags(void (cleanup_fn)(void), - const char *path, const char *flags[]); - #ifdef TST_USE_COMPAT16_SYSCALL #define TCID_BIT_SUFFIX "_16" #elif TST_USE_NEWER64_SYSCALL diff --git a/include/tst_path_has_mnt_flags.h b/include/tst_path_has_mnt_flags.h new file mode 100644 index 0000000..1b16f1b --- /dev/null +++ b/include/tst_path_has_mnt_flags.h @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (c) 2018 FUJITSU LIMITED. All rights reserved. + * Author: Xiao Yang + */ + +#ifndef TST_PATH_HAS_MNT_FLAGS_H__ +#define TST_PATH_HAS_MNT_FLAGS_H__ + +/* lib/tst_path_has_mnt_flags.c + * + * Check whether a path is on a filesystem that is mounted with + * specified flags + * @path: path to file, if path is NULL tst_tmpdir is used. + * @flags: NULL or NULL terminated array of mount flags + * + * Return: 0..n - number of flags matched + */ +int tst_path_has_mnt_flags(void (*cleanup_fn)(void), + const char *path, const char *flags[]); + +#endif /* TST_PATH_HAS_MNT_FLAGS_H__ */ diff --git a/include/tst_test.h b/include/tst_test.h index 98dacf3..f7d109a 100644 --- a/include/tst_test.h +++ b/include/tst_test.h @@ -41,6 +41,7 @@ #include "tst_kernel.h" #include "tst_minmax.h" #include "tst_get_bad_addr.h" +#include "tst_path_has_mnt_flags.h" /* * Reports testcase result.