aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorIgor Mammedov <niallain@gmail.com>2008-01-10 20:49:48 -0500
committerSteve French <sfrench@us.ibm.com>2008-01-10 20:49:48 -0500
commite6ab15827eec0bc4444421f7ccf0223de321c708 (patch)
tree59fa8c7ad8247c45c0393f6f900460ab1e04a2f0 /fs
parent197c183f3526dc08aa52ca97ec66c268442d4b84 (diff)
[CIFS] DFS support patchset: Added mountdata
Also cifs_fs_type was made not static for ussage in dfs code. Signed-off-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifs_fs_sb.h5
-rw-r--r--fs/cifs/cifsfs.c37
-rw-r--r--fs/cifs/cifsfs.h1
3 files changed, 41 insertions, 2 deletions
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h
index 34af556cdd8d..8ad2330ba061 100644
--- a/fs/cifs/cifs_fs_sb.h
+++ b/fs/cifs/cifs_fs_sb.h
@@ -43,6 +43,9 @@ struct cifs_sb_info {
43 mode_t mnt_dir_mode; 43 mode_t mnt_dir_mode;
44 int mnt_cifs_flags; 44 int mnt_cifs_flags;
45 int prepathlen; 45 int prepathlen;
46 char *prepath; 46 char *prepath; /* relative path under the share to mount to */
47#ifdef CONFIG_CIFS_DFS_UPCALL
48 char *mountdata; /* mount options received at mount time */
49#endif
47}; 50};
48#endif /* _CIFS_FS_SB_H */ 51#endif /* _CIFS_FS_SB_H */
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 000b4a5d3219..93e107883a61 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -97,6 +97,9 @@ cifs_read_super(struct super_block *sb, void *data,
97{ 97{
98 struct inode *inode; 98 struct inode *inode;
99 struct cifs_sb_info *cifs_sb; 99 struct cifs_sb_info *cifs_sb;
100#ifdef CONFIG_CIFS_DFS_UPCALL
101 int len;
102#endif
100 int rc = 0; 103 int rc = 0;
101 104
102 /* BB should we make this contingent on mount parm? */ 105 /* BB should we make this contingent on mount parm? */
@@ -106,6 +109,25 @@ cifs_read_super(struct super_block *sb, void *data,
106 if (cifs_sb == NULL) 109 if (cifs_sb == NULL)
107 return -ENOMEM; 110 return -ENOMEM;
108 111
112#ifdef CONFIG_CIFS_DFS_UPCALL
113 /* copy mount params to sb for use in submounts */
114 /* BB: should we move this after the mount so we
115 * do not have to do the copy on failed mounts?
116 * BB: May be it is better to do simple copy before
117 * complex operation (mount), and in case of fail
118 * just exit instead of doing mount and attempting
119 * undo it if this copy fails?*/
120 len = strlen(data);
121 cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL);
122 if (cifs_sb->mountdata == NULL) {
123 kfree(sb->s_fs_info);
124 sb->s_fs_info = NULL;
125 return -ENOMEM;
126 }
127 strncpy(cifs_sb->mountdata, data, len + 1);
128 cifs_sb->mountdata[len] = '\0';
129#endif
130
109 rc = cifs_mount(sb, cifs_sb, data, devname); 131 rc = cifs_mount(sb, cifs_sb, data, devname);
110 132
111 if (rc) { 133 if (rc) {
@@ -155,6 +177,12 @@ out_no_root:
155 177
156out_mount_failed: 178out_mount_failed:
157 if (cifs_sb) { 179 if (cifs_sb) {
180#ifdef CONFIG_CIFS_DFS_UPCALL
181 if (cifs_sb->mountdata) {
182 kfree(cifs_sb->mountdata);
183 cifs_sb->mountdata = NULL;
184 }
185#endif
158 if (cifs_sb->local_nls) 186 if (cifs_sb->local_nls)
159 unload_nls(cifs_sb->local_nls); 187 unload_nls(cifs_sb->local_nls);
160 kfree(cifs_sb); 188 kfree(cifs_sb);
@@ -178,6 +206,13 @@ cifs_put_super(struct super_block *sb)
178 if (rc) { 206 if (rc) {
179 cERROR(1, ("cifs_umount failed with return code %d", rc)); 207 cERROR(1, ("cifs_umount failed with return code %d", rc));
180 } 208 }
209#ifdef CONFIG_CIFS_DFS_UPCALL
210 if (cifs_sb->mountdata) {
211 kfree(cifs_sb->mountdata);
212 cifs_sb->mountdata = NULL;
213 }
214#endif
215
181 unload_nls(cifs_sb->local_nls); 216 unload_nls(cifs_sb->local_nls);
182 kfree(cifs_sb); 217 kfree(cifs_sb);
183 return; 218 return;
@@ -553,7 +588,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin)
553 return remote_llseek(file, offset, origin); 588 return remote_llseek(file, offset, origin);
554} 589}
555 590
556static struct file_system_type cifs_fs_type = { 591struct file_system_type cifs_fs_type = {
557 .owner = THIS_MODULE, 592 .owner = THIS_MODULE,
558 .name = "cifs", 593 .name = "cifs",
559 .get_sb = cifs_get_sb, 594 .get_sb = cifs_get_sb,
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 2a21dc66f0de..2e68126d07eb 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -32,6 +32,7 @@
32#define TRUE 1 32#define TRUE 1
33#endif 33#endif
34 34
35extern struct file_system_type cifs_fs_type;
35extern const struct address_space_operations cifs_addr_ops; 36extern const struct address_space_operations cifs_addr_ops;
36extern const struct address_space_operations cifs_addr_ops_smallbuf; 37extern const struct address_space_operations cifs_addr_ops_smallbuf;
37 38