aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-01-12 17:25:03 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2011-01-12 20:03:43 -0500
commit0378c4051a621303ae919f1cee832206a4c1aa68 (patch)
treeb63adbb4bd6df51470145831728250982dd5ccb4
parent98cd3fb0a2c376f583216ec35f66175a71b2ef67 (diff)
switch ncpfs
merge dentry_operations for root and non-root Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/ncpfs/dir.c15
-rw-r--r--fs/ncpfs/inode.c2
-rw-r--r--include/linux/ncp_fs.h2
3 files changed, 6 insertions, 13 deletions
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 28f136d4aaec..119accd07dd5 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -82,7 +82,7 @@ static int ncp_compare_dentry(const struct dentry *, const struct inode *,
82 unsigned int, const char *, const struct qstr *); 82 unsigned int, const char *, const struct qstr *);
83static int ncp_delete_dentry(const struct dentry *); 83static int ncp_delete_dentry(const struct dentry *);
84 84
85static const struct dentry_operations ncp_dentry_operations = 85const struct dentry_operations ncp_dentry_operations =
86{ 86{
87 .d_revalidate = ncp_lookup_validate, 87 .d_revalidate = ncp_lookup_validate,
88 .d_hash = ncp_hash_dentry, 88 .d_hash = ncp_hash_dentry,
@@ -90,14 +90,6 @@ static const struct dentry_operations ncp_dentry_operations =
90 .d_delete = ncp_delete_dentry, 90 .d_delete = ncp_delete_dentry,
91}; 91};
92 92
93const struct dentry_operations ncp_root_dentry_operations =
94{
95 .d_hash = ncp_hash_dentry,
96 .d_compare = ncp_compare_dentry,
97 .d_delete = ncp_delete_dentry,
98};
99
100
101#define ncp_namespace(i) (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber]) 93#define ncp_namespace(i) (NCP_SERVER(i)->name_space[NCP_FINFO(i)->volNumber])
102 94
103static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator) 95static inline int ncp_preserve_entry_case(struct inode *i, __u32 nscreator)
@@ -309,6 +301,9 @@ ncp_lookup_validate(struct dentry *dentry, struct nameidata *nd)
309 int res, val = 0, len; 301 int res, val = 0, len;
310 __u8 __name[NCP_MAXPATHLEN + 1]; 302 __u8 __name[NCP_MAXPATHLEN + 1];
311 303
304 if (dentry == dentry->d_sb->s_root)
305 return 1;
306
312 if (nd->flags & LOOKUP_RCU) 307 if (nd->flags & LOOKUP_RCU)
313 return -ECHILD; 308 return -ECHILD;
314 309
@@ -637,7 +632,6 @@ ncp_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
637 entry->ino = iunique(dir->i_sb, 2); 632 entry->ino = iunique(dir->i_sb, 2);
638 inode = ncp_iget(dir->i_sb, entry); 633 inode = ncp_iget(dir->i_sb, entry);
639 if (inode) { 634 if (inode) {
640 d_set_d_op(newdent, &ncp_dentry_operations);
641 d_instantiate(newdent, inode); 635 d_instantiate(newdent, inode);
642 if (!hashed) 636 if (!hashed)
643 d_rehash(newdent); 637 d_rehash(newdent);
@@ -893,7 +887,6 @@ static struct dentry *ncp_lookup(struct inode *dir, struct dentry *dentry, struc
893 if (inode) { 887 if (inode) {
894 ncp_new_dentry(dentry); 888 ncp_new_dentry(dentry);
895add_entry: 889add_entry:
896 d_set_d_op(dentry, &ncp_dentry_operations);
897 d_add(dentry, inode); 890 d_add(dentry, inode);
898 error = 0; 891 error = 0;
899 } 892 }
diff --git a/fs/ncpfs/inode.c b/fs/ncpfs/inode.c
index 9b39a5dd4131..8b8bebbb9601 100644
--- a/fs/ncpfs/inode.c
+++ b/fs/ncpfs/inode.c
@@ -544,6 +544,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
544 sb->s_blocksize_bits = 10; 544 sb->s_blocksize_bits = 10;
545 sb->s_magic = NCP_SUPER_MAGIC; 545 sb->s_magic = NCP_SUPER_MAGIC;
546 sb->s_op = &ncp_sops; 546 sb->s_op = &ncp_sops;
547 sb->s_d_op = &ncp_dentry_operations;
547 sb->s_bdi = &server->bdi; 548 sb->s_bdi = &server->bdi;
548 549
549 server = NCP_SBP(sb); 550 server = NCP_SBP(sb);
@@ -723,7 +724,6 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
723 sb->s_root = d_alloc_root(root_inode); 724 sb->s_root = d_alloc_root(root_inode);
724 if (!sb->s_root) 725 if (!sb->s_root)
725 goto out_no_root; 726 goto out_no_root;
726 d_set_d_op(sb->s_root, &ncp_root_dentry_operations);
727 return 0; 727 return 0;
728 728
729out_no_root: 729out_no_root:
diff --git a/include/linux/ncp_fs.h b/include/linux/ncp_fs.h
index 1c27f201c856..2d79c8a58598 100644
--- a/include/linux/ncp_fs.h
+++ b/include/linux/ncp_fs.h
@@ -204,7 +204,7 @@ void ncp_update_inode2(struct inode *, struct ncp_entry_info *);
204/* linux/fs/ncpfs/dir.c */ 204/* linux/fs/ncpfs/dir.c */
205extern const struct inode_operations ncp_dir_inode_operations; 205extern const struct inode_operations ncp_dir_inode_operations;
206extern const struct file_operations ncp_dir_operations; 206extern const struct file_operations ncp_dir_operations;
207extern const struct dentry_operations ncp_root_dentry_operations; 207extern const struct dentry_operations ncp_dentry_operations;
208int ncp_conn_logged_in(struct super_block *); 208int ncp_conn_logged_in(struct super_block *);
209int ncp_date_dos2unix(__le16 time, __le16 date); 209int ncp_date_dos2unix(__le16 time, __le16 date);
210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date); 210void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);