aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2011-07-06 08:10:38 -0400
committerSteve French <sfrench@us.ibm.com>2011-07-07 23:51:23 -0400
commit04db79b015dafcb79371fda6b5c32ffdbd31a2ff (patch)
treeeef264d76b4f352d56be896b950631d857ec61b0 /fs/cifs
parentf9e59bcba2cff580a3ccf62e89460f9eed295d89 (diff)
cifs: factor smb_vol allocation out of cifs_setup_volume_info
Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsfs.c6
-rw-r--r--fs/cifs/cifsproto.h4
-rw-r--r--fs/cifs/connect.c56
3 files changed, 33 insertions, 33 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index e11b83149833..3e2989976297 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -649,9 +649,9 @@ cifs_do_mount(struct file_system_type *fs_type,
649 649
650 cFYI(1, "Devname: %s flags: %d ", dev_name, flags); 650 cFYI(1, "Devname: %s flags: %d ", dev_name, flags);
651 651
652 rc = cifs_setup_volume_info(&volume_info, (char *)data, dev_name); 652 volume_info = cifs_get_volume_info((char *)data, dev_name);
653 if (rc) 653 if (IS_ERR(volume_info))
654 return ERR_PTR(rc); 654 return ERR_CAST(volume_info);
655 655
656 cifs_sb = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL); 656 cifs_sb = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL);
657 if (cifs_sb == NULL) { 657 if (cifs_sb == NULL) {
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 53b1b13581c6..8df28e925e5b 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -155,8 +155,8 @@ extern void cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
155 struct cifs_sb_info *cifs_sb); 155 struct cifs_sb_info *cifs_sb);
156extern int cifs_match_super(struct super_block *, void *); 156extern int cifs_match_super(struct super_block *, void *);
157extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info); 157extern void cifs_cleanup_volume_info(struct smb_vol *pvolume_info);
158extern int cifs_setup_volume_info(struct smb_vol **pvolume_info, 158extern struct smb_vol *cifs_get_volume_info(char *mount_data,
159 char *mount_data, const char *devname); 159 const char *devname);
160extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *); 160extern int cifs_mount(struct cifs_sb_info *, struct smb_vol *);
161extern void cifs_umount(struct cifs_sb_info *); 161extern void cifs_umount(struct cifs_sb_info *);
162extern void cifs_dfs_release_automount_timer(void); 162extern void cifs_dfs_release_automount_timer(void);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index dd064075ddfb..46cc0ad03487 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2931,33 +2931,20 @@ expand_dfs_referral(int xid, struct cifs_ses *pSesInfo,
2931} 2931}
2932#endif 2932#endif
2933 2933
2934int cifs_setup_volume_info(struct smb_vol **pvolume_info, char *mount_data, 2934static int
2935 const char *devname) 2935cifs_setup_volume_info(struct smb_vol *volume_info, char *mount_data,
2936 const char *devname)
2936{ 2937{
2937 struct smb_vol *volume_info;
2938 int rc = 0; 2938 int rc = 0;
2939 2939
2940 *pvolume_info = NULL; 2940 if (cifs_parse_mount_options(mount_data, devname, volume_info))
2941 2941 return -EINVAL;
2942 volume_info = kzalloc(sizeof(struct smb_vol), GFP_KERNEL);
2943 if (!volume_info) {
2944 rc = -ENOMEM;
2945 goto out;
2946 }
2947
2948 if (cifs_parse_mount_options(mount_data, devname,
2949 volume_info)) {
2950 rc = -EINVAL;
2951 goto out;
2952 }
2953 2942
2954 if (volume_info->nullauth) { 2943 if (volume_info->nullauth) {
2955 cFYI(1, "null user"); 2944 cFYI(1, "null user");
2956 volume_info->username = kzalloc(1, GFP_KERNEL); 2945 volume_info->username = kzalloc(1, GFP_KERNEL);
2957 if (volume_info->username == NULL) { 2946 if (volume_info->username == NULL)
2958 rc = -ENOMEM; 2947 return -ENOMEM;
2959 goto out;
2960 }
2961 } else if (volume_info->username) { 2948 } else if (volume_info->username) {
2962 /* BB fixme parse for domain name here */ 2949 /* BB fixme parse for domain name here */
2963 cFYI(1, "Username: %s", volume_info->username); 2950 cFYI(1, "Username: %s", volume_info->username);
@@ -2965,8 +2952,7 @@ int cifs_setup_volume_info(struct smb_vol **pvolume_info, char *mount_data,
2965 cifserror("No username specified"); 2952 cifserror("No username specified");
2966 /* In userspace mount helper we can get user name from alternate 2953 /* In userspace mount helper we can get user name from alternate
2967 locations such as env variables and files on disk */ 2954 locations such as env variables and files on disk */
2968 rc = -EINVAL; 2955 return -EINVAL;
2969 goto out;
2970 } 2956 }
2971 2957
2972 /* this is needed for ASCII cp to Unicode converts */ 2958 /* this is needed for ASCII cp to Unicode converts */
@@ -2978,18 +2964,32 @@ int cifs_setup_volume_info(struct smb_vol **pvolume_info, char *mount_data,
2978 if (volume_info->local_nls == NULL) { 2964 if (volume_info->local_nls == NULL) {
2979 cERROR(1, "CIFS mount error: iocharset %s not found", 2965 cERROR(1, "CIFS mount error: iocharset %s not found",
2980 volume_info->iocharset); 2966 volume_info->iocharset);
2981 rc = -ELIBACC; 2967 return -ELIBACC;
2982 goto out;
2983 } 2968 }
2984 } 2969 }
2985 2970
2986 *pvolume_info = volume_info;
2987 return rc;
2988out:
2989 cifs_cleanup_volume_info(volume_info);
2990 return rc; 2971 return rc;
2991} 2972}
2992 2973
2974struct smb_vol *
2975cifs_get_volume_info(char *mount_data, const char *devname)
2976{
2977 int rc;
2978 struct smb_vol *volume_info;
2979
2980 volume_info = kzalloc(sizeof(struct smb_vol), GFP_KERNEL);
2981 if (!volume_info)
2982 return ERR_PTR(-ENOMEM);
2983
2984 rc = cifs_setup_volume_info(volume_info, mount_data, devname);
2985 if (rc) {
2986 cifs_cleanup_volume_info(volume_info);
2987 volume_info = ERR_PTR(rc);
2988 }
2989
2990 return volume_info;
2991}
2992
2993int 2993int
2994cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info) 2994cifs_mount(struct cifs_sb_info *cifs_sb, struct smb_vol *volume_info)
2995{ 2995{