return true;
/* Always recalc d_ino for parent */
- if (strcmp(p->name, "..") == 0)
+ if (name_is_dotdot(p->name, p->len))
return true;
/* If this is lower, then native d_ino will do */
* Recalc d_ino for '.' and for all entries if dir is impure (contains
* copied up entries)
*/
- if ((p->name[0] == '.' && p->len == 1) ||
+ if (name_is_dot(p->name, p->len) ||
ovl_test_flag(OVL_IMPURE, d_inode(rdd->dentry)))
return true;
if (!ovl_same_dev(ofs) && !p->check_xwhiteout)
goto out;
- if (p->name[0] == '.') {
+ if (name_is_dot_dotdot(p->name, p->len)) {
if (p->len == 1) {
this = dget(dir);
goto get;
}
- if (p->len == 2 && p->name[1] == '.') {
+ if (p->len == 2) {
/* we shall not be moved */
this = dget(dir->d_parent);
goto get;
return err;
list_for_each_entry_safe(p, n, list, l_node) {
- if (strcmp(p->name, ".") != 0 &&
- strcmp(p->name, "..") != 0) {
+ if (!name_is_dot_dotdot(p->name, p->len)) {
err = ovl_cache_update(path, p, true);
if (err)
return err;
struct dir_context *orig_ctx = rdt->orig_ctx;
bool res;
- if (rdt->parent_ino && namelen == 2 && !strncmp(name, "..", 2)) {
+ if (rdt->parent_ino && name_is_dotdot(name, namelen)) {
ino = rdt->parent_ino;
} else if (rdt->cache) {
struct ovl_cache_entry *p;
goto del_entry;
}
- if (p->name[0] == '.') {
- if (p->len == 1)
- goto del_entry;
- if (p->len == 2 && p->name[1] == '.')
- goto del_entry;
- }
+ if (name_is_dot_dotdot(p->name, p->len))
+ goto del_entry;
err = -ENOTEMPTY;
break;
container_of(ctx, struct ovl_readdir_data, ctx);
/* Even if d_type is not supported, DT_DIR is returned for . and .. */
- if (!strncmp(name, ".", namelen) || !strncmp(name, "..", namelen))
+ if (name_is_dot_dotdot(name, namelen))
return true;
if (d_type != DT_UNKNOWN)
list_for_each_entry(p, &list, l_node) {
struct dentry *dentry;
- if (p->name[0] == '.') {
- if (p->len == 1)
- continue;
- if (p->len == 2 && p->name[1] == '.')
- continue;
+ if (name_is_dot_dotdot(p->name, p->len)) {
+ continue;
} else if (incompat) {
pr_err("overlay with incompat feature '%s' cannot be mounted\n",
p->name);
goto out;
list_for_each_entry(p, &list, l_node) {
- if (p->name[0] == '.') {
- if (p->len == 1)
- continue;
- if (p->len == 2 && p->name[1] == '.')
- continue;
- }
+ if (name_is_dot_dotdot(p->name, p->len))
+ continue;
index = ovl_lookup_upper_unlocked(ofs, p->name, indexdir, p->len);
if (IS_ERR(index)) {
err = PTR_ERR(index);