All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined
@ 2015-11-17  6:40 Yaowei Bai
  2015-11-17  6:40 ` [PATCH 2/5] fs/namespace.c: path_is_under can be boolean Yaowei Bai
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Yaowei Bai @ 2015-11-17  6:40 UTC (permalink / raw)
  To: akpm, viro; +Cc: linux-fsdevel, linux-kernel

Currently when CONFIG_BLOCK is defined sb_is_blkdev_sb returns bool,
while when CONFIG_BLOCK is not defined it returns int. Let's keep
consistent to make sb_is_blkdev_sb return bool as well when CONFIG_BLOCK
isn't defined.

No functional change.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
 include/linux/fs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3aa5142..11505af 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2291,9 +2291,9 @@ static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void
 {
 }
 
-static inline int sb_is_blkdev_sb(struct super_block *sb)
+static inline bool sb_is_blkdev_sb(struct super_block *sb)
 {
-	return 0;
+	return false;
 }
 #endif
 extern int sync_filesystem(struct super_block *);
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] fs/namespace.c: path_is_under can be boolean
  2015-11-17  6:40 [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined Yaowei Bai
@ 2015-11-17  6:40 ` Yaowei Bai
  2015-11-17  6:40 ` [PATCH 3/5] fs/dcache.c: is_subdir " Yaowei Bai
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Yaowei Bai @ 2015-11-17  6:40 UTC (permalink / raw)
  To: akpm, viro; +Cc: linux-fsdevel, linux-kernel

This patch makes path_is_under 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     | 4 ++--
 include/linux/fs.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 0570729..b27156f 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2939,9 +2939,9 @@ bool is_path_reachable(struct mount *mnt, struct dentry *dentry,
 	return &mnt->mnt == root->mnt && is_subdir(dentry, root->dentry);
 }
 
-int path_is_under(struct path *path1, struct path *path2)
+bool path_is_under(struct path *path1, struct path *path2)
 {
-	int res;
+	bool res;
 	read_seqlock_excl(&mount_lock);
 	res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2);
 	read_sequnlock_excl(&mount_lock);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 11505af..aab8094 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2533,7 +2533,7 @@ extern struct file * open_exec(const char *);
  
 /* fs/dcache.c -- generic fs support functions */
 extern int is_subdir(struct dentry *, struct dentry *);
-extern int path_is_under(struct path *, struct path *);
+extern bool path_is_under(struct path *, struct path *);
 
 extern char *file_path(struct file *, char *, int);
 
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] fs/dcache.c: is_subdir can be boolean
  2015-11-17  6:40 [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined Yaowei Bai
  2015-11-17  6:40 ` [PATCH 2/5] fs/namespace.c: path_is_under can be boolean Yaowei Bai
