Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

get rid of 'parent' argument of ->d_compare()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 6fa67e70 d3fe1985

+40 -38
+1 -1
Documentation/filesystems/Locking
··· 12 12 int (*d_revalidate)(struct dentry *, unsigned int); 13 13 int (*d_weak_revalidate)(struct dentry *, unsigned int); 14 14 int (*d_hash)(const struct dentry *, struct qstr *); 15 - int (*d_compare)(const struct dentry *, const struct dentry *, 15 + int (*d_compare)(const struct dentry *, 16 16 unsigned int, const char *, const struct qstr *); 17 17 int (*d_delete)(struct dentry *); 18 18 int (*d_init)(struct dentry *);
+7
Documentation/filesystems/porting
··· 585 585 in the instances. Rationale: !@#!@# security_d_instantiate() needs to be 586 586 called before we attach dentry to inode and !@#!@##!@$!$#!@#$!@$!@$ smack 587 587 ->d_instantiate() uses not just ->getxattr() but ->setxattr() as well. 588 + -- 589 + [mandatory] 590 + ->d_compare() doesn't get parent as a separate argument anymore. If you 591 + used it for finding the struct super_block involved, dentry->d_sb will 592 + work just as well; if it's something more complicated, use dentry->d_parent. 593 + Just be careful not to assume that fetching it more than once will yield 594 + the same value - in RCU mode it could change under you.
+1 -1
Documentation/filesystems/vfs.txt
··· 931 931 int (*d_revalidate)(struct dentry *, unsigned int); 932 932 int (*d_weak_revalidate)(struct dentry *, unsigned int); 933 933 int (*d_hash)(const struct dentry *, struct qstr *); 934 - int (*d_compare)(const struct dentry *, const struct dentry *, 934 + int (*d_compare)(const struct dentry *, 935 935 unsigned int, const char *, const struct qstr *); 936 936 int (*d_delete)(const struct dentry *); 937 937 int (*d_init)(struct dentry *);
+1 -1
drivers/staging/lustre/lustre/llite/dcache.c
··· 78 78 * INVALID) so d_lookup() matches it, but we have no lock on it (so 79 79 * lock_match() fails) and we spin around real_lookup(). 80 80 */ 81 - static int ll_dcompare(const struct dentry *parent, const struct dentry *dentry, 81 + static int ll_dcompare(const struct dentry *dentry, 82 82 unsigned int len, const char *str, 83 83 const struct qstr *name) 84 84 {
+1 -1
fs/adfs/dir.c
··· 227 227 * requirements of the underlying filesystem. 228 228 */ 229 229 static int 230 - adfs_compare(const struct dentry *parent, const struct dentry *dentry, 230 + adfs_compare(const struct dentry *dentry, 231 231 unsigned int len, const char *str, const struct qstr *name) 232 232 { 233 233 int i;
+4 -4
fs/affs/namei.c
··· 14 14 15 15 static int affs_toupper(int ch); 16 16 static int affs_hash_dentry(const struct dentry *, struct qstr *); 17 - static int affs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 17 + static int affs_compare_dentry(const struct dentry *dentry, 18 18 unsigned int len, const char *str, const struct qstr *name); 19 19 static int affs_intl_toupper(int ch); 20 20 static int affs_intl_hash_dentry(const struct dentry *, struct qstr *); 21 - static int affs_intl_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 21 + static int affs_intl_compare_dentry(const struct dentry *dentry, 22 22 unsigned int len, const char *str, const struct qstr *name); 23 23 24 24 const struct dentry_operations affs_dentry_operations = { ··· 131 131 } 132 132 133 133 static int 134 - affs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 134 + affs_compare_dentry(const struct dentry *dentry, 135 135 unsigned int len, const char *str, const struct qstr *name) 136 136 { 137 137 ··· 140 140 } 141 141 142 142 static int 143 - affs_intl_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 143 + affs_intl_compare_dentry(const struct dentry *dentry, 144 144 unsigned int len, const char *str, const struct qstr *name) 145 145 { 146 146 return __affs_compare_dentry(len, str, name, affs_intl_toupper,
+1 -1
fs/cifs/dir.c
··· 903 903 return 0; 904 904 } 905 905 906 - static int cifs_ci_compare(const struct dentry *parent, const struct dentry *dentry, 906 + static int cifs_ci_compare(const struct dentry *dentry, 907 907 unsigned int len, const char *str, const struct qstr *name) 908 908 { 909 909 struct nls_table *codepage = CIFS_SB(dentry->d_sb)->local_nls;
+2 -2
fs/dcache.c
··· 2047 2047 return false; 2048 2048 return dentry_cmp(dentry, name->name, name->len) == 0; 2049 2049 } 2050 - return parent->d_op->d_compare(parent, dentry, 2050 + return parent->d_op->d_compare(dentry, 2051 2051 dentry->d_name.len, dentry->d_name.name, 2052 2052 name) == 0; 2053 2053 } ··· 2150 2150 cpu_relax(); 2151 2151 goto seqretry; 2152 2152 } 2153 - if (parent->d_op->d_compare(parent, dentry, 2153 + if (parent->d_op->d_compare(dentry, 2154 2154 tlen, tname, name) != 0) 2155 2155 continue; 2156 2156 } else {
+1 -2
fs/efivarfs/super.c
··· 45 45 * So we need to perform a case-sensitive match on part 1 and a 46 46 * case-insensitive match on part 2. 47 47 */ 48 - static int efivarfs_d_compare(const struct dentry *parent, 49 - const struct dentry *dentry, 48 + static int efivarfs_d_compare(const struct dentry *dentry, 50 49 unsigned int len, const char *str, 51 50 const struct qstr *name) 52 51 {
+1 -1
fs/fat/namei_msdos.c
··· 162 162 * Compare two msdos names. If either of the names are invalid, 163 163 * we fall back to doing the standard name comparison. 164 164 */ 165 - static int msdos_cmp(const struct dentry *parent, const struct dentry *dentry, 165 + static int msdos_cmp(const struct dentry *dentry, 166 166 unsigned int len, const char *str, const struct qstr *name) 167 167 { 168 168 struct fat_mount_options *options = &MSDOS_SB(dentry->d_sb)->options;
+2 -2
fs/fat/namei_vfat.c
··· 138 138 /* 139 139 * Case insensitive compare of two vfat names. 140 140 */ 141 - static int vfat_cmpi(const struct dentry *parent, const struct dentry *dentry, 141 + static int vfat_cmpi(const struct dentry *dentry, 142 142 unsigned int len, const char *str, const struct qstr *name) 143 143 { 144 144 struct nls_table *t = MSDOS_SB(dentry->d_sb)->nls_io; ··· 157 157 /* 158 158 * Case sensitive compare of two vfat names. 159 159 */ 160 - static int vfat_cmp(const struct dentry *parent, const struct dentry *dentry, 160 + static int vfat_cmp(const struct dentry *dentry, 161 161 unsigned int len, const char *str, const struct qstr *name) 162 162 { 163 163 unsigned int alen, blen;
+1 -1
fs/hfs/hfs_fs.h
··· 233 233 extern int hfs_hash_dentry(const struct dentry *, struct qstr *); 234 234 extern int hfs_strcmp(const unsigned char *, unsigned int, 235 235 const unsigned char *, unsigned int); 236 - extern int hfs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 236 + extern int hfs_compare_dentry(const struct dentry *dentry, 237 237 unsigned int len, const char *str, const struct qstr *name); 238 238 239 239 /* trans.c */
+1 -1
fs/hfs/string.c
··· 92 92 * Test for equality of two strings in the HFS filename character ordering. 93 93 * return 1 on failure and 0 on success 94 94 */ 95 - int hfs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 95 + int hfs_compare_dentry(const struct dentry *dentry, 96 96 unsigned int len, const char *str, const struct qstr *name) 97 97 { 98 98 const unsigned char *n1, *n2;
+1 -2
fs/hfsplus/hfsplus_fs.h
··· 520 520 int hfsplus_asc2uni(struct super_block *sb, struct hfsplus_unistr *ustr, 521 521 int max_unistr_len, const char *astr, int len); 522 522 int hfsplus_hash_dentry(const struct dentry *dentry, struct qstr *str); 523 - int hfsplus_compare_dentry(const struct dentry *parent, 524 - const struct dentry *dentry, unsigned int len, 523 + int hfsplus_compare_dentry(const struct dentry *dentry, unsigned int len, 525 524 const char *str, const struct qstr *name); 526 525 527 526 /* wrapper.c */
+1 -1
fs/hfsplus/unicode.c
··· 385 385 * Composed unicode characters are decomposed and case-folding is performed 386 386 * if the appropriate bits are (un)set on the superblock. 387 387 */ 388 - int hfsplus_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 388 + int hfsplus_compare_dentry(const struct dentry *dentry, 389 389 unsigned int len, const char *str, const struct qstr *name) 390 390 { 391 391 struct super_block *sb = dentry->d_sb;
+1 -1
fs/hpfs/dentry.c
··· 34 34 return 0; 35 35 } 36 36 37 - static int hpfs_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 37 + static int hpfs_compare_dentry(const struct dentry *dentry, 38 38 unsigned int len, const char *str, const struct qstr *name) 39 39 { 40 40 unsigned al = len;
+6 -9
fs/isofs/inode.c
··· 29 29 #define BEQUIET 30 30 31 31 static int isofs_hashi(const struct dentry *parent, struct qstr *qstr); 32 - static int isofs_dentry_cmpi(const struct dentry *parent, 33 - const struct dentry *dentry, 32 + static int isofs_dentry_cmpi(const struct dentry *dentry, 34 33 unsigned int len, const char *str, const struct qstr *name); 35 34 36 35 #ifdef CONFIG_JOLIET 37 36 static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr); 38 37 static int isofs_hash_ms(const struct dentry *parent, struct qstr *qstr); 39 - static int isofs_dentry_cmpi_ms(const struct dentry *parent, 40 - const struct dentry *dentry, 38 + static int isofs_dentry_cmpi_ms(const struct dentry *dentry, 41 39 unsigned int len, const char *str, const struct qstr *name); 42 - static int isofs_dentry_cmp_ms(const struct dentry *parent, 43 - const struct dentry *dentry, 40 + static int isofs_dentry_cmp_ms(const struct dentry *dentry, 44 41 unsigned int len, const char *str, const struct qstr *name); 45 42 #endif 46 43 ··· 232 235 } 233 236 234 237 static int 235 - isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, 238 + isofs_dentry_cmpi(const struct dentry *dentry, 236 239 unsigned int len, const char *str, const struct qstr *name) 237 240 { 238 241 return isofs_dentry_cmp_common(len, str, name, 0, 1); ··· 273 276 } 274 277 275 278 static int 276 - isofs_dentry_cmp_ms(const struct dentry *parent, const struct dentry *dentry, 279 + isofs_dentry_cmp_ms(const struct dentry *dentry, 277 280 unsigned int len, const char *str, const struct qstr *name) 278 281 { 279 282 return isofs_dentry_cmp_common(len, str, name, 1, 0); 280 283 } 281 284 282 285 static int 283 - isofs_dentry_cmpi_ms(const struct dentry *parent, const struct dentry *dentry, 286 + isofs_dentry_cmpi_ms(const struct dentry *dentry, 284 287 unsigned int len, const char *str, const struct qstr *name) 285 288 { 286 289 return isofs_dentry_cmp_common(len, str, name, 1, 1);
+1 -1
fs/isofs/namei.c
··· 22 22 qstr.len = dlen; 23 23 if (likely(!dentry->d_op)) 24 24 return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen); 25 - return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr); 25 + return dentry->d_op->d_compare(NULL, dentry->d_name.len, dentry->d_name.name, &qstr); 26 26 } 27 27 28 28 /*
+1 -1
fs/jfs/namei.c
··· 1572 1572 return 0; 1573 1573 } 1574 1574 1575 - static int jfs_ci_compare(const struct dentry *parent, const struct dentry *dentry, 1575 + static int jfs_ci_compare(const struct dentry *dentry, 1576 1576 unsigned int len, const char *str, const struct qstr *name) 1577 1577 { 1578 1578 int i, result = 1;
+3 -3
fs/ncpfs/dir.c
··· 74 74 */ 75 75 static int ncp_lookup_validate(struct dentry *, unsigned int); 76 76 static int ncp_hash_dentry(const struct dentry *, struct qstr *); 77 - static int ncp_compare_dentry(const struct dentry *, const struct dentry *, 77 + static int ncp_compare_dentry(const struct dentry *, 78 78 unsigned int, const char *, const struct qstr *); 79 79 static int ncp_delete_dentry(const struct dentry *); 80 80 static void ncp_d_prune(struct dentry *dentry); ··· 154 154 * the callers will handle races. 155 155 */ 156 156 static int 157 - ncp_compare_dentry(const struct dentry *parent, const struct dentry *dentry, 157 + ncp_compare_dentry(const struct dentry *dentry, 158 158 unsigned int len, const char *str, const struct qstr *name) 159 159 { 160 160 struct inode *pinode; ··· 162 162 if (len != name->len) 163 163 return 1; 164 164 165 - pinode = d_inode_rcu(parent); 165 + pinode = d_inode_rcu(dentry->d_parent); 166 166 if (!pinode) 167 167 return 1; 168 168
+1 -1
fs/proc/proc_sysctl.c
··· 834 834 return res; 835 835 } 836 836 837 - static int proc_sys_compare(const struct dentry *parent, const struct dentry *dentry, 837 + static int proc_sys_compare(const struct dentry *dentry, 838 838 unsigned int len, const char *str, const struct qstr *name) 839 839 { 840 840 struct ctl_table_header *head;
+1 -1
include/linux/dcache.h
··· 130 130 int (*d_revalidate)(struct dentry *, unsigned int); 131 131 int (*d_weak_revalidate)(struct dentry *, unsigned int); 132 132 int (*d_hash)(const struct dentry *, struct qstr *); 133 - int (*d_compare)(const struct dentry *, const struct dentry *, 133 + int (*d_compare)(const struct dentry *, 134 134 unsigned int, const char *, const struct qstr *); 135 135 int (*d_delete)(const struct dentry *); 136 136 int (*d_init)(struct dentry *);