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 X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS 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 19D7BC43218 for ; Tue, 11 Jun 2019 07:48:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EAB95212F5 for ; Tue, 11 Jun 2019 07:48:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404480AbfFKHsy (ORCPT ); Tue, 11 Jun 2019 03:48:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49718 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404064AbfFKHsy (ORCPT ); Tue, 11 Jun 2019 03:48:54 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5207C04B2F6; Tue, 11 Jun 2019 07:48:53 +0000 (UTC) Received: from localhost (dhcp-12-130.nay.redhat.com [10.66.12.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E16E60BCD; Tue, 11 Jun 2019 07:48:50 +0000 (UTC) From: Murphy Zhou To: liwang@redhat.com Cc: ltp@lists.linux.it, amir73il@gmail.com, chrubis@suse.cz, linux-fsdevel@vger.kernel.org, Murphy Zhou Subject: [PATCH v7 3/4] syscalls/swapon/swapon0{1..3}: use helpers to check support status Date: Tue, 11 Jun 2019 15:47:40 +0800 Message-Id: <20190611074741.31903-3-xzhou@redhat.com> In-Reply-To: <20190611074741.31903-1-xzhou@redhat.com> References: <20190611074741.31903-1-xzhou@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 11 Jun 2019 07:48:53 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Of swap operations. Reviewed-by: Li Wang Signed-off-by: Murphy Zhou --- testcases/kernel/syscalls/swapon/swapon01.c | 11 ++--------- testcases/kernel/syscalls/swapon/swapon02.c | 13 +++---------- testcases/kernel/syscalls/swapon/swapon03.c | 15 ++++----------- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/testcases/kernel/syscalls/swapon/swapon01.c b/testcases/kernel/syscalls/swapon/swapon01.c index 32538f82b..f95ce0ab2 100644 --- a/testcases/kernel/syscalls/swapon/swapon01.c +++ b/testcases/kernel/syscalls/swapon/swapon01.c @@ -84,16 +84,9 @@ static void setup(void) tst_tmpdir(); - switch ((fs_type = tst_fs_type(cleanup, "."))) { - case TST_NFS_MAGIC: - case TST_TMPFS_MAGIC: - tst_brkm(TCONF, cleanup, - "Cannot do swapon on a file on %s filesystem", - tst_fs_type_name(fs_type)); - break; - } + is_swap_supported(cleanup, "./tstswap"); - make_swapfile(cleanup, "swapfile01"); + make_swapfile(cleanup, "swapfile01", 0); } static void cleanup(void) diff --git a/testcases/kernel/syscalls/swapon/swapon02.c b/testcases/kernel/syscalls/swapon/swapon02.c index 4af5105c6..3d49d0c6b 100644 --- a/testcases/kernel/syscalls/swapon/swapon02.c +++ b/testcases/kernel/syscalls/swapon/swapon02.c @@ -132,18 +132,11 @@ static void setup(void) tst_tmpdir(); - switch ((fs_type = tst_fs_type(cleanup, "."))) { - case TST_NFS_MAGIC: - case TST_TMPFS_MAGIC: - tst_brkm(TCONF, cleanup, - "Cannot do swapon on a file on %s filesystem", - tst_fs_type_name(fs_type)); - break; - } + is_swap_supported(cleanup, "./tstswap"); SAFE_TOUCH(cleanup, "notswap", 0777, NULL); - make_swapfile(cleanup, "swapfile01"); - make_swapfile(cleanup, "alreadyused"); + make_swapfile(cleanup, "swapfile01", 0); + make_swapfile(cleanup, "alreadyused", 0); if (ltp_syscall(__NR_swapon, "alreadyused", 0)) { if (fs_type != TST_BTRFS_MAGIC || errno != EINVAL) diff --git a/testcases/kernel/syscalls/swapon/swapon03.c b/testcases/kernel/syscalls/swapon/swapon03.c index 955ac247b..cef57150c 100644 --- a/testcases/kernel/syscalls/swapon/swapon03.c +++ b/testcases/kernel/syscalls/swapon/swapon03.c @@ -153,7 +153,7 @@ static int setup_swap(void) int j, fd; int status; int res = 0; - char filename[15]; + char filename[FILENAME_MAX]; char buf[BUFSIZ + 1]; /* Find out how many swapfiles (1 line per entry) already exist */ @@ -210,7 +210,7 @@ static int setup_swap(void) } /* Create the swapfile */ - make_swapfile(cleanup, filename); + make_swapfile(cleanup, filename, 0); /* turn on the swap file */ res = ltp_syscall(__NR_swapon, filename, 0); @@ -246,7 +246,7 @@ static int setup_swap(void) /* Create all needed extra swapfiles for testing */ for (j = 0; j < testfiles; j++) - make_swapfile(cleanup, swap_testfiles[j].filename); + make_swapfile(cleanup, swap_testfiles[j].filename, 0); return 0; @@ -333,14 +333,7 @@ static void setup(void) tst_tmpdir(); - switch ((fs_type = tst_fs_type(cleanup, "."))) { - case TST_NFS_MAGIC: - case TST_TMPFS_MAGIC: - tst_brkm(TCONF, cleanup, - "Cannot do swapon on a file on %s filesystem", - tst_fs_type_name(fs_type)); - break; - } + is_swap_supported(cleanup, "./tstswap"); TEST_PAUSE; } -- 2.21.0 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Murphy Zhou Date: Tue, 11 Jun 2019 15:47:40 +0800 Subject: [LTP] [PATCH v7 3/4] syscalls/swapon/swapon0{1..3}: use helpers to check support status In-Reply-To: <20190611074741.31903-1-xzhou@redhat.com> References: <20190611074741.31903-1-xzhou@redhat.com> Message-ID: <20190611074741.31903-3-xzhou@redhat.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it Of swap operations. Reviewed-by: Li Wang Signed-off-by: Murphy Zhou --- testcases/kernel/syscalls/swapon/swapon01.c | 11 ++--------- testcases/kernel/syscalls/swapon/swapon02.c | 13 +++---------- testcases/kernel/syscalls/swapon/swapon03.c | 15 ++++----------- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/testcases/kernel/syscalls/swapon/swapon01.c b/testcases/kernel/syscalls/swapon/swapon01.c index 32538f82b..f95ce0ab2 100644 --- a/testcases/kernel/syscalls/swapon/swapon01.c +++ b/testcases/kernel/syscalls/swapon/swapon01.c @@ -84,16 +84,9 @@ static void setup(void) tst_tmpdir(); - switch ((fs_type = tst_fs_type(cleanup, "."))) { - case TST_NFS_MAGIC: - case TST_TMPFS_MAGIC: - tst_brkm(TCONF, cleanup, - "Cannot do swapon on a file on %s filesystem", - tst_fs_type_name(fs_type)); - break; - } + is_swap_supported(cleanup, "./tstswap"); - make_swapfile(cleanup, "swapfile01"); + make_swapfile(cleanup, "swapfile01", 0); } static void cleanup(void) diff --git a/testcases/kernel/syscalls/swapon/swapon02.c b/testcases/kernel/syscalls/swapon/swapon02.c index 4af5105c6..3d49d0c6b 100644 --- a/testcases/kernel/syscalls/swapon/swapon02.c +++ b/testcases/kernel/syscalls/swapon/swapon02.c @@ -132,18 +132,11 @@ static void setup(void) tst_tmpdir(); - switch ((fs_type = tst_fs_type(cleanup, "."))) { - case TST_NFS_MAGIC: - case TST_TMPFS_MAGIC: - tst_brkm(TCONF, cleanup, - "Cannot do swapon on a file on %s filesystem", - tst_fs_type_name(fs_type)); - break; - } + is_swap_supported(cleanup, "./tstswap"); SAFE_TOUCH(cleanup, "notswap", 0777, NULL); - make_swapfile(cleanup, "swapfile01"); - make_swapfile(cleanup, "alreadyused"); + make_swapfile(cleanup, "swapfile01", 0); + make_swapfile(cleanup, "alreadyused", 0); if (ltp_syscall(__NR_swapon, "alreadyused", 0)) { if (fs_type != TST_BTRFS_MAGIC || errno != EINVAL) diff --git a/testcases/kernel/syscalls/swapon/swapon03.c b/testcases/kernel/syscalls/swapon/swapon03.c index 955ac247b..cef57150c 100644 --- a/testcases/kernel/syscalls/swapon/swapon03.c +++ b/testcases/kernel/syscalls/swapon/swapon03.c @@ -153,7 +153,7 @@ static int setup_swap(void) int j, fd; int status; int res = 0; - char filename[15]; + char filename[FILENAME_MAX]; char buf[BUFSIZ + 1]; /* Find out how many swapfiles (1 line per entry) already exist */ @@ -210,7 +210,7 @@ static int setup_swap(void) } /* Create the swapfile */ - make_swapfile(cleanup, filename); + make_swapfile(cleanup, filename, 0); /* turn on the swap file */ res = ltp_syscall(__NR_swapon, filename, 0); @@ -246,7 +246,7 @@ static int setup_swap(void) /* Create all needed extra swapfiles for testing */ for (j = 0; j < testfiles; j++) - make_swapfile(cleanup, swap_testfiles[j].filename); + make_swapfile(cleanup, swap_testfiles[j].filename, 0); return 0; @@ -333,14 +333,7 @@ static void setup(void) tst_tmpdir(); - switch ((fs_type = tst_fs_type(cleanup, "."))) { - case TST_NFS_MAGIC: - case TST_TMPFS_MAGIC: - tst_brkm(TCONF, cleanup, - "Cannot do swapon on a file on %s filesystem", - tst_fs_type_name(fs_type)); - break; - } + is_swap_supported(cleanup, "./tstswap"); TEST_PAUSE; } -- 2.21.0