useful constants: struct qstr for ".."
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 15 Apr 2021 23:46:50 +0000 (19:46 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 16 Apr 2021 02:36:45 +0000 (22:36 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/dcache.c
fs/ext2/namei.c
fs/ext4/namei.c
fs/f2fs/dir.c
fs/f2fs/namei.c
fs/fuse/inode.c
fs/nilfs2/namei.c
fs/udf/namei.c
fs/ufs/super.c
include/linux/dcache.h

index 7d24ff7eb20680e5df01851ffa9cc227a5ab4a13..cf871a81f4fdcc5501463c3c3a35e4aac3c03eec 100644 (file)
@@ -84,6 +84,8 @@ const struct qstr empty_name = QSTR_INIT("", 0);
 EXPORT_SYMBOL(empty_name);
 const struct qstr slash_name = QSTR_INIT("/", 1);
 EXPORT_SYMBOL(slash_name);
+const struct qstr dotdot_name = QSTR_INIT("..", 2);
+EXPORT_SYMBOL(dotdot_name);
 
 /*
  * This is the single most critical data structure when it comes
index 3367384d344d0b7dcfdd3cb92a1ee33b6997f2b6..765fb389550f36ce1d4d6a3491dad4f32f2b634b 100644 (file)
@@ -81,11 +81,10 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, uns
 
 struct dentry *ext2_get_parent(struct dentry *child)
 {
-       struct qstr dotdot = QSTR_INIT("..", 2);
        ino_t ino;
        int res;
 
-       res = ext2_inode_by_name(d_inode(child), &dotdot, &ino);
+       res = ext2_inode_by_name(d_inode(child), &dotdot_name, &ino);
        if (res)
                return ERR_PTR(res);
 
index 686bf982c84e9e59764914f5cf9fd9e0a7229c6e..a9db885abb8b4f332a7c2c3f13173a4f1083c8cd 100644 (file)
@@ -1739,11 +1739,10 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
 struct dentry *ext4_get_parent(struct dentry *child)
 {
        __u32 ino;
-       static const struct qstr dotdot = QSTR_INIT("..", 2);
        struct ext4_dir_entry_2 * de;
        struct buffer_head *bh;
 
-       bh = ext4_find_entry(d_inode(child), &dotdot, &de, NULL);
+       bh = ext4_find_entry(d_inode(child), &dotdot_name, &de, NULL);
        if (IS_ERR(bh))
                return ERR_CAST(bh);
        if (!bh)
index e6270a867be138a58e7a867c8780e96a3415d165..e211a1b6b013a0b5de8bac85b5db69548b03b032 100644 (file)
@@ -449,9 +449,7 @@ struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir,
 
 struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p)
 {
-       struct qstr dotdot = QSTR_INIT("..", 2);
-
-       return f2fs_find_entry(dir, &dotdot, p);
+       return f2fs_find_entry(dir, &dotdot_name, p);
 }
 
 ino_t f2fs_inode_by_name(struct inode *dir, const struct qstr *qstr,
index 17bd072a5d393f9880d543f735db0d58d834d215..f2ad7931e9492b179b389719d0918761979838e7 100644 (file)
@@ -416,9 +416,8 @@ out:
 
 struct dentry *f2fs_get_parent(struct dentry *child)
 {
-       struct qstr dotdot = QSTR_INIT("..", 2);
        struct page *page;
-       unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot, &page);
+       unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot_name, &page);
        if (!ino) {
                if (IS_ERR(page))
                        return ERR_CAST(page);
index b0e18b470e918dc04154e7def993e84cf610eb6b..8665e4d2469187e33e6300b13664d4696c6c6a5c 100644 (file)
@@ -872,14 +872,13 @@ static struct dentry *fuse_get_parent(struct dentry *child)
        struct inode *inode;
        struct dentry *parent;
        struct fuse_entry_out outarg;
-       const struct qstr name = QSTR_INIT("..", 2);
        int err;
 
        if (!fc->export_support)
                return ERR_PTR(-ESTALE);
 
        err = fuse_lookup_name(child_inode->i_sb, get_node_id(child_inode),
-                              &name, &outarg, &inode);
+                              &dotdot_name, &outarg, &inode);
        if (err) {
                if (err == -ENOENT)
                        return ERR_PTR(-ESTALE);
index ecace5f96a95623d8409ef9de8c800a1745af8aa..b2709874ced5ed81f091d4e71e7698d8c207adbe 100644 (file)
@@ -440,10 +440,9 @@ static struct dentry *nilfs_get_parent(struct dentry *child)
 {
        unsigned long ino;
        struct inode *inode;
-       struct qstr dotdot = QSTR_INIT("..", 2);
        struct nilfs_root *root;
 
-       ino = nilfs_inode_by_name(d_inode(child), &dotdot);
+       ino = nilfs_inode_by_name(d_inode(child), &dotdot_name);
        if (!ino)
                return ERR_PTR(-ENOENT);
 
index f146b3089f3dae2b007da9d74c42909452fa61da..3ae9f1e9198460c9e03a6841bc2fd99944f9f548 100644 (file)
@@ -1215,11 +1215,10 @@ static struct dentry *udf_get_parent(struct dentry *child)
 {
        struct kernel_lb_addr tloc;
        struct inode *inode = NULL;
-       struct qstr dotdot = QSTR_INIT("..", 2);
        struct fileIdentDesc cfi;
        struct udf_fileident_bh fibh;
 
-       if (!udf_find_entry(d_inode(child), &dotdot, &fibh, &cfi))
+       if (!udf_find_entry(d_inode(child), &dotdot_name, &fibh, &cfi))
                return ERR_PTR(-EACCES);
 
        if (fibh.sbh != fibh.ebh)
index 983558b572c70b3d87fe6657caa0db093812b15e..74028b5a7b0ae3f984f11d67d9e2d273e47a7109 100644 (file)
@@ -128,10 +128,9 @@ static struct dentry *ufs_fh_to_parent(struct super_block *sb, struct fid *fid,
 
 static struct dentry *ufs_get_parent(struct dentry *child)
 {
-       struct qstr dot_dot = QSTR_INIT("..", 2);
        ino_t ino;
 
-       ino = ufs_inode_by_name(d_inode(child), &dot_dot);
+       ino = ufs_inode_by_name(d_inode(child), &dotdot_name);
        if (!ino)
                return ERR_PTR(-ENOENT);
        return d_obtain_alias(ufs_iget(child->d_sb, ino));
index 4ecde5d8250ccdc49f515e19196b614d1a873c3b..9e23d33bb6f1c853d7c22aa03d6bcd9b3c823cd2 100644 (file)
@@ -59,6 +59,7 @@ struct qstr {
 
 extern const struct qstr empty_name;
 extern const struct qstr slash_name;
+extern const struct qstr dotdot_name;
 
 struct dentry_stat_t {
        long nr_dentry;