Skip to content

Commit a86bf22

Browse files
committed
Merge tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs cleanups from Al Viro: "Two unrelated patches - one is a removal of long-obsolete include in overlayfs (it used to need fs/internal.h, but the extern it wanted has been moved back to include/linux/namei.h) and another introduces convenience helper constructing struct qstr by a NUL-terminated string" * tag 'pull-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: add a string-to-qstr constructor fs/overlayfs/namei.c: get rid of include ../internal.h
2 parents c270ab5 + c1feab9 commit a86bf22

File tree

11 files changed

+13
-24
lines changed

11 files changed

+13
-24
lines changed

fs/anon_inodes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ static struct inode *anon_inode_make_secure_inode(
6060
const struct inode *context_inode)
6161
{
6262
struct inode *inode;
63-
const struct qstr qname = QSTR_INIT(name, strlen(name));
6463
int error;
6564

6665
inode = alloc_anon_inode(anon_inode_mnt->mnt_sb);
6766
if (IS_ERR(inode))
6867
return inode;
6968
inode->i_flags &= ~S_PRIVATE;
70-
error = security_inode_init_security_anon(inode, &qname, context_inode);
69+
error = security_inode_init_security_anon(inode, &QSTR(name),
70+
context_inode);
7171
if (error) {
7272
iput(inode);
7373
return ERR_PTR(error);

fs/bcachefs/fsck.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ static int reattach_inode(struct btree_trans *trans, struct bch_inode_unpacked *
450450
return ret;
451451

452452
struct bch_hash_info dir_hash = bch2_hash_info_init(c, &lostfound);
453-
struct qstr name = (struct qstr) QSTR(name_buf);
453+
struct qstr name = QSTR(name_buf);
454454

455455
inode->bi_dir = lostfound.bi_inum;
456456

fs/bcachefs/recovery.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include <linux/sort.h>
3333
#include <linux/stat.h>
3434

35-
#define QSTR(n) { { { .len = strlen(n) } }, .name = n }
3635

3736
int bch2_btree_lost_data(struct bch_fs *c, enum btree_id btree)
3837
{

fs/bcachefs/util.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,8 +670,6 @@ static inline int cmp_le32(__le32 l, __le32 r)
670670

671671
#include <linux/uuid.h>
672672

673-
#define QSTR(n) { { { .len = strlen(n) } }, .name = n }
674-
675673
static inline bool qstr_eq(const struct qstr l, const struct qstr r)
676674
{
677675
return l.len == r.len && !memcmp(l.name, r.name, l.len);

fs/erofs/xattr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ int erofs_getxattr(struct inode *inode, int index, const char *name,
407407
}
408408

409409
it.index = index;
410-
it.name = (struct qstr)QSTR_INIT(name, strlen(name));
410+
it.name = QSTR(name);
411411
if (it.name.len > EROFS_NAME_LEN)
412412
return -ERANGE;
413413

fs/file_table.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,7 @@ static struct file *alloc_file(const struct path *path, int flags,
351351
static inline int alloc_path_pseudo(const char *name, struct inode *inode,
352352
struct vfsmount *mnt, struct path *path)
353353
{
354-
struct qstr this = QSTR_INIT(name, strlen(name));
355-
356-
path->dentry = d_alloc_pseudo(mnt->mnt_sb, &this);
354+
path->dentry = d_alloc_pseudo(mnt->mnt_sb, &QSTR(name));
357355
if (!path->dentry)
358356
return -ENOMEM;
359357
path->mnt = mntget(mnt);

fs/kernfs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
927927
if (!inode)
928928
continue;
929929

930-
name = (struct qstr)QSTR_INIT(kn->name, strlen(kn->name));
930+
name = QSTR(kn->name);
931931
parent = kernfs_get_parent(kn);
932932
if (parent) {
933933
p_inode = ilookup(info->sb, kernfs_ino(parent));

fs/overlayfs/namei.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#include <linux/exportfs.h>
1515
#include "overlayfs.h"
1616

17-
#include "../internal.h" /* for vfs_path_lookup */
18-
1917
struct ovl_lookup_data {
2018
struct super_block *sb;
2119
const struct ovl_layer *layer;

include/linux/dcache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ struct qstr {
5757
};
5858

5959
#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
60+
#define QSTR(n) (struct qstr)QSTR_INIT(n, strlen(n))
6061

6162
extern const struct qstr empty_name;
6263
extern const struct qstr slash_name;

mm/secretmem.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,13 @@ static struct file *secretmem_file_create(unsigned long flags)
195195
struct file *file;
196196
struct inode *inode;
197197
const char *anon_name = "[secretmem]";
198-
const struct qstr qname = QSTR_INIT(anon_name, strlen(anon_name));
199198
int err;
200199

201200
inode = alloc_anon_inode(secretmem_mnt->mnt_sb);
202201
if (IS_ERR(inode))
203202
return ERR_CAST(inode);
204203

205-
err = security_inode_init_security_anon(inode, &qname, NULL);
204+
err = security_inode_init_security_anon(inode, &QSTR(anon_name), NULL);
206205
if (err) {
207206
file = ERR_PTR(err);
208207
goto err_free_inode;

net/sunrpc/rpc_pipe.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ static int __rpc_rmpipe(struct inode *dir, struct dentry *dentry)
630630
static struct dentry *__rpc_lookup_create_exclusive(struct dentry *parent,
631631
const char *name)
632632
{
633-
struct qstr q = QSTR_INIT(name, strlen(name));
633+
struct qstr q = QSTR(name);
634634
struct dentry *dentry = d_hash_and_lookup(parent, &q);
635635
if (!dentry) {
636636
dentry = d_alloc(parent, &q);
@@ -1190,8 +1190,7 @@ static const struct rpc_filelist files[] = {
11901190
struct dentry *rpc_d_lookup_sb(const struct super_block *sb,
11911191
const unsigned char *dir_name)
11921192
{
1193-
struct qstr dir = QSTR_INIT(dir_name, strlen(dir_name));
1194-
return d_hash_and_lookup(sb->s_root, &dir);
1193+
return d_hash_and_lookup(sb->s_root, &QSTR(dir_name));
11951194
}
11961195
EXPORT_SYMBOL_GPL(rpc_d_lookup_sb);
11971196

@@ -1300,11 +1299,9 @@ rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data)
13001299
struct dentry *gssd_dentry;
13011300
struct dentry *clnt_dentry = NULL;
13021301
struct dentry *pipe_dentry = NULL;
1303-
struct qstr q = QSTR_INIT(files[RPCAUTH_gssd].name,
1304-
strlen(files[RPCAUTH_gssd].name));
13051302

13061303
/* We should never get this far if "gssd" doesn't exist */
1307-
gssd_dentry = d_hash_and_lookup(root, &q);
1304+
gssd_dentry = d_hash_and_lookup(root, &QSTR(files[RPCAUTH_gssd].name));
13081305
if (!gssd_dentry)
13091306
return ERR_PTR(-ENOENT);
13101307

@@ -1314,9 +1311,8 @@ rpc_gssd_dummy_populate(struct dentry *root, struct rpc_pipe *pipe_data)
13141311
goto out;
13151312
}
13161313

1317-
q.name = gssd_dummy_clnt_dir[0].name;
1318-
q.len = strlen(gssd_dummy_clnt_dir[0].name);
1319-
clnt_dentry = d_hash_and_lookup(gssd_dentry, &q);
1314+
clnt_dentry = d_hash_and_lookup(gssd_dentry,
1315+
&QSTR(gssd_dummy_clnt_dir[0].name));
13201316
if (!clnt_dentry) {
13211317
__rpc_depopulate(gssd_dentry, gssd_dummy_clnt_dir, 0, 1);
13221318
pipe_dentry = ERR_PTR(-ENOENT);

0 commit comments

Comments
 (0)