diff options
author | David Howells <dhowells@redhat.com> | 2017-07-04 17:25:22 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-07-06 03:27:09 -0400 |
commit | cdf01226b26e98c79c13b335fbe0cbbbe850cf44 (patch) | |
tree | 979318b9a3b69b03b39f6e66d3ffa75b82565ddc /fs/dcache.c | |
parent | ee416bcdba9975065de571e09de1f7ebfde2156a (diff) | |
download | lwn-cdf01226b26e98c79c13b335fbe0cbbbe850cf44.tar.gz lwn-cdf01226b26e98c79c13b335fbe0cbbbe850cf44.zip |
VFS: Provide empty name qstr
Provide an empty name (ie. "") qstr for general use.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index a9f995f6859e..95efb7b2bf84 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -90,6 +90,11 @@ EXPORT_SYMBOL(rename_lock); static struct kmem_cache *dentry_cache __read_mostly; +const struct qstr empty_name = QSTR_INIT("", 0); +EXPORT_SYMBOL(empty_name); +const struct qstr slash_name = QSTR_INIT("/", 1); +EXPORT_SYMBOL(slash_name); + /* * This is the single most critical data structure when it comes * to the dcache: the hashtable for lookups. Somebody should try @@ -1578,8 +1583,7 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) */ dentry->d_iname[DNAME_INLINE_LEN-1] = 0; if (unlikely(!name)) { - static const struct qstr anon = QSTR_INIT("/", 1); - name = &anon; + name = &slash_name; dname = dentry->d_iname; } else if (name->len > DNAME_INLINE_LEN-1) { size_t size = offsetof(struct external_name, name[1]); |