Skip to contentSkip to conversation

isofs: use QSTR_LEN() in isofs_cmp

PATCH In review Thorsten Blum 2 participants 2 messages Apr 20

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 isofs: use QSTR_LEN() in isofs_cmp

Use QSTR_LEN() and inline the code in isofs_cmp(). Remove the stale function comment while at it.

---
 fs/isofs/namei.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
fs/isofs/namei.c +2 -9
index 8dd3911717e0..3ace3d6a55e7 100644
@@ -10,20 +10,13 @@
 #include <linux/gfp.h>
 #include "isofs.h"
 
-/*
- * ok, we cannot use strncmp, as the name is not in our data space.
- * Thus we'll have to use isofs_match. No big problem. Match also makes
- * some sanity tests.
- */
 static int
 isofs_cmp(struct dentry *dentry, const char *compare, int dlen)
 {
-	struct qstr qstr;
-	qstr.name = compare;
-	qstr.len = dlen;
 	if (likely(!dentry->d_op))
 		return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen);
-	return dentry->d_op->d_compare(NULL, dentry->d_name.len, dentry->d_name.name, &qstr);
+	return dentry->d_op->d_compare(NULL, dentry->d_name.len, dentry->d_name.name,
+				       &QSTR_LEN(compare, dlen));
 }
 
 /*
maintainer
#1 lore raw
Quoted 4 lines · Thorsten Blum

Use QSTR_LEN() and inline the code in isofs_cmp(). Remove the stale function comment while at it.

Thanks. I've added the patch to my tree.

Honza

Quoted 31 lines
---
 fs/isofs/namei.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
fs/isofs/namei.c +2 -9
index 8dd3911717e0..3ace3d6a55e7 100644
@@ -10,20 +10,13 @@
 #include <linux/gfp.h>
 #include "isofs.h"
 
-/*
- * ok, we cannot use strncmp, as the name is not in our data space.
- * Thus we'll have to use isofs_match. No big problem. Match also makes
- * some sanity tests.
- */
 static int
 isofs_cmp(struct dentry *dentry, const char *compare, int dlen)
 {
-	struct qstr qstr;
-	qstr.name = compare;
-	qstr.len = dlen;
 	if (likely(!dentry->d_op))
 		return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen);
-	return dentry->d_op->d_compare(NULL, dentry->d_name.len, dentry->d_name.name, &qstr);
+	return dentry->d_op->d_compare(NULL, dentry->d_name.len, dentry->d_name.name,
+				       &QSTR_LEN(compare, dlen));
 }
 
 /*
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR