From: Stefan Behrens <sbehrens@giantdisaster.de> To: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, xfs@oss.sgi.com Subject: [PATCH 4/4] xfstests: Add support for btrfs in 079 Date: Thu, 28 Jul 2011 10:28:01 +0200 [thread overview] Message-ID: <0cbb002def872039fd8c0bb90ceb5f6bf0e15b02.1311776403.git.sbehrens@giantdisaster.de> (raw) In-Reply-To: <cover.1311776403.git.sbehrens@giantdisaster.de> Added btrfs to the list of supported filesystems for test 079. In src/t_immutable.c which is compiled for Linux only, add support for btrfs by replacing the ioctl(EXT2_IOC_SETFLAGS) with ioctl(FS_IOC_SETFLAGS) which is defined to be the same. Afterwards in src/t_immutable.c in function fsetflag(), share the code branch for the ext2 case also for the btrfs case. Furthermore, added missing call to ioctl(FS_IOC_GETFLAGS) to the ext3 and btrfs code branch, this was a difference to the way the XFS code branch was implemented. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> --- 079 | 4 ++-- src/t_immutable.c | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/079 b/079 index 6c43fe7..02f7607 100755 --- a/079 +++ b/079 @@ -46,7 +46,7 @@ _cleanup() . ./common.filter . ./common.attr -_supported_fs xfs +_supported_fs xfs btrfs _supported_os Linux _require_attrs @@ -55,7 +55,7 @@ _require_scratch [ -x $timmutable ] || _notrun "t_immutable was not built for this platform" # real QA test starts here -_scratch_mkfs_xfs 2>&1 >/dev/null || _fail "mkfs failed" +_scratch_mkfs 2>&1 >/dev/null || _fail "mkfs failed" _scratch_mount || _fail "mount failed" echo "*** starting up" diff --git a/src/t_immutable.c b/src/t_immutable.c index 7bb3154..9be0c2e 100644 --- a/src/t_immutable.c +++ b/src/t_immutable.c @@ -41,6 +41,8 @@ #include <xfs/xfs.h> #include <xfs/handle.h> #include <xfs/jdm.h> +#include <linux/fs.h> +#include <linux/magic.h> #define EXT2_SUPER_MAGIC 0xEF53 #define EXT2_IMMUTABLE_FL 0x00000010 @@ -55,18 +57,18 @@ extern const char *__progname; static int fsetflag(const char *path, int fd, int on, int immutable) { - int e2flags = 0; + int fsflags = 0; struct fsxattr attr; struct statfs stfs; int xfsfl; - int e2fl; + int fsfl; if (immutable) { xfsfl = XFS_XFLAG_IMMUTABLE; - e2fl = EXT2_IMMUTABLE_FL; + fsfl = FS_IMMUTABLE_FL; } else { xfsfl = XFS_XFLAG_APPEND; - e2fl = EXT2_APPEND_FL; + fsfl = FS_APPEND_FL; } if (fstatfs(fd, &stfs) != 0) @@ -85,12 +87,17 @@ static int fsetflag(const char *path, int fd, int on, int immutable) close(fd); return 1; } - } else if (stfs.f_type == EXT2_SUPER_MAGIC) { + } else if (stfs.f_type == EXT2_SUPER_MAGIC || + stfs.f_type == BTRFS_SUPER_MAGIC) { + if (ioctl(fd, FS_IOC_GETFLAGS, &fsflags) < 0) { + close(fd); + return 1; + } if (on) - e2flags |= e2fl; + fsflags |= fsfl; else - e2flags &= ~e2fl; - if (ioctl(fd, EXT2_IOC_SETFLAGS, &e2flags) < 0) { + fsflags &= ~fsfl; + if (ioctl(fd, FS_IOC_SETFLAGS, &fsflags) < 0) { close(fd); return 1; } -- 1.7.3.4
WARNING: multiple messages have this Message-ID (diff)
From: Stefan Behrens <sbehrens@giantdisaster.de> To: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, xfs@oss.sgi.com Subject: [PATCH 4/4] xfstests: Add support for btrfs in 079 Date: Thu, 28 Jul 2011 10:28:01 +0200 [thread overview] Message-ID: <0cbb002def872039fd8c0bb90ceb5f6bf0e15b02.1311776403.git.sbehrens@giantdisaster.de> (raw) In-Reply-To: <cover.1311776403.git.sbehrens@giantdisaster.de> Added btrfs to the list of supported filesystems for test 079. In src/t_immutable.c which is compiled for Linux only, add support for btrfs by replacing the ioctl(EXT2_IOC_SETFLAGS) with ioctl(FS_IOC_SETFLAGS) which is defined to be the same. Afterwards in src/t_immutable.c in function fsetflag(), share the code branch for the ext2 case also for the btrfs case. Furthermore, added missing call to ioctl(FS_IOC_GETFLAGS) to the ext3 and btrfs code branch, this was a difference to the way the XFS code branch was implemented. Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de> --- 079 | 4 ++-- src/t_immutable.c | 23 +++++++++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/079 b/079 index 6c43fe7..02f7607 100755 --- a/079 +++ b/079 @@ -46,7 +46,7 @@ _cleanup() . ./common.filter . ./common.attr -_supported_fs xfs +_supported_fs xfs btrfs _supported_os Linux _require_attrs @@ -55,7 +55,7 @@ _require_scratch [ -x $timmutable ] || _notrun "t_immutable was not built for this platform" # real QA test starts here -_scratch_mkfs_xfs 2>&1 >/dev/null || _fail "mkfs failed" +_scratch_mkfs 2>&1 >/dev/null || _fail "mkfs failed" _scratch_mount || _fail "mount failed" echo "*** starting up" diff --git a/src/t_immutable.c b/src/t_immutable.c index 7bb3154..9be0c2e 100644 --- a/src/t_immutable.c +++ b/src/t_immutable.c @@ -41,6 +41,8 @@ #include <xfs/xfs.h> #include <xfs/handle.h> #include <xfs/jdm.h> +#include <linux/fs.h> +#include <linux/magic.h> #define EXT2_SUPER_MAGIC 0xEF53 #define EXT2_IMMUTABLE_FL 0x00000010 @@ -55,18 +57,18 @@ extern const char *__progname; static int fsetflag(const char *path, int fd, int on, int immutable) { - int e2flags = 0; + int fsflags = 0; struct fsxattr attr; struct statfs stfs; int xfsfl; - int e2fl; + int fsfl; if (immutable) { xfsfl = XFS_XFLAG_IMMUTABLE; - e2fl = EXT2_IMMUTABLE_FL; + fsfl = FS_IMMUTABLE_FL; } else { xfsfl = XFS_XFLAG_APPEND; - e2fl = EXT2_APPEND_FL; + fsfl = FS_APPEND_FL; } if (fstatfs(fd, &stfs) != 0) @@ -85,12 +87,17 @@ static int fsetflag(const char *path, int fd, int on, int immutable) close(fd); return 1; } - } else if (stfs.f_type == EXT2_SUPER_MAGIC) { + } else if (stfs.f_type == EXT2_SUPER_MAGIC || + stfs.f_type == BTRFS_SUPER_MAGIC) { + if (ioctl(fd, FS_IOC_GETFLAGS, &fsflags) < 0) { + close(fd); + return 1; + } if (on) - e2flags |= e2fl; + fsflags |= fsfl; else - e2flags &= ~e2fl; - if (ioctl(fd, EXT2_IOC_SETFLAGS, &e2flags) < 0) { + fsflags &= ~fsfl; + if (ioctl(fd, FS_IOC_SETFLAGS, &fsflags) < 0) { close(fd); return 1; } -- 1.7.3.4 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2011-07-28 8:28 UTC|newest] Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-07-28 8:27 [PATCH 0/4] xfstests: Add support for btrfs in a couple of xfstests Stefan Behrens 2011-07-28 8:27 ` Stefan Behrens 2011-07-28 8:27 ` [PATCH 1/4] xfstests: Add support for btrfs in 062 Stefan Behrens 2011-07-28 8:27 ` Stefan Behrens 2011-07-28 8:45 ` Christoph Hellwig 2011-07-28 8:45 ` Christoph Hellwig 2011-07-28 17:51 ` Stefan Behrens 2011-07-28 17:51 ` Stefan Behrens 2011-07-28 8:27 ` [PATCH 2/4] xfstests: Add support for btrfs in 083, 117, 120 and 192 Stefan Behrens 2011-07-28 8:27 ` Stefan Behrens 2011-07-28 8:46 ` Christoph Hellwig 2011-07-28 8:46 ` Christoph Hellwig 2011-07-28 8:28 ` [PATCH 3/4] xfstests: Add support for btrfs in 015 Stefan Behrens 2011-07-28 8:28 ` Stefan Behrens 2011-07-28 8:47 ` Christoph Hellwig 2011-07-28 8:47 ` Christoph Hellwig 2011-07-28 17:54 ` Stefan Behrens 2011-07-28 17:54 ` Stefan Behrens 2011-07-28 20:05 ` Christoph Hellwig 2011-07-28 20:05 ` Christoph Hellwig 2011-07-28 8:28 ` Stefan Behrens [this message] 2011-07-28 8:28 ` [PATCH 4/4] xfstests: Add support for btrfs in 079 Stefan Behrens 2011-07-28 8:51 ` Christoph Hellwig 2011-07-28 8:51 ` Christoph Hellwig 2011-07-29 12:24 ` Stefan Behrens 2011-07-29 12:24 ` Stefan Behrens 2011-07-29 12:30 ` Christoph Hellwig 2011-07-29 12:30 ` Christoph Hellwig 2011-07-29 14:30 ` Stefan Behrens 2011-07-29 14:30 ` Stefan Behrens
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=0cbb002def872039fd8c0bb90ceb5f6bf0e15b02.1311776403.git.sbehrens@giantdisaster.de \ --to=sbehrens@giantdisaster.de \ --cc=linux-btrfs@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=xfs@oss.sgi.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.