@ 2015-11-17  6:40 ` Yaowei Bai
  2015-11-17 14:25 ` [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined Jeff Moyer
  2015-11-19 13:00 ` [PATCH 4/5] fs/bad_inode.c: is_bad_inode can be boolean Yaowei Bai
  3 siblings, 0 replies; 6+ messages in thread
From: Yaowei Bai @ 2015-11-17  6:40 UTC (permalink / raw)
  To: akpm, viro; +Cc: linux-fsdevel, linux-kernel

This patch makes is_subdir 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/dcache.c        | 14 +++++++-------
 include/linux/fs.h |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fs/dcache.c b/fs/dcache.c
index 5c33aeb..670f789 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -3303,18 +3303,18 @@ out:
  * @new_dentry: new dentry
  * @old_dentry: old dentry
  *
- * Returns 1 if new_dentry is a subdirectory of the parent (at any depth).
- * Returns 0 otherwise.
+ * Returns true if new_dentry is a subdirectory of the parent (at any depth).
+ * Returns false otherwise.
  * Caller must ensure that "new_dentry" is pinned before calling is_subdir()
  */
   
-int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
+bool is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
 {
-	int result;
+	bool result;
 	unsigned seq;
 
 	if (new_dentry == old_dentry)
-		return 1;
+		return true;
 
 	do {
 		/* for restarting inner loop in case of seq retry */
@@ -3325,9 +3325,9 @@ int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
 		 */
 		rcu_read_lock();
 		if (d_ancestor(old_dentry, new_dentry))
-			result = 1;
+			result = true;
 		else
-			result = 0;
+			result = false;
 		rcu_read_unlock();
 	} while (read_seqretry(&rename_lock, seq));
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index aab8094..4b23def 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2532,7 +2532,7 @@ extern ssize_t __kernel_write(struct file *, const char *, size_t, loff_t *);
 extern struct file * open_exec(const char *);
  
 /* fs/dcache.c -- generic fs support functions */
-extern int is_subdir(struct dentry *, struct dentry *);
+extern bool is_subdir(struct dentry *, struct dentry *);
 extern bool path_is_under(struct path *, struct path *);
 
 extern char *file_path(struct file *, char *, int);
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined
  2015-11-17  6:40 [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined Yaowei Bai
  2015-11-17  6:40 ` [PATCH 2/5] fs/namespace.c: path_is_under can be boolean Yaowei Bai
  2015-11-17  6:40 ` [PATCH 3/5] fs/dcache.c: is_subdir " Yaowei Bai
@ 2015-11-17 14:25 ` Jeff Moyer
  2015-11-19 13:00 ` [PATCH 4/5] fs/bad_inode.c: is_bad_inode can be boolean Yaowei Bai
  3 siblings, 0 replies; 6+ messages in thread
From: Jeff Moyer @ 2015-11-17 14:25 UTC (permalink / raw)
  To: Yaowei Bai; +Cc: akpm, viro, linux-fsdevel, linux-kernel

Yaowei Bai <baiyaowei@cmss.chinamobile.com> writes:

> Currently when CONFIG_BLOCK is defined sb_is_blkdev_sb returns bool,
> while when CONFIG_BLOCK is not defined it returns int. Let's keep
> consistent to make sb_is_blkdev_sb return bool as well when CONFIG_BLOCK
> isn't defined.
>
> No functional change.
>
> Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

> ---
>  include/linux/fs.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 3aa5142..11505af 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -2291,9 +2291,9 @@ static inline void iterate_bdevs(void (*f)(struct block_device *, void *), void
>  {
>  }
>  
> -static inline int sb_is_blkdev_sb(struct super_block *sb)
> +static inline bool sb_is_blkdev_sb(struct super_block *sb)
>  {
> -	return 0;
> +	return false;
>  }
>  #endif
>  extern int sync_filesystem(struct super_block *);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/5] fs/bad_inode.c: is_bad_inode can be boolean
  2015-11-17  6:40 [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined Yaowei Bai
                   ` (2 preceding siblings ...)
  2015-11-17 14:25 ` [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined Jeff Moyer
@ 2015-11-19 13:00 ` Yaowei Bai
  2015-11-19 13:00   ` [PATCH 5/5] fs/attr.c: is_sxid " Yaowei Bai
  3 siblings, 1 reply; 6+ messages in thread
From: Yaowei Bai @ 2015-11-19 13:00 UTC (permalink / raw)
  To: akpm, viro; +Cc: linux-fsdevel, linux-kernel

This patch makes is_bad_inode 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/bad_inode.c     | 2 +-
 include/linux/fs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bad_inode.c b/fs/bad_inode.c
index 861b1e1..103f5d7 100644
--- a/fs/bad_inode.c
+++ b/fs/bad_inode.c
@@ -192,7 +192,7 @@ EXPORT_SYMBOL(make_bad_inode);
  *	Returns true if the inode in question has been marked as bad.
  */
  
-int is_bad_inode(struct inode *inode)
+bool is_bad_inode(struct inode *inode)
 {
 	return (inode->i_op == &bad_inode_ops);	
 }
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 4b23def..6b33ac4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2371,7 +2371,7 @@ extern void init_special_inode(struct inode *, umode_t, dev_t);
 
 /* Invalid inode operations -- fs/bad_inode.c */
 extern void make_bad_inode(struct inode *);
-extern int is_bad_inode(struct inode *);
+extern bool is_bad_inode(struct inode *);
 
 #ifdef CONFIG_BLOCK
 /*
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] fs/attr.c: is_sxid can be boolean
  2015-11-19 13:00 ` [PATCH 4/5] fs/bad_inode.c: is_bad_inode can be boolean Yaowei Bai
@ 2015-11-19 13:00   ` Yaowei Bai
  0 siblings, 0 replies; 6+ messages in thread
From: Yaowei Bai @ 2015-11-19 13:00 UTC (permalink / raw)
  To: akpm, viro; +Cc: linux-fsdevel, linux-kernel

This patch makes is_sxid 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>
---
 include/linux/fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6b33ac4..bd14476 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2963,7 +2963,7 @@ int __init get_filesystem_list(char *buf);
 #define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
 					    (flag & __FMODE_NONOTIFY)))
 
-static inline int is_sxid(umode_t mode)
+static inline bool is_sxid(umode_t mode)
 {
 	return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
 }
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-19 13:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-17  6:40 [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined Yaowei Bai
2015-11-17  6:40 ` [PATCH 2/5] fs/namespace.c: path_is_under can be boolean Yaowei Bai
2015-11-17  6:40 ` [PATCH 3/5] fs/dcache.c: is_subdir " Yaowei Bai
2015-11-17 14:25 ` [PATCH 1/5] fs/block_dev.c: make sb_is_blkdev_sb return bool when CONFIG_BLOCK undefined Jeff Moyer
2015-11-19 13:00 ` [PATCH 4/5] fs/bad_inode.c: is_bad_inode can be boolean Yaowei Bai
2015-11-19 13:00   ` [PATCH 5/5] fs/attr.c: is_sxid " Yaowei Bai

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.