Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1364520

[PATCH] fs/vfs: improve __mnt_is_readonly

From Yaowei Bai <baiyaowei@cmss.chinamobile.com>
Newsgroups linux.kernel
Subject [PATCH] fs/vfs: improve __mnt_is_readonly
Date 2016-03-25 03:10 +0100
Message-ID <rgpmi-391-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


This patch refactors __mnt_is_readonly and makes it return bool to
improve readability due to this particular function only using either
one or zero as its return value.

No functional change.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
 fs/namespace.c        | 9 +++------
 include/linux/mount.h | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 4fb1691..4f2facd 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -271,13 +271,10 @@ out_free_cache:
  * mnt_want/drop_write() will _keep_ the filesystem
  * r/w.
  */
-int __mnt_is_readonly(struct vfsmount *mnt)
+bool __mnt_is_readonly(struct vfsmount *mnt)
 {
-	if (mnt->mnt_flags & MNT_READONLY)
-		return 1;
-	if (mnt->mnt_sb->s_flags & MS_RDONLY)
-		return 1;
-	return 0;
+	return mnt->mnt_flags & MNT_READONLY ||
+			mnt->mnt_sb->s_flags & MS_RDONLY;
 }
 EXPORT_SYMBOL_GPL(__mnt_is_readonly);
 
diff --git a/include/linux/mount.h b/include/linux/mount.h
index f822c3c..c143e15 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -80,7 +80,7 @@ extern void mnt_drop_write_file(struct file *file);
 extern void mntput(struct vfsmount *mnt);
 extern struct vfsmount *mntget(struct vfsmount *mnt);
 extern struct vfsmount *mnt_clone_internal(struct path *path);
-extern int __mnt_is_readonly(struct vfsmount *mnt);
+extern bool __mnt_is_readonly(struct vfsmount *mnt);
 
 struct path;
 extern struct vfsmount *clone_private_mount(struct path *path);
-- 
1.9.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] fs/vfs: improve __mnt_is_readonly Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2016-03-25 03:10 +0100
  Re: [PATCH] fs/vfs: improve __mnt_is_readonly Al Viro <viro@ZenIV.linux.org.uk> - 2016-03-26 01:50 +0100
    Re: [PATCH] fs/vfs: improve __mnt_is_readonly Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2016-03-29 08:40 +0200
      Re: [PATCH] fs/vfs: improve __mnt_is_readonly Richard Weinberger <richard.weinberger@gmail.com> - 2016-03-29 11:50 +0200
        Re: [PATCH] fs/vfs: improve __mnt_is_readonly Yaowei Bai <baiyaowei@cmss.chinamobile.com> - 2016-03-30 03:30 +0200
          Re: [PATCH] fs/vfs: improve __mnt_is_readonly Richard Weinberger <richard@nod.at> - 2016-03-30 09:40 +0200

csiph-web