static inline bool fscrypt_is_dot_dotdot(const struct qstr *str)
{
- return is_dot_dotdot(str->name, str->len);
+ return name_is_dot_dotdot(str->name, str->len);
}
/**
if ((mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) &&
!(mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)) {
- if (is_dot_dotdot(name, name_size)) {
+ if (name_is_dot_dotdot(name, name_size)) {
rc = ecryptfs_copy_filename(plaintext_name,
plaintext_name_size,
name, name_size);
container_of(ctx, struct getdents_callback, ctx);
buf->sequence++;
- if (buf->ino == ino && len <= NAME_MAX && !is_dot_dotdot(name, len)) {
+ if (buf->ino == ino && len <= NAME_MAX &&
+ !name_is_dot_dotdot(name, len)) {
memcpy(buf->name, name, len);
buf->name[len] = '\0';
buf->found = 1;
int len;
if (IS_CASEFOLDED(dir) &&
- !is_dot_dotdot(fname->usr_fname->name, fname->usr_fname->len)) {
+ !name_is_dot_dotdot(fname->usr_fname->name, fname->usr_fname->len)) {
buf = f2fs_kmem_cache_alloc(f2fs_cf_name_slab,
GFP_NOFS, false, F2FS_SB(sb));
if (!buf)
WARN_ON_ONCE(!name);
- if (is_dot_dotdot(name, len)) {
+ if (name_is_dot_dotdot(name, len)) {
fname->hash = 0;
return;
}
if (!len)
return -EACCES;
- if (is_dot_dotdot(name, len))
+ if (name_is_dot_dotdot(name, len))
return -EACCES;
while (len--) {
char *cf_name;
int cf_len;
- if (!IS_ENABLED(CONFIG_UNICODE) || !rdd->map || is_dot_dotdot(str, len))
+ if (!IS_ENABLED(CONFIG_UNICODE) || !rdd->map ||
+ name_is_dot_dotdot(str, len))
return 0;
cf_name = kmalloc(NAME_MAX, GFP_KERNEL);
struct ksmbd_readdir_data *buf;
buf = container_of(ctx, struct ksmbd_readdir_data, ctx);
- if (!is_dot_dotdot(name, namlen))
+ if (!name_is_dot_dotdot(name, namlen))
buf->dirent_count++;
return !buf->dirent_count;
extern char *file_path(struct file *, char *, int);
+static inline bool name_is_dot(const char *name, size_t len)
+{
+ return unlikely(len == 1 && name[0] == '.');
+}
+
+static inline bool name_is_dotdot(const char *name, size_t len)
+{
+ return unlikely(len == 2 && name[0] == '.' && name[1] == '.');
+}
+
/**
- * is_dot_dotdot - returns true only if @name is "." or ".."
+ * name_is_dot_dotdot - returns true only if @name is "." or ".."
* @name: file name to check
* @len: length of file name, in bytes
*/
-static inline bool is_dot_dotdot(const char *name, size_t len)
+static inline bool name_is_dot_dotdot(const char *name, size_t len)
{
return len && unlikely(name[0] == '.') &&
(len == 1 || (len == 2 && name[1] == '.'));