Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6e5787f authored by Yaowei Bai's avatar Yaowei Bai Committed by Al Viro
Browse files

fs/dcache.c: is_subdir can be boolean



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: default avatarYaowei Bai <baiyaowei@cmss.chinamobile.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 25ab4c9b
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -3303,18 +3303,18 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size)
 * @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));

+1 −1
Original line number Diff line number Diff line
@@ -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);