aboutsummaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2008-01-25 10:12:41 +0000
committerSteve French <sfrench@us.ibm.com>2008-01-25 10:12:41 +0000
commit366781c19635d861f43ff5e03388a3873ec912d9 (patch)
treebeef581849a76dd7b1c1e365c19314409f2189fb /fs/cifs
parent6d5ae0deb1641bf615eafd8fef64218e10cb2fd0 (diff)
[CIFS] DFS build fixes
Also includes a few minor changes suggested by Christoph Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifs_dfs_ref.c14
-rw-r--r--fs/cifs/cifsglob.h41
-rw-r--r--fs/cifs/cifsproto.h4
-rw-r--r--fs/cifs/connect.c12
-rw-r--r--fs/cifs/dns_resolve.c5
-rw-r--r--fs/cifs/link.c16
6 files changed, 61 insertions, 31 deletions
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index 15e31f8435b..413ee2349d1 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -3,8 +3,9 @@
* traversal via DFS junction point
*
* Copyright (c) 2007 Igor Mammedov
+ * Copyright (C) International Business Machines Corp., 2008
* Author(s): Igor Mammedov (niallain@gmail.com)
- *
+ * Steve French (sfrench@us.ibm.com)
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
@@ -107,8 +108,9 @@ static char *cifs_get_share_name(const char *node_name)
* Returns: pointer to new mount options or ERR_PTR.
* Caller is responcible for freeing retunrned value if it is not error.
*/
-char *compose_mount_options(const char *sb_mountdata, const char *ref_unc,
- char **devname)
+static char *compose_mount_options(const char *sb_mountdata,
+ const char *ref_unc,
+ char **devname)
{
int rc;
char *mountdata;
@@ -188,13 +190,13 @@ compose_mount_options_out:
}
-struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent,
+static struct vfsmount *cifs_dfs_do_refmount(const struct vfsmount *mnt_parent,
struct dentry *dentry, char *ref_unc)
{
struct cifs_sb_info *cifs_sb;
struct vfsmount *mnt;
char *mountdata;
- char *devname;
+ char *devname = NULL;
cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
mountdata = compose_mount_options(cifs_sb->mountdata,
@@ -278,7 +280,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
return err;
}
-void dump_referral(const struct dfs_info3_param *ref)
+static void dump_referral(const struct dfs_info3_param *ref)
{
cFYI(1, ("DFS: ref path: %s", ref->path_name));
cFYI(1, ("DFS: node path: %s", ref->node_name));
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 1fde2197ad7..5d32d8ddc82 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -1,7 +1,7 @@
/*
* fs/cifs/cifsglob.h
*
- * Copyright (C) International Business Machines Corp., 2002,2007
+ * Copyright (C) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com)
* Jeremy Allison (jra@samba.org)
*
@@ -70,14 +70,6 @@
#endif
/*
- * This information is kept on every Server we know about.
- *
- * Some things to note:
- *
- */
-#define SERVER_NAME_LEN_WITH_NULL (SERVER_NAME_LENGTH + 1)
-
-/*
* CIFS vfs client Status information (based on what we know.)
*/
@@ -460,6 +452,37 @@ struct dir_notify_req {
struct file *pfile;
};
+struct dfs_info3_param {
+ int flags; /* DFSREF_REFERRAL_SERVER, DFSREF_STORAGE_SERVER*/
+ int PathConsumed;
+ int server_type;
+ int ref_flag;
+ char *path_name;
+ char *node_name;
+};
+
+static inline void free_dfs_info_param(struct dfs_info3_param *param)
+{
+ if (param) {
+ kfree(param->path_name);
+ kfree(param->node_name);
+ kfree(param);
+ }
+}
+
+static inline void free_dfs_info_array(struct dfs_info3_param *param,
+ int number_of_items)
+{
+ int i;
+ if ((number_of_items == 0) || (param == NULL))
+ return;
+ for (i = 0; i < number_of_items; i++) {
+ kfree(param[i].path_name);
+ kfree(param[i].node_name);
+ }
+ kfree(param);
+}
+
#define MID_FREE 0
#define MID_REQUEST_ALLOCATED 1
#define MID_REQUEST_SUBMITTED 2
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index aaaf748f6a2..2f09f565a3d 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -1,7 +1,7 @@
/*
* fs/cifs/cifsproto.h
*
- * Copyright (c) International Business Machines Corp., 2002,2007
+ * Copyright (c) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
@@ -156,7 +156,7 @@ extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
const char *old_path,
const struct nls_table *nls_codepage,
unsigned int *pnum_referrals,
- unsigned char **preferrals,
+ struct dfs_info3_param **preferrals,
int remap);
extern void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon,
struct super_block *sb, struct smb_vol *vol);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index db3746c891b..65d0ba72e78 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1,7 +1,7 @@
/*
* fs/cifs/connect.c
*
- * Copyright (C) International Business Machines Corp., 2002,2007
+ * Copyright (C) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
@@ -1410,7 +1410,7 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
const char *old_path, const struct nls_table *nls_codepage,
int remap)
{
- unsigned char *referrals = NULL;
+ struct dfs_info3_param *referrals = NULL;
unsigned int num_referrals;
int rc = 0;
@@ -1429,12 +1429,14 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
int
get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
const struct nls_table *nls_codepage, unsigned int *pnum_referrals,
- unsigned char **preferrals, int remap)
+ struct dfs_info3_param **preferrals, int remap)
{
char *temp_unc;
int rc = 0;
+ unsigned char *targetUNCs;
*pnum_referrals = 0;
+ *preferrals = NULL;
if (pSesInfo->ipc_tid == 0) {
temp_unc = kmalloc(2 /* for slashes */ +
@@ -1454,8 +1456,10 @@ get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
kfree(temp_unc);
}
if (rc == 0)
- rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, preferrals,
+ rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, &targetUNCs,
pnum_referrals, nls_codepage, remap);
+ /* BB map targetUNCs to dfs_info3 structures, here or
+ in CIFSGetDFSRefer BB */
return rc;
}
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c
index 777a086abd6..ef7f4382434 100644
--- a/fs/cifs/dns_resolve.c
+++ b/fs/cifs/dns_resolve.c
@@ -64,13 +64,14 @@ struct key_type key_type_dns_resolver = {
* return 0 on success
*/
int
-dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) {
+dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
+{
int rc = -EAGAIN;
struct key *rkey;
char *name;
int len;
- if ((!ip_addr) || (!unc))
+ if (!ip_addr || !unc)
return -EINVAL;
/* search for server name delimiter */
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 11f265726db..1d6fb01b8e6 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -1,7 +1,7 @@
/*
* fs/cifs/link.c
*
- * Copyright (C) International Business Machines Corp., 2002,2003
+ * Copyright (C) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com)
*
* This library is free software; you can redistribute it and/or modify
@@ -236,8 +236,6 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
char *full_path = NULL;
char *tmp_path = NULL;
char *tmpbuffer;
- unsigned char *referrals = NULL;
- unsigned int num_referrals = 0;
int len;
__u16 fid;
@@ -297,8 +295,11 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
cFYI(1, ("Error closing junction point "
"(open for ioctl)"));
}
+ /* BB unwind this long, nested function, or remove BB */
if (rc == -EIO) {
/* Query if DFS Junction */
+ unsigned int num_referrals = 0;
+ struct dfs_info3_param *refs = NULL;
tmp_path =
kmalloc(MAX_TREE_SIZE + MAX_PATHCONF + 1,
GFP_KERNEL);
@@ -310,7 +311,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
rc = get_dfs_path(xid, pTcon->ses,
tmp_path,
cifs_sb->local_nls,
- &num_referrals, &referrals,
+ &num_referrals, &refs,
cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
cFYI(1, ("Get DFS for %s rc = %d ",
@@ -320,14 +321,13 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
else {
cFYI(1, ("num referral: %d",
num_referrals));
- if (referrals) {
- cFYI(1,("referral string: %s", referrals));
+ if (refs && refs->path_name) {
strncpy(tmpbuffer,
- referrals,
+ refs->path_name,
len-1);
}
}
- kfree(referrals);
+ kfree(refs);
kfree(tmp_path);
}
/* BB add code like else decode referrals