Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 366781c1 authored by Steve French's avatar Steve French
Browse files

[CIFS] DFS build fixes



Also includes a few minor changes suggested by Christoph

Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 6d5ae0de
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -3,8 +3,9 @@
 *   traversal via DFS junction point
 *   traversal via DFS junction point
 *
 *
 *   Copyright (c) 2007 Igor Mammedov
 *   Copyright (c) 2007 Igor Mammedov
 *   Copyright (C) International Business Machines  Corp., 2008
 *   Author(s): Igor Mammedov (niallain@gmail.com)
 *   Author(s): Igor Mammedov (niallain@gmail.com)
 *
 *		Steve French (sfrench@us.ibm.com)
 *   This program is free software; you can redistribute it and/or
 *   This program is free software; you can redistribute it and/or
 *   modify it under the terms of the GNU General Public License
 *   modify it under the terms of the GNU General Public License
 *   as published by the Free Software Foundation; either version
 *   as published by the Free Software Foundation; either version
@@ -107,7 +108,8 @@ static char *cifs_get_share_name(const char *node_name)
 * Returns: pointer to new mount options or ERR_PTR.
 * Returns: pointer to new mount options or ERR_PTR.
 * Caller is responcible for freeing retunrned value if it is not error.
 * Caller is responcible for freeing retunrned value if it is not error.
 */
 */
char *compose_mount_options(const char *sb_mountdata, const char *ref_unc,
static char *compose_mount_options(const char *sb_mountdata,
				   const char *ref_unc,
				   char **devname)
				   char **devname)
{
{
	int rc;
	int rc;
@@ -188,13 +190,13 @@ char *compose_mount_options(const char *sb_mountdata, const char *ref_unc,
}
}




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 dentry *dentry, char *ref_unc)
{
{
	struct cifs_sb_info *cifs_sb;
	struct cifs_sb_info *cifs_sb;
	struct vfsmount *mnt;
	struct vfsmount *mnt;
	char *mountdata;
	char *mountdata;
	char *devname;
	char *devname = NULL;


	cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
	cifs_sb = CIFS_SB(dentry->d_inode->i_sb);
	mountdata = compose_mount_options(cifs_sb->mountdata,
	mountdata = compose_mount_options(cifs_sb->mountdata,
@@ -278,7 +280,7 @@ static int add_mount_helper(struct vfsmount *newmnt, struct nameidata *nd,
	return err;
	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: ref path: %s", ref->path_name));
	cFYI(1, ("DFS: node path: %s", ref->node_name));
	cFYI(1, ("DFS: node path: %s", ref->node_name));
+32 −9
Original line number Original line Diff line number Diff line
/*
/*
 *   fs/cifs/cifsglob.h
 *   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)
 *   Author(s): Steve French (sfrench@us.ibm.com)
 *              Jeremy Allison (jra@samba.org)
 *              Jeremy Allison (jra@samba.org)
 *
 *
@@ -69,14 +69,6 @@
#define XATTR_DOS_ATTRIB "user.DOSATTRIB"
#define XATTR_DOS_ATTRIB "user.DOSATTRIB"
#endif
#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.)
 * CIFS vfs client Status information (based on what we know.)
 */
 */
@@ -460,6 +452,37 @@ struct dir_notify_req {
       struct file *pfile;
       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_FREE 0
#define   MID_REQUEST_ALLOCATED 1
#define   MID_REQUEST_ALLOCATED 1
#define   MID_REQUEST_SUBMITTED 2
#define   MID_REQUEST_SUBMITTED 2
+2 −2
Original line number Original line Diff line number Diff line
/*
/*
 *   fs/cifs/cifsproto.h
 *   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)
 *   Author(s): Steve French (sfrench@us.ibm.com)
 *
 *
 *   This library is free software; you can redistribute it and/or modify
 *   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 char *old_path,
			const struct nls_table *nls_codepage,
			const struct nls_table *nls_codepage,
			unsigned int *pnum_referrals,
			unsigned int *pnum_referrals,
			unsigned char **preferrals,
			struct dfs_info3_param **preferrals,
			int remap);
			int remap);
extern void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon,
extern void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon,
				 struct super_block *sb, struct smb_vol *vol);
				 struct super_block *sb, struct smb_vol *vol);
+8 −4
Original line number Original line Diff line number Diff line
/*
/*
 *   fs/cifs/connect.c
 *   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)
 *   Author(s): Steve French (sfrench@us.ibm.com)
 *
 *
 *   This library is free software; you can redistribute it and/or modify
 *   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,
		    const char *old_path, const struct nls_table *nls_codepage,
		    int remap)
		    int remap)
{
{
	unsigned char *referrals = NULL;
	struct dfs_info3_param *referrals = NULL;
	unsigned int num_referrals;
	unsigned int num_referrals;
	int rc = 0;
	int rc = 0;


@@ -1429,12 +1429,14 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
int
int
get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, const char *old_path,
	     const struct nls_table *nls_codepage, unsigned int *pnum_referrals,
	     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;
	char *temp_unc;
	int rc = 0;
	int rc = 0;
	unsigned char *targetUNCs;


	*pnum_referrals = 0;
	*pnum_referrals = 0;
	*preferrals = NULL;


	if (pSesInfo->ipc_tid == 0) {
	if (pSesInfo->ipc_tid == 0) {
		temp_unc = kmalloc(2 /* for slashes */ +
		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);
		kfree(temp_unc);
	}
	}
	if (rc == 0)
	if (rc == 0)
		rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, preferrals,
		rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, &targetUNCs,
				     pnum_referrals, nls_codepage, remap);
				     pnum_referrals, nls_codepage, remap);
	/* BB map targetUNCs to dfs_info3 structures, here or
		in CIFSGetDFSRefer BB */


	return rc;
	return rc;
}
}
+3 −2
Original line number Original line Diff line number Diff line
@@ -64,13 +64,14 @@ struct key_type key_type_dns_resolver = {
 * return 0 on success
 * return 0 on success
 */
 */
int
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;
	int rc = -EAGAIN;
	struct key *rkey;
	struct key *rkey;
	char *name;
	char *name;
	int len;
	int len;


	if ((!ip_addr) || (!unc))
	if (!ip_addr || !unc)
		return -EINVAL;
		return -EINVAL;


	/* search for server name delimiter */
	/* search for server name delimiter */
Loading