All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: David Sterba <dsterba@suse.com>
Subject: [PATCH 2/7] btrfs: rename btrfs_mask_flags to reflect which flags it touches
Date: Fri, 20 Apr 2018 19:02:34 +0200	[thread overview]
Message-ID: <45cf464fea354f4fbf23639104822817dc6f07d4.1524242295.git.dsterba@suse.com> (raw)
In-Reply-To: <cover.1524242295.git.dsterba@suse.com>

The FS_*_FL flags cannot be easily identified by a variable name prefix
but we still need to recognize them so the 'fsflags' should be closer to
the naming scheme but again the 'fs' part sounds like it's a filesystem
flag. I don't have a better idea for now.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ioctl.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index c3189ebf7c88..b2c26beffd82 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -93,11 +93,12 @@ static int btrfs_clone(struct inode *src, struct inode *inode,
 		       int no_time_update);
 
 /* Mask out flags that are inappropriate for the given type of inode. */
-static unsigned int btrfs_mask_flags(umode_t mode, unsigned int flags)
+static unsigned int btrfs_mask_fsflags_for_type(struct inode *inode,
+		unsigned int flags)
 {
-	if (S_ISDIR(mode))
+	if (S_ISDIR(inode->i_mode))
 		return flags;
-	else if (S_ISREG(mode))
+	else if (S_ISREG(inode->i_mode))
 		return flags & ~FS_DIRSYNC_FL;
 	else
 		return flags & (FS_NODUMP_FL | FS_NOATIME_FL);
@@ -218,7 +219,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
 	i_oldflags = inode->i_flags;
 	mode = inode->i_mode;
 
-	flags = btrfs_mask_flags(inode->i_mode, flags);
+	flags = btrfs_mask_fsflags_for_type(inode, flags);
 	oldflags = btrfs_flags_to_ioctl(ip->flags);
 	if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) {
 		if (!capable(CAP_LINUX_IMMUTABLE)) {
-- 
2.16.2


  parent reply	other threads:[~2018-04-20 17:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20 17:02 [PATCH 0/7] Add ioctl to support extended inode flags David Sterba
2018-04-20 17:02 ` [PATCH 1/7] btrfs: rename btrfs_update_iflags to reflect which flags it touches David Sterba
2018-04-20 17:02 ` David Sterba [this message]
2018-04-20 17:02 ` [PATCH 3/7] btrfs: rename check_flags " David Sterba
2018-04-20 17:02 ` [PATCH 4/7] btrfs: rename btrfs_flags_to_ioctl " David Sterba
2018-04-23  2:37   ` Misono Tomohiro
2018-04-23 13:11     ` David Sterba
2018-04-20 17:02 ` [PATCH 5/7] btrfs: add helpers for FS_XFLAG_* conversion David Sterba
2018-04-20 17:02 ` [PATCH 6/7] btrfs: add FS_IOC_FSGETXATTR ioctl David Sterba
2018-04-20 17:02 ` [PATCH 7/7] btrfs: add FS_IOC_FSSETXATTR ioctl David Sterba
2018-04-23  2:42   ` Misono Tomohiro
2018-04-23 13:14     ` David Sterba

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=45cf464fea354f4fbf23639104822817dc6f07d4.1524242295.git.dsterba@suse.com \
    --to=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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: link
Be 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.