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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
Yaowei Bai <[email protected]> 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 <[email protected]>
Reviewed-by: Jeff Moyer <[email protected]>
> ---
> 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 *);
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 <[email protected]>
---
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
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 <[email protected]>
---
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