Skip to contentSkip to conversation

namei: use QSTR() instead of QSTR_INIT() in path_pts

PATCH In review Thorsten Blum 3 participants 3 messages Apr 22 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 namei: use QSTR() instead of QSTR_INIT() in path_pts

Drop the hard-coded length argument and use the simpler QSTR().

---
 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namei.c +1 -1
index c7fac83c9a85..817bba800d7b 100644
@@ -3617,7 +3617,7 @@ int path_pts(struct path *path)
 	 */
 	struct dentry *parent = dget_parent(path->dentry);
 	struct dentry *child;
-	struct qstr this = QSTR_INIT("pts", 3);
+	struct qstr this = QSTR("pts");
 
 	if (unlikely(!path_connected(path->mnt, parent))) {
 		dput(parent);
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Thorsten Blum

Drop the hard-coded length argument and use the simpler QSTR().

Looks good. Feel free to add:

Honza

Quoted 17 lines
---
 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namei.c +1 -1
index c7fac83c9a85..817bba800d7b 100644
@@ -3617,7 +3617,7 @@ int path_pts(struct path *path)
 	 */
 	struct dentry *parent = dget_parent(path->dentry);
 	struct dentry *child;
-	struct qstr this = QSTR_INIT("pts", 3);
+	struct qstr this = QSTR("pts");
 
 	if (unlikely(!path_connected(path->mnt, parent))) {
 		dput(parent);
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer
#2 lore raw
In reply to Thorsten Blum
Quoted 12 lines · Thorsten Blum

Drop the hard-coded length argument and use the simpler QSTR().

---
 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namei.c +0 -0
index c7fac83c9a85..817bba800d7b 100644

fs/namei.c int path_pts(struct path *path) · line 3623

Quoted 8 lines
fs/namei.c +1 -1
@@ -3617,7 +3617,7 @@ int path_pts(struct path *path)
 	 */
 	struct dentry *parent = dget_parent(path->dentry);
 	struct dentry *child;
-	struct qstr this = QSTR_INIT("pts", 3);
+	struct qstr this = QSTR("pts");
 
 	if (unlikely(!path_connected(path->mnt, parent))) {
 		dput(parent);

NAK. Compound literal is an l-value, so let's just use it:

	child = d_hash_and_lookup(parent, &QSTR("pts"));

and to hell with the local variable.