Skip to content

Commit 80e5d1f

Browse files
author
Al Viro
committed
useful constants: struct qstr for ".."
Signed-off-by: Al Viro <[email protected]>
1 parent d692d39 commit 80e5d1f

File tree

10 files changed

+11
-17
lines changed

10 files changed

+11
-17
lines changed

fs/dcache.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ const struct qstr empty_name = QSTR_INIT("", 0);
8484
EXPORT_SYMBOL(empty_name);
8585
const struct qstr slash_name = QSTR_INIT("/", 1);
8686
EXPORT_SYMBOL(slash_name);
87+
const struct qstr dotdot_name = QSTR_INIT("..", 2);
88+
EXPORT_SYMBOL(dotdot_name);
8789

8890
/*
8991
* This is the single most critical data structure when it comes

fs/ext2/namei.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,10 @@ static struct dentry *ext2_lookup(struct inode * dir, struct dentry *dentry, uns
8181

8282
struct dentry *ext2_get_parent(struct dentry *child)
8383
{
84-
struct qstr dotdot = QSTR_INIT("..", 2);
8584
ino_t ino;
8685
int res;
8786

88-
res = ext2_inode_by_name(d_inode(child), &dotdot, &ino);
87+
res = ext2_inode_by_name(d_inode(child), &dotdot_name, &ino);
8988
if (res)
9089
return ERR_PTR(res);
9190

fs/ext4/namei.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,11 +1739,10 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi
17391739
struct dentry *ext4_get_parent(struct dentry *child)
17401740
{
17411741
__u32 ino;
1742-
static const struct qstr dotdot = QSTR_INIT("..", 2);
17431742
struct ext4_dir_entry_2 * de;
17441743
struct buffer_head *bh;
17451744

1746-
bh = ext4_find_entry(d_inode(child), &dotdot, &de, NULL);
1745+
bh = ext4_find_entry(d_inode(child), &dotdot_name, &de, NULL);
17471746
if (IS_ERR(bh))
17481747
return ERR_CAST(bh);
17491748
if (!bh)

fs/f2fs/dir.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,7 @@ struct f2fs_dir_entry *f2fs_find_entry(struct inode *dir,
449449

450450
struct f2fs_dir_entry *f2fs_parent_dir(struct inode *dir, struct page **p)
451451
{
452-
struct qstr dotdot = QSTR_INIT("..", 2);
453-
454-
return f2fs_find_entry(dir, &dotdot, p);
452+
return f2fs_find_entry(dir, &dotdot_name, p);
455453
}
456454

457455
ino_t f2fs_inode_by_name(struct inode *dir, const struct qstr *qstr,

fs/f2fs/namei.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,8 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir,
416416

417417
struct dentry *f2fs_get_parent(struct dentry *child)
418418
{
419-
struct qstr dotdot = QSTR_INIT("..", 2);
420419
struct page *page;
421-
unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot, &page);
420+
unsigned long ino = f2fs_inode_by_name(d_inode(child), &dotdot_name, &page);
422421
if (!ino) {
423422
if (IS_ERR(page))
424423
return ERR_CAST(page);

fs/fuse/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,14 +872,13 @@ static struct dentry *fuse_get_parent(struct dentry *child)
872872
struct inode *inode;
873873
struct dentry *parent;
874874
struct fuse_entry_out outarg;
875-
const struct qstr name = QSTR_INIT("..", 2);
876875
int err;
877876

878877
if (!fc->export_support)
879878
return ERR_PTR(-ESTALE);
880879

881880
err = fuse_lookup_name(child_inode->i_sb, get_node_id(child_inode),
882-
&name, &outarg, &inode);
881+
&dotdot_name, &outarg, &inode);
883882
if (err) {
884883
if (err == -ENOENT)
885884
return ERR_PTR(-ESTALE);

fs/nilfs2/namei.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,9 @@ static struct dentry *nilfs_get_parent(struct dentry *child)
440440
{
441441
unsigned long ino;
442442
struct inode *inode;
443-
struct qstr dotdot = QSTR_INIT("..", 2);
444443
struct nilfs_root *root;
445444

446-
ino = nilfs_inode_by_name(d_inode(child), &dotdot);
445+
ino = nilfs_inode_by_name(d_inode(child), &dotdot_name);
447446
if (!ino)
448447
return ERR_PTR(-ENOENT);
449448

fs/udf/namei.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,11 +1215,10 @@ static struct dentry *udf_get_parent(struct dentry *child)
12151215
{
12161216
struct kernel_lb_addr tloc;
12171217
struct inode *inode = NULL;
1218-
struct qstr dotdot = QSTR_INIT("..", 2);
12191218
struct fileIdentDesc cfi;
12201219
struct udf_fileident_bh fibh;
12211220

1222-
if (!udf_find_entry(d_inode(child), &dotdot, &fibh, &cfi))
1221+
if (!udf_find_entry(d_inode(child), &dotdot_name, &fibh, &cfi))
12231222
return ERR_PTR(-EACCES);
12241223

12251224
if (fibh.sbh != fibh.ebh)

fs/ufs/super.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,9 @@ static struct dentry *ufs_fh_to_parent(struct super_block *sb, struct fid *fid,
128128

129129
static struct dentry *ufs_get_parent(struct dentry *child)
130130
{
131-
struct qstr dot_dot = QSTR_INIT("..", 2);
132131
ino_t ino;
133132

134-
ino = ufs_inode_by_name(d_inode(child), &dot_dot);
133+
ino = ufs_inode_by_name(d_inode(child), &dotdot_name);
135134
if (!ino)
136135
return ERR_PTR(-ENOENT);
137136
return d_obtain_alias(ufs_iget(child->d_sb, ino));

include/linux/dcache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct qstr {
5959

6060
extern const struct qstr empty_name;
6161
extern const struct qstr slash_name;
62+
extern const struct qstr dotdot_name;
6263

6364
struct dentry_stat_t {
6465
long nr_dentry;

0 commit comments

Comments
 (0)