fs: Create a generic is_dot_dotdot() utility
De-duplicate the same functionality in several places by hoisting the is_dot_dotdot() utility function into linux/fs.h. Suggested-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Amir Goldstein <amir73il@gmail.com> Acked-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
@ -244,16 +244,6 @@ struct getdents_callback {
|
||||
int sequence; /* sequence counter */
|
||||
};
|
||||
|
||||
/* Copied from lookup_one_common() */
|
||||
static inline bool is_dot_dotdot(const char *name, size_t len)
|
||||
{
|
||||
if (unlikely(name[0] == '.')) {
|
||||
if (len < 2 || (len == 2 && name[1] == '.'))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* A rather strange filldir function to capture
|
||||
* the name matching the specified inode number.
|
||||
|
Reference in New Issue
Block a user