Commit 40efeb4d authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
  [CIFS] Fix endian error comparing authusers when cifsacl enabled
  [CIFS] Rename three structures to avoid camel case
  Fix extended security auth failure
  CIFS: Add rwpidforward mount option
  CIFS: Migrate to shared superblock model
  [CIFS] Migrate from prefixpath logic
  CIFS: Fix memory leak in cifs_do_mount
  [CIFS] When mandatory encryption on share, fail mount
  CIFS: Use pid saved from cifsFileInfo in writepages and set_file_size
  cifs: add cifs_async_writev
  cifs: clean up wsize negotiation and allow for larger wsize
  cifs: convert cifs_writepages to use async writes
  CIFS: Fix undefined behavior when mount fails
  cifs: don't call mid_q_entry->callback under the Global_MidLock (try #5)
  CIFS: Simplify mount code for further shared sb capability
  CIFS: Simplify connection structure search calls
  cifs: remove unused SMB2 config and mount options
  cifs: add ignore_pend flag to cifs_call_async
  cifs: make cifs_send_async take a kvec array
  cifs: consolidate SendReceive response checks
parents 81faae7f 383c5535
...@@ -153,26 +153,6 @@ config CIFS_ACL ...@@ -153,26 +153,6 @@ config CIFS_ACL
Allows to fetch CIFS/NTFS ACL from the server. The DACL blob Allows to fetch CIFS/NTFS ACL from the server. The DACL blob
is handed over to the application/caller. is handed over to the application/caller.
config CIFS_SMB2
bool "SMB2 network file system support (EXPERIMENTAL)"
depends on EXPERIMENTAL && INET && BROKEN
select NLS
select KEYS
select FSCACHE
select DNS_RESOLVER
help
This enables experimental support for the SMB2 (Server Message Block
version 2) protocol. The SMB2 protocol is the successor to the
popular CIFS and SMB network file sharing protocols. SMB2 is the
native file sharing mechanism for recent versions of Windows
operating systems (since Vista). SMB2 enablement will eventually
allow users better performance, security and features, than would be
possible with cifs. Note that smb2 mount options also are simpler
(compared to cifs) due to protocol improvements.
Unless you are a developer or tester, say N.
config CIFS_NFSD_EXPORT config CIFS_NFSD_EXPORT
bool "Allow nfsd to export CIFS file system (EXPERIMENTAL)" bool "Allow nfsd to export CIFS file system (EXPERIMENTAL)"
depends on CIFS && EXPERIMENTAL depends on CIFS && EXPERIMENTAL
......
...@@ -457,6 +457,9 @@ A partial list of the supported mount options follows: ...@@ -457,6 +457,9 @@ A partial list of the supported mount options follows:
otherwise - read from the server. All written data are stored otherwise - read from the server. All written data are stored
in the cache, but if the client doesn't have Exclusive Oplock, in the cache, but if the client doesn't have Exclusive Oplock,
it writes the data to the server. it writes the data to the server.
rwpidforward Forward pid of a process who opened a file to any read or write
operation on that file. This prevent applications like WINE
from failing on read and write if we use mandatory brlock style.
acl Allow setfacl and getfacl to manage posix ACLs if server acl Allow setfacl and getfacl to manage posix ACLs if server
supports them. (default) supports them. (default)
noacl Do not allow setfacl and getfacl calls on this mount noacl Do not allow setfacl and getfacl calls on this mount
......
...@@ -146,7 +146,7 @@ static char *extract_sharename(const char *treename) ...@@ -146,7 +146,7 @@ static char *extract_sharename(const char *treename)
static uint16_t cifs_super_get_key(const void *cookie_netfs_data, void *buffer, static uint16_t cifs_super_get_key(const void *cookie_netfs_data, void *buffer,
uint16_t maxbuf) uint16_t maxbuf)
{ {
const struct cifsTconInfo *tcon = cookie_netfs_data; const struct cifs_tcon *tcon = cookie_netfs_data;
char *sharename; char *sharename;
uint16_t len; uint16_t len;
...@@ -173,7 +173,7 @@ cifs_fscache_super_get_aux(const void *cookie_netfs_data, void *buffer, ...@@ -173,7 +173,7 @@ cifs_fscache_super_get_aux(const void *cookie_netfs_data, void *buffer,
uint16_t maxbuf) uint16_t maxbuf)
{ {
struct cifs_fscache_super_auxdata auxdata; struct cifs_fscache_super_auxdata auxdata;
const struct cifsTconInfo *tcon = cookie_netfs_data; const struct cifs_tcon *tcon = cookie_netfs_data;
memset(&auxdata, 0, sizeof(auxdata)); memset(&auxdata, 0, sizeof(auxdata));
auxdata.resource_id = tcon->resource_id; auxdata.resource_id = tcon->resource_id;
...@@ -192,7 +192,7 @@ fscache_checkaux cifs_fscache_super_check_aux(void *cookie_netfs_data, ...@@ -192,7 +192,7 @@ fscache_checkaux cifs_fscache_super_check_aux(void *cookie_netfs_data,
uint16_t datalen) uint16_t datalen)
{ {
struct cifs_fscache_super_auxdata auxdata; struct cifs_fscache_super_auxdata auxdata;
const struct cifsTconInfo *tcon = cookie_netfs_data; const struct cifs_tcon *tcon = cookie_netfs_data;
if (datalen != sizeof(auxdata)) if (datalen != sizeof(auxdata))
return FSCACHE_CHECKAUX_OBSOLETE; return FSCACHE_CHECKAUX_OBSOLETE;
......
...@@ -110,8 +110,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) ...@@ -110,8 +110,8 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
struct list_head *tmp1, *tmp2, *tmp3; struct list_head *tmp1, *tmp2, *tmp3;
struct mid_q_entry *mid_entry; struct mid_q_entry *mid_entry;
struct TCP_Server_Info *server; struct TCP_Server_Info *server;
struct cifsSesInfo *ses; struct cifs_ses *ses;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
int i, j; int i, j;
__u32 dev_type; __u32 dev_type;
...@@ -152,7 +152,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) ...@@ -152,7 +152,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
tcp_ses_list); tcp_ses_list);
i++; i++;
list_for_each(tmp2, &server->smb_ses_list) { list_for_each(tmp2, &server->smb_ses_list) {
ses = list_entry(tmp2, struct cifsSesInfo, ses = list_entry(tmp2, struct cifs_ses,
smb_ses_list); smb_ses_list);
if ((ses->serverDomain == NULL) || if ((ses->serverDomain == NULL) ||
(ses->serverOS == NULL) || (ses->serverOS == NULL) ||
...@@ -171,7 +171,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) ...@@ -171,7 +171,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
seq_printf(m, "TCP status: %d\n\tLocal Users To " seq_printf(m, "TCP status: %d\n\tLocal Users To "
"Server: %d SecMode: 0x%x Req On Wire: %d", "Server: %d SecMode: 0x%x Req On Wire: %d",
server->tcpStatus, server->srv_count, server->tcpStatus, server->srv_count,
server->secMode, server->sec_mode,
atomic_read(&server->inFlight)); atomic_read(&server->inFlight));
#ifdef CONFIG_CIFS_STATS2 #ifdef CONFIG_CIFS_STATS2
...@@ -183,7 +183,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v) ...@@ -183,7 +183,7 @@ static int cifs_debug_data_proc_show(struct seq_file *m, void *v)
seq_puts(m, "\n\tShares:"); seq_puts(m, "\n\tShares:");
j = 0; j = 0;
list_for_each(tmp3, &ses->tcon_list) { list_for_each(tmp3, &ses->tcon_list) {
tcon = list_entry(tmp3, struct cifsTconInfo, tcon = list_entry(tmp3, struct cifs_tcon,
tcon_list); tcon_list);
++j; ++j;
dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType); dev_type = le32_to_cpu(tcon->fsDevInfo.DeviceType);
...@@ -256,8 +256,8 @@ static ssize_t cifs_stats_proc_write(struct file *file, ...@@ -256,8 +256,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
int rc; int rc;
struct list_head *tmp1, *tmp2, *tmp3; struct list_head *tmp1, *tmp2, *tmp3;
struct TCP_Server_Info *server; struct TCP_Server_Info *server;
struct cifsSesInfo *ses; struct cifs_ses *ses;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
rc = get_user(c, buffer); rc = get_user(c, buffer);
if (rc) if (rc)
...@@ -273,11 +273,11 @@ static ssize_t cifs_stats_proc_write(struct file *file, ...@@ -273,11 +273,11 @@ static ssize_t cifs_stats_proc_write(struct file *file,
server = list_entry(tmp1, struct TCP_Server_Info, server = list_entry(tmp1, struct TCP_Server_Info,
tcp_ses_list); tcp_ses_list);
list_for_each(tmp2, &server->smb_ses_list) { list_for_each(tmp2, &server->smb_ses_list) {
ses = list_entry(tmp2, struct cifsSesInfo, ses = list_entry(tmp2, struct cifs_ses,
smb_ses_list); smb_ses_list);
list_for_each(tmp3, &ses->tcon_list) { list_for_each(tmp3, &ses->tcon_list) {
tcon = list_entry(tmp3, tcon = list_entry(tmp3,
struct cifsTconInfo, struct cifs_tcon,
tcon_list); tcon_list);
atomic_set(&tcon->num_smbs_sent, 0); atomic_set(&tcon->num_smbs_sent, 0);
atomic_set(&tcon->num_writes, 0); atomic_set(&tcon->num_writes, 0);
...@@ -312,8 +312,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v) ...@@ -312,8 +312,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
int i; int i;
struct list_head *tmp1, *tmp2, *tmp3; struct list_head *tmp1, *tmp2, *tmp3;
struct TCP_Server_Info *server; struct TCP_Server_Info *server;
struct cifsSesInfo *ses; struct cifs_ses *ses;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
seq_printf(m, seq_printf(m,
"Resources in use\nCIFS Session: %d\n", "Resources in use\nCIFS Session: %d\n",
...@@ -346,11 +346,11 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v) ...@@ -346,11 +346,11 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
server = list_entry(tmp1, struct TCP_Server_Info, server = list_entry(tmp1, struct TCP_Server_Info,
tcp_ses_list); tcp_ses_list);
list_for_each(tmp2, &server->smb_ses_list) { list_for_each(tmp2, &server->smb_ses_list) {
ses = list_entry(tmp2, struct cifsSesInfo, ses = list_entry(tmp2, struct cifs_ses,
smb_ses_list); smb_ses_list);
list_for_each(tmp3, &ses->tcon_list) { list_for_each(tmp3, &ses->tcon_list) {
tcon = list_entry(tmp3, tcon = list_entry(tmp3,
struct cifsTconInfo, struct cifs_tcon,
tcon_list); tcon_list);
i++; i++;
seq_printf(m, "\n%d) %s", i, tcon->treeName); seq_printf(m, "\n%d) %s", i, tcon->treeName);
......
...@@ -272,7 +272,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt) ...@@ -272,7 +272,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
struct dfs_info3_param *referrals = NULL; struct dfs_info3_param *referrals = NULL;
unsigned int num_referrals = 0; unsigned int num_referrals = 0;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsSesInfo *ses; struct cifs_ses *ses;
char *full_path; char *full_path;
int xid, i; int xid, i;
int rc; int rc;
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#define CIFS_MOUNT_MF_SYMLINKS 0x10000 /* Minshall+French Symlinks enabled */ #define CIFS_MOUNT_MF_SYMLINKS 0x10000 /* Minshall+French Symlinks enabled */
#define CIFS_MOUNT_MULTIUSER 0x20000 /* multiuser mount */ #define CIFS_MOUNT_MULTIUSER 0x20000 /* multiuser mount */
#define CIFS_MOUNT_STRICT_IO 0x40000 /* strict cache mode */ #define CIFS_MOUNT_STRICT_IO 0x40000 /* strict cache mode */
#define CIFS_MOUNT_RWPIDFORWARD 0x80000 /* use pid forwarding for rw */
struct cifs_sb_info { struct cifs_sb_info {
struct rb_root tlink_tree; struct rb_root tlink_tree;
...@@ -56,8 +57,6 @@ struct cifs_sb_info { ...@@ -56,8 +57,6 @@ struct cifs_sb_info {
mode_t mnt_file_mode; mode_t mnt_file_mode;
mode_t mnt_dir_mode; mode_t mnt_dir_mode;
unsigned int mnt_cifs_flags; unsigned int mnt_cifs_flags;
int prepathlen;
char *prepath; /* relative path under the share to mount to */
char *mountdata; /* options received at mount time or via DFS refs */ char *mountdata; /* options received at mount time or via DFS refs */
struct backing_dev_info bdi; struct backing_dev_info bdi;
struct delayed_work prune_tlinks; struct delayed_work prune_tlinks;
......
...@@ -95,7 +95,7 @@ struct key_type cifs_spnego_key_type = { ...@@ -95,7 +95,7 @@ struct key_type cifs_spnego_key_type = {
/* get a key struct with a SPNEGO security blob, suitable for session setup */ /* get a key struct with a SPNEGO security blob, suitable for session setup */
struct key * struct key *
cifs_get_spnego_key(struct cifsSesInfo *sesInfo) cifs_get_spnego_key(struct cifs_ses *sesInfo)
{ {
struct TCP_Server_Info *server = sesInfo->server; struct TCP_Server_Info *server = sesInfo->server;
struct sockaddr_in *sa = (struct sockaddr_in *) &server->dstaddr; struct sockaddr_in *sa = (struct sockaddr_in *) &server->dstaddr;
......
...@@ -41,7 +41,7 @@ struct cifs_spnego_msg { ...@@ -41,7 +41,7 @@ struct cifs_spnego_msg {
#ifdef __KERNEL__ #ifdef __KERNEL__
extern struct key_type cifs_spnego_key_type; extern struct key_type cifs_spnego_key_type;
extern struct key *cifs_get_spnego_key(struct cifsSesInfo *sesInfo); extern struct key *cifs_get_spnego_key(struct cifs_ses *sesInfo);
#endif /* KERNEL */ #endif /* KERNEL */
#endif /* _CIFS_SPNEGO_H */ #endif /* _CIFS_SPNEGO_H */
...@@ -38,7 +38,7 @@ static const struct cifs_sid sid_everyone = { ...@@ -38,7 +38,7 @@ static const struct cifs_sid sid_everyone = {
1, 1, {0, 0, 0, 0, 0, 1}, {0} }; 1, 1, {0, 0, 0, 0, 0, 1}, {0} };
/* security id for Authenticated Users system group */ /* security id for Authenticated Users system group */
static const struct cifs_sid sid_authusers = { static const struct cifs_sid sid_authusers = {
1, 1, {0, 0, 0, 0, 0, 5}, {11} }; 1, 1, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(11)} };
/* group users */ /* group users */
static const struct cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {} }; static const struct cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {} };
...@@ -458,7 +458,8 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) ...@@ -458,7 +458,8 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
if (num_subauth) { if (num_subauth) {
for (i = 0; i < num_subauth; ++i) { for (i = 0; i < num_subauth; ++i) {
if (ctsid->sub_auth[i] != cwsid->sub_auth[i]) { if (ctsid->sub_auth[i] != cwsid->sub_auth[i]) {
if (ctsid->sub_auth[i] > cwsid->sub_auth[i]) if (le32_to_cpu(ctsid->sub_auth[i]) >
le32_to_cpu(cwsid->sub_auth[i]))
return 1; return 1;
else else
return -1; return -1;
...@@ -945,7 +946,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, ...@@ -945,7 +946,7 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
int oplock = 0; int oplock = 0;
int xid, rc; int xid, rc;
__u16 fid; __u16 fid;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink)) if (IS_ERR(tlink))
...@@ -1013,7 +1014,7 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path, ...@@ -1013,7 +1014,7 @@ static int set_cifs_acl_by_path(struct cifs_sb_info *cifs_sb, const char *path,
int oplock = 0; int oplock = 0;
int xid, rc; int xid, rc;
__u16 fid; __u16 fid;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink)) if (IS_ERR(tlink))
......
...@@ -229,7 +229,7 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu, ...@@ -229,7 +229,7 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu,
} }
/* first calculate 24 bytes ntlm response and then 16 byte session key */ /* first calculate 24 bytes ntlm response and then 16 byte session key */
int setup_ntlm_response(struct cifsSesInfo *ses) int setup_ntlm_response(struct cifs_ses *ses)
{ {
int rc = 0; int rc = 0;
unsigned int temp_len = CIFS_SESS_KEY_SIZE + CIFS_AUTH_RESP_SIZE; unsigned int temp_len = CIFS_SESS_KEY_SIZE + CIFS_AUTH_RESP_SIZE;
...@@ -312,7 +312,7 @@ int calc_lanman_hash(const char *password, const char *cryptkey, bool encrypt, ...@@ -312,7 +312,7 @@ int calc_lanman_hash(const char *password, const char *cryptkey, bool encrypt,
* Allocate domain name which gets freed when session struct is deallocated. * Allocate domain name which gets freed when session struct is deallocated.
*/ */
static int static int
build_avpair_blob(struct cifsSesInfo *ses, const struct nls_table *nls_cp) build_avpair_blob(struct cifs_ses *ses, const struct nls_table *nls_cp)
{ {
unsigned int dlen; unsigned int dlen;
unsigned int wlen; unsigned int wlen;
...@@ -400,7 +400,7 @@ build_avpair_blob(struct cifsSesInfo *ses, const struct nls_table *nls_cp) ...@@ -400,7 +400,7 @@ build_avpair_blob(struct cifsSesInfo *ses, const struct nls_table *nls_cp)
* about target string i.e. for some, just user name might suffice. * about target string i.e. for some, just user name might suffice.
*/ */
static int static int
find_domain_name(struct cifsSesInfo *ses, const struct nls_table *nls_cp) find_domain_name(struct cifs_ses *ses, const struct nls_table *nls_cp)
{ {
unsigned int attrsize; unsigned int attrsize;
unsigned int type; unsigned int type;
...@@ -445,7 +445,7 @@ find_domain_name(struct cifsSesInfo *ses, const struct nls_table *nls_cp) ...@@ -445,7 +445,7 @@ find_domain_name(struct cifsSesInfo *ses, const struct nls_table *nls_cp)
return 0; return 0;
} }
static int calc_ntlmv2_hash(struct cifsSesInfo *ses, char *ntlmv2_hash, static int calc_ntlmv2_hash(struct cifs_ses *ses, char *ntlmv2_hash,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
int rc = 0; int rc = 0;
...@@ -527,7 +527,7 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses, char *ntlmv2_hash, ...@@ -527,7 +527,7 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses, char *ntlmv2_hash,
} }
static int static int
CalcNTLMv2_response(const struct cifsSesInfo *ses, char *ntlmv2_hash) CalcNTLMv2_response(const struct cifs_ses *ses, char *ntlmv2_hash)
{ {
int rc; int rc;
unsigned int offset = CIFS_SESS_KEY_SIZE + 8; unsigned int offset = CIFS_SESS_KEY_SIZE + 8;
...@@ -563,7 +563,7 @@ CalcNTLMv2_response(const struct cifsSesInfo *ses, char *ntlmv2_hash) ...@@ -563,7 +563,7 @@ CalcNTLMv2_response(const struct cifsSesInfo *ses, char *ntlmv2_hash)
int int
setup_ntlmv2_rsp(struct cifsSesInfo *ses, const struct nls_table *nls_cp) setup_ntlmv2_rsp(struct cifs_ses *ses, const struct nls_table *nls_cp)
{ {
int rc; int rc;
int baselen; int baselen;
...@@ -649,7 +649,7 @@ setup_ntlmv2_rsp(struct cifsSesInfo *ses, const struct nls_table *nls_cp) ...@@ -649,7 +649,7 @@ setup_ntlmv2_rsp(struct cifsSesInfo *ses, const struct nls_table *nls_cp)
} }
int int
calc_seckey(struct cifsSesInfo *ses) calc_seckey(struct cifs_ses *ses)
{ {
int rc; int rc;
struct crypto_blkcipher *tfm_arc4; struct crypto_blkcipher *tfm_arc4;
......
...@@ -104,46 +104,25 @@ cifs_sb_deactive(struct super_block *sb) ...@@ -104,46 +104,25 @@ cifs_sb_deactive(struct super_block *sb)
} }
static int static int
cifs_read_super(struct super_block *sb, void *data, cifs_read_super(struct super_block *sb, struct smb_vol *volume_info,
const char *devname, int silent) const char *devname, int silent)
{ {
struct inode *inode; struct inode *inode;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
int rc = 0; int rc = 0;
/* BB should we make this contingent on mount parm? */
sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
sb->s_fs_info = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL);
cifs_sb = CIFS_SB(sb); cifs_sb = CIFS_SB(sb);
if (cifs_sb == NULL)
return -ENOMEM;
spin_lock_init(&cifs_sb->tlink_tree_lock); spin_lock_init(&cifs_sb->tlink_tree_lock);
cifs_sb->tlink_tree = RB_ROOT; cifs_sb->tlink_tree = RB_ROOT;
rc = bdi_setup_and_register(&cifs_sb->bdi, "cifs", BDI_CAP_MAP_COPY); rc = bdi_setup_and_register(&cifs_sb->bdi, "cifs", BDI_CAP_MAP_COPY);
if (rc) { if (rc)
kfree(cifs_sb);
return rc; return rc;
}
cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
/* cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
* Copy mount params to sb for use in submounts. Better to do
* the copy here and deal with the error before cleanup gets
* complicated post-mount.
*/
if (data) {
cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
if (cifs_sb->mountdata == NULL) {
bdi_destroy(&cifs_sb->bdi);
kfree(sb->s_fs_info);
sb->s_fs_info = NULL;
return -ENOMEM;
}
}
rc = cifs_mount(sb, cifs_sb, devname); rc = cifs_mount(sb, cifs_sb, volume_info, devname);
if (rc) { if (rc) {
if (!silent) if (!silent)
...@@ -194,15 +173,7 @@ cifs_read_super(struct super_block *sb, void *data, ...@@ -194,15 +173,7 @@ cifs_read_super(struct super_block *sb, void *data,
cifs_umount(sb, cifs_sb); cifs_umount(sb, cifs_sb);
out_mount_failed: out_mount_failed:
if (cifs_sb) { bdi_destroy(&cifs_sb->bdi);
if (cifs_sb->mountdata) {
kfree(cifs_sb->mountdata);
cifs_sb->mountdata = NULL;
}
unload_nls(cifs_sb->local_nls);
bdi_destroy(&cifs_sb->bdi);
kfree(cifs_sb);
}
return rc; return rc;
} }
...@@ -237,7 +208,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -237,7 +208,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb; struct super_block *sb = dentry->d_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
int rc = -EOPNOTSUPP; int rc = -EOPNOTSUPP;
int xid; int xid;
...@@ -390,7 +361,7 @@ static int ...@@ -390,7 +361,7 @@ static int
cifs_show_options(struct seq_file *s, struct vfsmount *m) cifs_show_options(struct seq_file *s, struct vfsmount *m)
{ {
struct cifs_sb_info *cifs_sb = CIFS_SB(m->mnt_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(m->mnt_sb);
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
struct sockaddr *srcaddr; struct sockaddr *srcaddr;
srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr; srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr;
...@@ -444,14 +415,20 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) ...@@ -444,14 +415,20 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
seq_printf(s, ",nocase"); seq_printf(s, ",nocase");
if (tcon->retry) if (tcon->retry)
seq_printf(s, ",hard"); seq_printf(s, ",hard");
if (cifs_sb->prepath) if (tcon->unix_ext)
seq_printf(s, ",prepath=%s", cifs_sb->prepath); seq_printf(s, ",unix");
else
seq_printf(s, ",nounix");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
seq_printf(s, ",posixpaths"); seq_printf(s, ",posixpaths");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)
seq_printf(s, ",setuids"); seq_printf(s, ",setuids");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
seq_printf(s, ",serverino"); seq_printf(s, ",serverino");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
seq_printf(s, ",rwpidforward");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NOPOSIXBRL)
seq_printf(s, ",forcemand");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
seq_printf(s, ",directio"); seq_printf(s, ",directio");
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
...@@ -484,7 +461,7 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m) ...@@ -484,7 +461,7 @@ cifs_show_options(struct seq_file *s, struct vfsmount *m)
static void cifs_umount_begin(struct super_block *sb) static void cifs_umount_begin(struct super_block *sb)
{ {
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
if (cifs_sb == NULL) if (cifs_sb == NULL)
return; return;
...@@ -559,29 +536,189 @@ static const struct super_operations cifs_super_ops = { ...@@ -559,29 +536,189 @@ static const struct super_operations cifs_super_ops = {
#endif #endif
}; };
/*
* Get root dentry from superblock according to prefix path mount option.
* Return dentry with refcount + 1 on success and NULL otherwise.
*/
static struct dentry *
cifs_get_root(struct smb_vol *vol, struct super_block *sb)
{
int xid, rc;
struct inode *inode;
struct qstr name;
struct dentry *dparent = NULL, *dchild = NULL, *alias;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
unsigned int i, full_len, len;
char *full_path = NULL, *pstart;
char sep;
full_path = cifs_build_path_to_root(vol, cifs_sb,
cifs_sb_master_tcon(cifs_sb));
if (full_path == NULL)
return NULL;
cFYI(1, "Get root dentry for %s", full_path);
xid = GetXid();
sep = CIFS_DIR_SEP(cifs_sb);
dparent = dget(sb->s_root);
full_len = strlen(full_path);
full_path[full_len] = sep;
pstart = full_path + 1;
for (i = 1, len = 0; i <= full_len; i++) {
if (full_path[i] != sep || !len) {
len++;
continue;
}
full_path[i] = 0;
cFYI(1, "get dentry for %s", pstart);
name.name = pstart;
name.len = len;
name.hash = full_name_hash(pstart, len);
dchild = d_lookup(dparent, &name);
if (dchild == NULL) {
cFYI(1, "not exists");
dchild = d_alloc(dparent, &name);
if (dchild == NULL) {
dput(dparent);
dparent = NULL;
goto out;
}
}
cFYI(1, "get inode");
if (dchild->d_inode == NULL) {
cFYI(1, "not exists");
inode = NULL;
if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext)
rc = cifs_get_inode_info_unix(&inode, full_path,
sb, xid);
else
rc = cifs_get_inode_info(&inode, full_path,
NULL, sb, xid, NULL);
if (rc) {
dput(dchild);
dput(dparent);
dparent = NULL;
goto out;
}
alias = d_materialise_unique(dchild, inode);
if (alias != NULL) {
dput(dchild);
if (IS_ERR(alias)) {
dput(dparent);
dparent = NULL;
goto out;
}
dchild = alias;
}
}
cFYI(1, "parent %p, child %p", dparent, dchild);
dput(dparent);
dparent = dchild;
len = 0;
pstart = full_path + i + 1;
full_path[i] = sep;
}
out:
_FreeXid(xid);
kfree(full_path);
return dparent;
}
static struct dentry * static struct dentry *
cifs_do_mount(struct file_system_type *fs_type, cifs_do_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data) int flags, const char *dev_name, void *data)
{ {
int rc; int rc;
struct super_block *sb; struct super_block *sb;
struct cifs_sb_info *cifs_sb;
sb = sget(fs_type, NULL, set_anon_super, NULL); struct smb_vol *volume_info;
struct cifs_mnt_data mnt_data;
struct dentry *root;
cFYI(1, "Devname: %s flags: %d ", dev_name, flags); cFYI(1, "Devname: %s flags: %d ", dev_name, flags);
if (IS_ERR(sb)) rc = cifs_setup_volume_info(&volume_info, (char *)data, dev_name);
return ERR_CAST(sb); if (rc)
return ERR_PTR(rc);
cifs_sb = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL);
if (cifs_sb == NULL) {
root = ERR_PTR(-ENOMEM);
goto out;
}
cifs_setup_cifs_sb(volume_info, cifs_sb);
mnt_data.vol = volume_info;
mnt_data.cifs_sb = cifs_sb;
mnt_data.flags = flags;
sb = sget(fs_type, cifs_match_super, set_anon_super, &mnt_data);
if (IS_ERR(sb)) {
root = ERR_CAST(sb);
goto out_cifs_sb;
}
if (sb->s_fs_info) {
cFYI(1, "Use existing superblock");
goto out_shared;
}
/*
* Copy mount params for use in submounts. Better to do
* the copy here and deal with the error before cleanup gets
* complicated post-mount.
*/
cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
if (cifs_sb->mountdata == NULL) {
root = ERR_PTR(-ENOMEM);
goto out_super;
}
sb->s_flags = flags; sb->s_flags = flags;
/* BB should we make this contingent on mount parm? */
sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
sb->s_fs_info = cifs_sb;
rc = cifs_read_super(sb, data, dev_name, flags & MS_SILENT ? 1 : 0); rc = cifs_read_super(sb, volume_info, dev_name,
flags & MS_SILENT ? 1 : 0);
if (rc) { if (rc) {
deactivate_locked_super(sb); root = ERR_PTR(rc);
return ERR_PTR(rc); goto out_super;
} }
sb->s_flags |= MS_ACTIVE; sb->s_flags |= MS_ACTIVE;
return dget(sb->s_root);
root = cifs_get_root(volume_info, sb);
if (root == NULL)
goto out_super;
cFYI(1, "dentry root is: %p", root);
goto out;
out_shared:
root = cifs_get_root(volume_info, sb);
if (root)
cFYI(1, "dentry root is: %p", root);
goto out;
out_super:
kfree(cifs_sb->mountdata);
deactivate_locked_super(sb);
out_cifs_sb:
unload_nls(cifs_sb->local_nls);
kfree(cifs_sb);
out:
cifs_cleanup_volume_info(&volume_info);
return root;
} }
static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
......
...@@ -155,6 +155,81 @@ struct cifs_cred { ...@@ -155,6 +155,81 @@ struct cifs_cred {
***************************************************************** *****************************************************************
*/ */
struct smb_vol {
char *username;
char *password;
char *domainname;
char *UNC;
char *UNCip;
char *iocharset; /* local code page for mapping to and from Unicode */
char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* clnt nb name */
char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* srvr nb name */
uid_t cred_uid;
uid_t linux_uid;
gid_t linux_gid;
mode_t file_mode;
mode_t dir_mode;
unsigned secFlg;
bool retry:1;
bool intr:1;
bool setuids:1;
bool override_uid:1;
bool override_gid:1;
bool dynperm:1;
bool noperm:1;
bool no_psx_acl:1; /* set if posix acl support should be disabled */
bool cifs_acl:1;
bool no_xattr:1; /* set if xattr (EA) support should be disabled*/
bool server_ino:1; /* use inode numbers from server ie UniqueId */
bool direct_io:1;
bool strict_io:1; /* strict cache behavior */
bool remap:1; /* set to remap seven reserved chars in filenames */
bool posix_paths:1; /* unset to not ask for posix pathnames. */
bool no_linux_ext:1;
bool sfu_emul:1;
bool nullauth:1; /* attempt to authenticate with null user */
bool nocase:1; /* request case insensitive filenames */
bool nobrl:1; /* disable sending byte range locks to srv */
bool mand_lock:1; /* send mandatory not posix byte range lock reqs */
bool seal:1; /* request transport encryption on share */
bool nodfs:1; /* Do not request DFS, even if available */
bool local_lease:1; /* check leases only on local system, not remote */
bool noblocksnd:1;
bool noautotune:1;
bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
bool fsc:1; /* enable fscache */
bool mfsymlinks:1; /* use Minshall+French Symlinks */
bool multiuser:1;
bool rwpidforward:1; /* pid forward for read/write operations */
unsigned int rsize;
unsigned int wsize;
bool sockopt_tcp_nodelay:1;
unsigned short int port;
unsigned long actimeo; /* attribute cache timeout (jiffies) */
char *prepath;
struct sockaddr_storage srcaddr; /* allow binding to a local IP */
struct nls_table *local_nls;
};
#define CIFS_MOUNT_MASK (CIFS_MOUNT_NO_PERM | CIFS_MOUNT_SET_UID | \
CIFS_MOUNT_SERVER_INUM | CIFS_MOUNT_DIRECT_IO | \
CIFS_MOUNT_NO_XATTR | CIFS_MOUNT_MAP_SPECIAL_CHR | \
CIFS_MOUNT_UNX_EMUL | CIFS_MOUNT_NO_BRL | \
CIFS_MOUNT_CIFS_ACL | CIFS_MOUNT_OVERR_UID | \
CIFS_MOUNT_OVERR_GID | CIFS_MOUNT_DYNPERM | \
CIFS_MOUNT_NOPOSIXBRL | CIFS_MOUNT_NOSSYNC | \
CIFS_MOUNT_FSCACHE | CIFS_MOUNT_MF_SYMLINKS | \
CIFS_MOUNT_MULTIUSER | CIFS_MOUNT_STRICT_IO)
#define CIFS_MS_MASK (MS_RDONLY | MS_MANDLOCK | MS_NOEXEC | MS_NOSUID | \
MS_NODEV | MS_SYNCHRONOUS)
struct cifs_mnt_data {
struct cifs_sb_info *cifs_sb;
struct smb_vol *vol;
int flags;
};
struct TCP_Server_Info { struct TCP_Server_Info {
struct list_head tcp_ses_list; struct list_head tcp_ses_list;
struct list_head smb_ses_list; struct list_head smb_ses_list;
...@@ -179,7 +254,7 @@ struct TCP_Server_Info { ...@@ -179,7 +254,7 @@ struct TCP_Server_Info {
struct mutex srv_mutex; struct mutex srv_mutex;
struct task_struct *tsk; struct task_struct *tsk;
char server_GUID[16]; char server_GUID[16];
char secMode; char sec_mode;
bool session_estab; /* mark when very first sess is established */ bool session_estab; /* mark when very first sess is established */
u16 dialect; /* dialect index that server chose */ u16 dialect; /* dialect index that server chose */
enum securityEnum secType; enum securityEnum secType;
...@@ -254,7 +329,7 @@ static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net) ...@@ -254,7 +329,7 @@ static inline void cifs_set_net_ns(struct TCP_Server_Info *srv, struct net *net)
/* /*
* Session structure. One of these for each uid session with a particular host * Session structure. One of these for each uid session with a particular host
*/ */
struct cifsSesInfo { struct cifs_ses {
struct list_head smb_ses_list; struct list_head smb_ses_list;
struct list_head tcon_list; struct list_head tcon_list;
struct mutex session_mutex; struct mutex session_mutex;
...@@ -294,11 +369,11 @@ struct cifsSesInfo { ...@@ -294,11 +369,11 @@ struct cifsSesInfo {
* there is one of these for each connection to a resource on a particular * there is one of these for each connection to a resource on a particular
* session * session
*/ */
struct cifsTconInfo { struct cifs_tcon {
struct list_head tcon_list; struct list_head tcon_list;
int tc_count; int tc_count;
struct list_head openFileList; struct list_head openFileList;
struct cifsSesInfo *ses; /* pointer to session associated with */ struct cifs_ses *ses; /* pointer to session associated with */
char treeName[MAX_TREE_SIZE + 1]; /* UNC name of resource in ASCII */ char treeName[MAX_TREE_SIZE + 1]; /* UNC name of resource in ASCII */
char *nativeFileSystem; char *nativeFileSystem;
char *password; /* for share-level security */ char *password; /* for share-level security */
...@@ -380,12 +455,12 @@ struct tcon_link { ...@@ -380,12 +455,12 @@ struct tcon_link {
#define TCON_LINK_IN_TREE 2 #define TCON_LINK_IN_TREE 2
unsigned long tl_time; unsigned long tl_time;
atomic_t tl_count; atomic_t tl_count;
struct cifsTconInfo *tl_tcon; struct cifs_tcon *tl_tcon;
}; };
extern struct tcon_link *cifs_sb_tlink(struct cifs_sb_info *cifs_sb); extern struct tcon_link *cifs_sb_tlink(struct cifs_sb_info *cifs_sb);
static inline struct cifsTconInfo * static inline struct cifs_tcon *
tlink_tcon(struct tcon_link *tlink) tlink_tcon(struct tcon_link *tlink)
{ {
return tlink->tl_tcon; return tlink->tl_tcon;
...@@ -402,7 +477,7 @@ cifs_get_tlink(struct tcon_link *tlink) ...@@ -402,7 +477,7 @@ cifs_get_tlink(struct tcon_link *tlink)
} }
/* This function is always expected to succeed */ /* This function is always expected to succeed */
extern struct cifsTconInfo *cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb); extern struct cifs_tcon *cifs_sb_master_tcon(struct cifs_sb_info *cifs_sb);
/* /*
* This info hangs off the cifsFileInfo structure, pointed to by llist. * This info hangs off the cifsFileInfo structure, pointed to by llist.
...@@ -455,6 +530,14 @@ struct cifsFileInfo { ...@@ -455,6 +530,14 @@ struct cifsFileInfo {
struct work_struct oplock_break; /* work for oplock breaks */ struct work_struct oplock_break; /* work for oplock breaks */
}; };
struct cifs_io_parms {
__u16 netfid;
__u32 pid;
__u64 offset;
unsigned int length;
struct cifs_tcon *tcon;
};
/* /*
* Take a reference on the file private data. Must be called with * Take a reference on the file private data. Must be called with
* cifs_file_list_lock held. * cifs_file_list_lock held.
...@@ -509,10 +592,30 @@ static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb) ...@@ -509,10 +592,30 @@ static inline char CIFS_DIR_SEP(const struct cifs_sb_info *cifs_sb)
return '\\'; return '\\';
} }
static inline void
convert_delimiter(char *path, char delim)
{
int i;
char old_delim;
if (path == NULL)
return;
if (delim == '/')
old_delim = '\\';
else
old_delim = '/';
for (i = 0; path[i] != '\0'; i++) {
if (path[i] == old_delim)
path[i] = delim;
}
}
#ifdef CONFIG_CIFS_STATS #ifdef CONFIG_CIFS_STATS
#define cifs_stats_inc atomic_inc #define cifs_stats_inc atomic_inc
static inline void cifs_stats_bytes_written(struct cifsTconInfo *tcon, static inline void cifs_stats_bytes_written(struct cifs_tcon *tcon,
unsigned int bytes) unsigned int bytes)
{ {
if (bytes) { if (bytes) {
...@@ -522,7 +625,7 @@ static inline void cifs_stats_bytes_written(struct cifsTconInfo *tcon, ...@@ -522,7 +625,7 @@ static inline void cifs_stats_bytes_written(struct cifsTconInfo *tcon,
} }
} }
static inline void cifs_stats_bytes_read(struct cifsTconInfo *tcon, static inline void cifs_stats_bytes_read(struct cifs_tcon *tcon,
unsigned int bytes) unsigned int bytes)
{ {
spin_lock(&tcon->stat_lock); spin_lock(&tcon->stat_lock);
...@@ -543,9 +646,8 @@ struct mid_q_entry; ...@@ -543,9 +646,8 @@ struct mid_q_entry;
* This is the prototype for the mid callback function. When creating one, * This is the prototype for the mid callback function. When creating one,
* take special care to avoid deadlocks. Things to bear in mind: * take special care to avoid deadlocks. Things to bear in mind:
* *
* - it will be called by cifsd * - it will be called by cifsd, with no locks held
* - the GlobalMid_Lock will be held * - the mid will be removed from any lists
* - the mid will be removed from the pending_mid_q list
*/ */
typedef void (mid_callback_t)(struct mid_q_entry *mid); typedef void (mid_callback_t)(struct mid_q_entry *mid);
...@@ -573,7 +675,7 @@ struct mid_q_entry { ...@@ -573,7 +675,7 @@ struct mid_q_entry {
struct oplock_q_entry { struct oplock_q_entry {
struct list_head qhead; struct list_head qhead;
struct inode *pinode; struct inode *pinode;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
__u16 netfid; __u16 netfid;
}; };
...@@ -656,6 +758,7 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param, ...@@ -656,6 +758,7 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param,
#define MID_RESPONSE_RECEIVED 4 #define MID_RESPONSE_RECEIVED 4
#define MID_RETRY_NEEDED 8 /* session closed while this request out */ #define MID_RETRY_NEEDED 8 /* session closed while this request out */
#define MID_RESPONSE_MALFORMED 0x10 #define MID_RESPONSE_MALFORMED 0x10
#define MID_SHUTDOWN 0x20
/* Types of response buffer returned from SendReceive2 */ /* Types of response buffer returned from SendReceive2 */
#define CIFS_NO_BUFFER 0 /* Response buffer not returned */ #define CIFS_NO_BUFFER 0 /* Response buffer not returned */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -50,12 +50,11 @@ build_path_from_dentry(struct dentry *direntry) ...@@ -50,12 +50,11 @@ build_path_from_dentry(struct dentry *direntry)
{ {
struct dentry *temp; struct dentry *temp;
int namelen; int namelen;
int pplen;
int dfsplen; int dfsplen;
char *full_path; char *full_path;
char dirsep; char dirsep;
struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(direntry->d_sb);
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
if (direntry == NULL) if (direntry == NULL)
return NULL; /* not much we can do if dentry is freed and return NULL; /* not much we can do if dentry is freed and
...@@ -63,13 +62,12 @@ build_path_from_dentry(struct dentry *direntry) ...@@ -63,13 +62,12 @@ build_path_from_dentry(struct dentry *direntry)
when the server crashed */ when the server crashed */
dirsep = CIFS_DIR_SEP(cifs_sb); dirsep = CIFS_DIR_SEP(cifs_sb);
pplen = cifs_sb->prepathlen;
if (tcon->Flags & SMB_SHARE_IS_IN_DFS) if (tcon->Flags & SMB_SHARE_IS_IN_DFS)
dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1); dfsplen = strnlen(tcon->treeName, MAX_TREE_SIZE + 1);
else else
dfsplen = 0; dfsplen = 0;
cifs_bp_rename_retry: cifs_bp_rename_retry:
namelen = pplen + dfsplen; namelen = dfsplen;
for (temp = direntry; !IS_ROOT(temp);) { for (temp = direntry; !IS_ROOT(temp);) {
namelen += (1 + temp->d_name.len); namelen += (1 + temp->d_name.len);
temp = temp->d_parent; temp = temp->d_parent;
...@@ -100,7 +98,7 @@ build_path_from_dentry(struct dentry *direntry) ...@@ -100,7 +98,7 @@ build_path_from_dentry(struct dentry *direntry)
return NULL; return NULL;
} }
} }
if (namelen != pplen + dfsplen) { if (namelen != dfsplen) {
cERROR(1, "did not end path lookup where expected namelen is %d", cERROR(1, "did not end path lookup where expected namelen is %d",
namelen); namelen);
/* presumably this is only possible if racing with a rename /* presumably this is only possible if racing with a rename
...@@ -126,7 +124,6 @@ build_path_from_dentry(struct dentry *direntry) ...@@ -126,7 +124,6 @@ build_path_from_dentry(struct dentry *direntry)
} }
} }
} }
strncpy(full_path + dfsplen, CIFS_SB(direntry->d_sb)->prepath, pplen);
return full_path; return full_path;
} }
...@@ -152,7 +149,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -152,7 +149,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
__u16 fileHandle; __u16 fileHandle;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
char *full_path = NULL; char *full_path = NULL;
FILE_ALL_INFO *buf = NULL; FILE_ALL_INFO *buf = NULL;
struct inode *newinode = NULL; struct inode *newinode = NULL;
...@@ -356,7 +353,8 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, ...@@ -356,7 +353,8 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
int xid; int xid;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct cifs_io_parms io_parms;
char *full_path = NULL; char *full_path = NULL;
struct inode *newinode = NULL; struct inode *newinode = NULL;
int oplock = 0; int oplock = 0;
...@@ -439,16 +437,19 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, ...@@ -439,16 +437,19 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
* timestamps in, but we can reuse it safely */ * timestamps in, but we can reuse it safely */
pdev = (struct win_dev *)buf; pdev = (struct win_dev *)buf;
io_parms.netfid = fileHandle;
io_parms.pid = current->tgid;
io_parms.tcon = pTcon;
io_parms.offset = 0;
io_parms.length = sizeof(struct win_dev);
if (S_ISCHR(mode)) { if (S_ISCHR(mode)) {
memcpy(pdev->type, "IntxCHR", 8); memcpy(pdev->type, "IntxCHR", 8);
pdev->major = pdev->major =
cpu_to_le64(MAJOR(device_number)); cpu_to_le64(MAJOR(device_number));
pdev->minor = pdev->minor =
cpu_to_le64(MINOR(device_number)); cpu_to_le64(MINOR(device_number));
rc = CIFSSMBWrite(xid, pTcon, rc = CIFSSMBWrite(xid, &io_parms,
fileHandle, &bytes_written, (char *)pdev,
sizeof(struct win_dev),
0, &bytes_written, (char *)pdev,
NULL, 0); NULL, 0);
} else if (S_ISBLK(mode)) { } else if (S_ISBLK(mode)) {
memcpy(pdev->type, "IntxBLK", 8); memcpy(pdev->type, "IntxBLK", 8);
...@@ -456,10 +457,8 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, ...@@ -456,10 +457,8 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
cpu_to_le64(MAJOR(device_number)); cpu_to_le64(MAJOR(device_number));
pdev->minor = pdev->minor =
cpu_to_le64(MINOR(device_number)); cpu_to_le64(MINOR(device_number));
rc = CIFSSMBWrite(xid, pTcon, rc = CIFSSMBWrite(xid, &io_parms,
fileHandle, &bytes_written, (char *)pdev,
sizeof(struct win_dev),
0, &bytes_written, (char *)pdev,
NULL, 0); NULL, 0);
} /* else if (S_ISFIFO) */ } /* else if (S_ISFIFO) */
CIFSSMBClose(xid, pTcon, fileHandle); CIFSSMBClose(xid, pTcon, fileHandle);
...@@ -486,7 +485,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, ...@@ -486,7 +485,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
bool posix_open = false; bool posix_open = false;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct cifsFileInfo *cfile; struct cifsFileInfo *cfile;
struct inode *newInode = NULL; struct inode *newInode = NULL;
char *full_path = NULL; char *full_path = NULL;
......
This diff is collapsed.
...@@ -40,7 +40,7 @@ void cifs_fscache_release_client_cookie(struct TCP_Server_Info *server) ...@@ -40,7 +40,7 @@ void cifs_fscache_release_client_cookie(struct TCP_Server_Info *server)
server->fscache = NULL; server->fscache = NULL;
} }
void cifs_fscache_get_super_cookie(struct cifsTconInfo *tcon) void cifs_fscache_get_super_cookie(struct cifs_tcon *tcon)
{ {
struct TCP_Server_Info *server = tcon->ses->server; struct TCP_Server_Info *server = tcon->ses->server;
...@@ -51,7 +51,7 @@ void cifs_fscache_get_super_cookie(struct cifsTconInfo *tcon) ...@@ -51,7 +51,7 @@ void cifs_fscache_get_super_cookie(struct cifsTconInfo *tcon)
server->fscache, tcon->fscache); server->fscache, tcon->fscache);
} }
void cifs_fscache_release_super_cookie(struct cifsTconInfo *tcon) void cifs_fscache_release_super_cookie(struct cifs_tcon *tcon)
{ {
cFYI(1, "CIFS: releasing superblock cookie (0x%p)", tcon->fscache); cFYI(1, "CIFS: releasing superblock cookie (0x%p)", tcon->fscache);
fscache_relinquish_cookie(tcon->fscache, 0); fscache_relinquish_cookie(tcon->fscache, 0);
...@@ -62,7 +62,7 @@ static void cifs_fscache_enable_inode_cookie(struct inode *inode) ...@@ -62,7 +62,7 @@ static void cifs_fscache_enable_inode_cookie(struct inode *inode)
{ {
struct cifsInodeInfo *cifsi = CIFS_I(inode); struct cifsInodeInfo *cifsi = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
if (cifsi->fscache) if (cifsi->fscache)
return; return;
......
...@@ -40,8 +40,8 @@ extern void cifs_fscache_unregister(void); ...@@ -40,8 +40,8 @@ extern void cifs_fscache_unregister(void);
*/ */
extern void cifs_fscache_get_client_cookie(struct TCP_Server_Info *); extern void cifs_fscache_get_client_cookie(struct TCP_Server_Info *);
extern void cifs_fscache_release_client_cookie(struct TCP_Server_Info *); extern void cifs_fscache_release_client_cookie(struct TCP_Server_Info *);
extern void cifs_fscache_get_super_cookie(struct cifsTconInfo *); extern void cifs_fscache_get_super_cookie(struct cifs_tcon *);
extern void cifs_fscache_release_super_cookie(struct cifsTconInfo *); extern void cifs_fscache_release_super_cookie(struct cifs_tcon *);
extern void cifs_fscache_release_inode_cookie(struct inode *); extern void cifs_fscache_release_inode_cookie(struct inode *);
extern void cifs_fscache_set_inode_cookie(struct inode *, struct file *); extern void cifs_fscache_set_inode_cookie(struct inode *, struct file *);
...@@ -99,9 +99,9 @@ static inline void ...@@ -99,9 +99,9 @@ static inline void
cifs_fscache_get_client_cookie(struct TCP_Server_Info *server) {} cifs_fscache_get_client_cookie(struct TCP_Server_Info *server) {}
static inline void static inline void
cifs_fscache_release_client_cookie(struct TCP_Server_Info *server) {} cifs_fscache_release_client_cookie(struct TCP_Server_Info *server) {}
static inline void cifs_fscache_get_super_cookie(struct cifsTconInfo *tcon) {} static inline void cifs_fscache_get_super_cookie(struct cifs_tcon *tcon) {}
static inline void static inline void
cifs_fscache_release_super_cookie(struct cifsTconInfo *tcon) {} cifs_fscache_release_super_cookie(struct cifs_tcon *tcon) {}
static inline void cifs_fscache_release_inode_cookie(struct inode *inode) {} static inline void cifs_fscache_release_inode_cookie(struct inode *inode) {}
static inline void cifs_fscache_set_inode_cookie(struct inode *inode, static inline void cifs_fscache_set_inode_cookie(struct inode *inode,
......
...@@ -295,7 +295,7 @@ int cifs_get_file_info_unix(struct file *filp) ...@@ -295,7 +295,7 @@ int cifs_get_file_info_unix(struct file *filp)
struct inode *inode = filp->f_path.dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsFileInfo *cfile = filp->private_data; struct cifsFileInfo *cfile = filp->private_data;
struct cifsTconInfo *tcon = tlink_tcon(cfile->tlink); struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
xid = GetXid(); xid = GetXid();
rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->netfid, &find_data); rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->netfid, &find_data);
...@@ -318,7 +318,7 @@ int cifs_get_inode_info_unix(struct inode **pinode, ...@@ -318,7 +318,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
int rc; int rc;
FILE_UNIX_BASIC_INFO find_data; FILE_UNIX_BASIC_INFO find_data;
struct cifs_fattr fattr; struct cifs_fattr fattr;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
...@@ -373,7 +373,8 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path, ...@@ -373,7 +373,8 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
int oplock = 0; int oplock = 0;
__u16 netfid; __u16 netfid;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
struct cifs_io_parms io_parms;
char buf[24]; char buf[24];
unsigned int bytes_read; unsigned int bytes_read;
char *pbuf; char *pbuf;
...@@ -405,9 +406,13 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path, ...@@ -405,9 +406,13 @@ cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path,
if (rc == 0) { if (rc == 0) {
int buf_type = CIFS_NO_BUFFER; int buf_type = CIFS_NO_BUFFER;
/* Read header */ /* Read header */
rc = CIFSSMBRead(xid, tcon, netfid, io_parms.netfid = netfid;
24 /* length */, 0 /* offset */, io_parms.pid = current->tgid;
&bytes_read, &pbuf, &buf_type); io_parms.tcon = tcon;
io_parms.offset = 0;
io_parms.length = 24;
rc = CIFSSMBRead(xid, &io_parms, &bytes_read, &pbuf,
&buf_type);
if ((rc == 0) && (bytes_read >= 8)) { if ((rc == 0) && (bytes_read >= 8)) {
if (memcmp("IntxBLK", pbuf, 8) == 0) { if (memcmp("IntxBLK", pbuf, 8) == 0) {
cFYI(1, "Block device"); cFYI(1, "Block device");
...@@ -468,7 +473,7 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path, ...@@ -468,7 +473,7 @@ static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path,
char ea_value[4]; char ea_value[4];
__u32 mode; __u32 mode;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
tlink = cifs_sb_tlink(cifs_sb); tlink = cifs_sb_tlink(cifs_sb);
if (IS_ERR(tlink)) if (IS_ERR(tlink))
...@@ -502,7 +507,7 @@ static void ...@@ -502,7 +507,7 @@ static void
cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
struct cifs_sb_info *cifs_sb, bool adjust_tz) struct cifs_sb_info *cifs_sb, bool adjust_tz)
{ {
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
memset(fattr, 0, sizeof(*fattr)); memset(fattr, 0, sizeof(*fattr));
fattr->cf_cifsattrs = le32_to_cpu(info->Attributes); fattr->cf_cifsattrs = le32_to_cpu(info->Attributes);
...@@ -553,7 +558,7 @@ int cifs_get_file_info(struct file *filp) ...@@ -553,7 +558,7 @@ int cifs_get_file_info(struct file *filp)
struct inode *inode = filp->f_path.dentry->d_inode; struct inode *inode = filp->f_path.dentry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsFileInfo *cfile = filp->private_data; struct cifsFileInfo *cfile = filp->private_data;
struct cifsTconInfo *tcon = tlink_tcon(cfile->tlink); struct cifs_tcon *tcon = tlink_tcon(cfile->tlink);
xid = GetXid(); xid = GetXid();
rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data); rc = CIFSSMBQFileInfo(xid, tcon, cfile->netfid, &find_data);
...@@ -590,7 +595,7 @@ int cifs_get_inode_info(struct inode **pinode, ...@@ -590,7 +595,7 @@ int cifs_get_inode_info(struct inode **pinode,
struct super_block *sb, int xid, const __u16 *pfid) struct super_block *sb, int xid, const __u16 *pfid)
{ {
int rc = 0, tmprc; int rc = 0, tmprc;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
char *buf = NULL; char *buf = NULL;
...@@ -735,10 +740,10 @@ static const struct inode_operations cifs_ipc_inode_ops = { ...@@ -735,10 +740,10 @@ static const struct inode_operations cifs_ipc_inode_ops = {
.lookup = cifs_lookup, .lookup = cifs_lookup,
}; };
char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb, char *cifs_build_path_to_root(struct smb_vol *vol, struct cifs_sb_info *cifs_sb,
struct cifsTconInfo *tcon) struct cifs_tcon *tcon)
{ {
int pplen = cifs_sb->prepathlen; int pplen = vol->prepath ? strlen(vol->prepath) : 0;
int dfsplen; int dfsplen;
char *full_path = NULL; char *full_path = NULL;
...@@ -772,7 +777,7 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb, ...@@ -772,7 +777,7 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb,
} }
} }
} }
strncpy(full_path + dfsplen, cifs_sb->prepath, pplen); strncpy(full_path + dfsplen, vol->prepath, pplen);
full_path[dfsplen + pplen] = 0; /* add trailing null */ full_path[dfsplen + pplen] = 0; /* add trailing null */
return full_path; return full_path;
} }
...@@ -884,19 +889,13 @@ struct inode *cifs_root_iget(struct super_block *sb) ...@@ -884,19 +889,13 @@ struct inode *cifs_root_iget(struct super_block *sb)
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct inode *inode = NULL; struct inode *inode = NULL;
long rc; long rc;
char *full_path; struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb);
full_path = cifs_build_path_to_root(cifs_sb, tcon);
if (full_path == NULL)
return ERR_PTR(-ENOMEM);
xid = GetXid(); xid = GetXid();
if (tcon->unix_ext) if (tcon->unix_ext)
rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); rc = cifs_get_inode_info_unix(&inode, "", sb, xid);
else else
rc = cifs_get_inode_info(&inode, full_path, NULL, sb, rc = cifs_get_inode_info(&inode, "", NULL, sb, xid, NULL);
xid, NULL);
if (!inode) { if (!inode) {
inode = ERR_PTR(rc); inode = ERR_PTR(rc);
...@@ -922,7 +921,6 @@ struct inode *cifs_root_iget(struct super_block *sb) ...@@ -922,7 +921,6 @@ struct inode *cifs_root_iget(struct super_block *sb)
} }
out: out:
kfree(full_path);
/* can not call macro FreeXid here since in a void func /* can not call macro FreeXid here since in a void func
* TODO: This is no longer true * TODO: This is no longer true
*/ */
...@@ -943,7 +941,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid, ...@@ -943,7 +941,7 @@ cifs_set_file_info(struct inode *inode, struct iattr *attrs, int xid,
struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink = NULL; struct tcon_link *tlink = NULL;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
FILE_BASIC_INFO info_buf; FILE_BASIC_INFO info_buf;
if (attrs == NULL) if (attrs == NULL)
...@@ -1061,7 +1059,7 @@ cifs_rename_pending_delete(char *full_path, struct dentry *dentry, int xid) ...@@ -1061,7 +1059,7 @@ cifs_rename_pending_delete(char *full_path, struct dentry *dentry, int xid)
struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
__u32 dosattr, origattr; __u32 dosattr, origattr;
FILE_BASIC_INFO *info_buf = NULL; FILE_BASIC_INFO *info_buf = NULL;
...@@ -1179,7 +1177,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry) ...@@ -1179,7 +1177,7 @@ int cifs_unlink(struct inode *dir, struct dentry *dentry)
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
struct iattr *attrs = NULL; struct iattr *attrs = NULL;
__u32 dosattr = 0, origattr = 0; __u32 dosattr = 0, origattr = 0;
...@@ -1277,7 +1275,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) ...@@ -1277,7 +1275,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
int xid; int xid;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
char *full_path = NULL; char *full_path = NULL;
struct inode *newinode = NULL; struct inode *newinode = NULL;
struct cifs_fattr fattr; struct cifs_fattr fattr;
...@@ -1455,7 +1453,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) ...@@ -1455,7 +1453,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
int xid; int xid;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
char *full_path = NULL; char *full_path = NULL;
struct cifsInodeInfo *cifsInode; struct cifsInodeInfo *cifsInode;
...@@ -1512,7 +1510,7 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath, ...@@ -1512,7 +1510,7 @@ cifs_do_rename(int xid, struct dentry *from_dentry, const char *fromPath,
{ {
struct cifs_sb_info *cifs_sb = CIFS_SB(from_dentry->d_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(from_dentry->d_sb);
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
__u16 srcfid; __u16 srcfid;
int oplock, rc; int oplock, rc;
...@@ -1564,7 +1562,7 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, ...@@ -1564,7 +1562,7 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry,
char *toName = NULL; char *toName = NULL;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
FILE_UNIX_BASIC_INFO *info_buf_source = NULL; FILE_UNIX_BASIC_INFO *info_buf_source = NULL;
FILE_UNIX_BASIC_INFO *info_buf_target; FILE_UNIX_BASIC_INFO *info_buf_target;
int xid, rc, tmprc; int xid, rc, tmprc;
...@@ -1794,7 +1792,7 @@ int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry, ...@@ -1794,7 +1792,7 @@ int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat) struct kstat *stat)
{ {
struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb);
struct cifsTconInfo *tcon = cifs_sb_master_tcon(cifs_sb); struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
int rc; int rc;
...@@ -1872,7 +1870,8 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, ...@@ -1872,7 +1870,8 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink = NULL; struct tcon_link *tlink = NULL;
struct cifsTconInfo *pTcon = NULL; struct cifs_tcon *pTcon = NULL;
struct cifs_io_parms io_parms;
/* /*
* To avoid spurious oplock breaks from server, in the case of * To avoid spurious oplock breaks from server, in the case of
...@@ -1894,8 +1893,14 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, ...@@ -1894,8 +1893,14 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
cFYI(1, "SetFSize for attrs rc = %d", rc); cFYI(1, "SetFSize for attrs rc = %d", rc);
if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
unsigned int bytes_written; unsigned int bytes_written;
rc = CIFSSMBWrite(xid, pTcon, nfid, 0, attrs->ia_size,
&bytes_written, NULL, NULL, 1); io_parms.netfid = nfid;
io_parms.pid = npid;
io_parms.tcon = pTcon;
io_parms.offset = 0;
io_parms.length = attrs->ia_size;
rc = CIFSSMBWrite(xid, &io_parms, &bytes_written,
NULL, NULL, 1);
cFYI(1, "Wrt seteof rc %d", rc); cFYI(1, "Wrt seteof rc %d", rc);
} }
} else } else
...@@ -1930,10 +1935,15 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs, ...@@ -1930,10 +1935,15 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
if (rc == 0) { if (rc == 0) {
unsigned int bytes_written; unsigned int bytes_written;
rc = CIFSSMBWrite(xid, pTcon, netfid, 0,
attrs->ia_size, io_parms.netfid = netfid;
&bytes_written, NULL, io_parms.pid = current->tgid;
NULL, 1); io_parms.tcon = pTcon;
io_parms.offset = 0;
io_parms.length = attrs->ia_size;
rc = CIFSSMBWrite(xid, &io_parms,
&bytes_written,
NULL, NULL, 1);
cFYI(1, "wrt seteof rc %d", rc); cFYI(1, "wrt seteof rc %d", rc);
CIFSSMBClose(xid, pTcon, netfid); CIFSSMBClose(xid, pTcon, netfid);
} }
...@@ -1961,7 +1971,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) ...@@ -1961,7 +1971,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
struct cifsInodeInfo *cifsInode = CIFS_I(inode); struct cifsInodeInfo *cifsInode = CIFS_I(inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct cifs_unix_set_info_args *args = NULL; struct cifs_unix_set_info_args *args = NULL;
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
...@@ -2247,7 +2257,7 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -2247,7 +2257,7 @@ cifs_setattr(struct dentry *direntry, struct iattr *attrs)
{ {
struct inode *inode = direntry->d_inode; struct inode *inode = direntry->d_inode;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct cifsTconInfo *pTcon = cifs_sb_master_tcon(cifs_sb); struct cifs_tcon *pTcon = cifs_sb_master_tcon(cifs_sb);
if (pTcon->unix_ext) if (pTcon->unix_ext)
return cifs_setattr_unix(direntry, attrs); return cifs_setattr_unix(direntry, attrs);
......
...@@ -38,7 +38,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) ...@@ -38,7 +38,7 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
struct cifsFileInfo *pSMBFile = filep->private_data; struct cifsFileInfo *pSMBFile = filep->private_data;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
__u64 ExtAttrBits = 0; __u64 ExtAttrBits = 0;
__u64 ExtAttrMask = 0; __u64 ExtAttrMask = 0;
__u64 caps; __u64 caps;
......
...@@ -175,7 +175,7 @@ CIFSFormatMFSymlink(u8 *buf, unsigned int buf_len, const char *link_str) ...@@ -175,7 +175,7 @@ CIFSFormatMFSymlink(u8 *buf, unsigned int buf_len, const char *link_str)
} }
static int static int
CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon, CIFSCreateMFSymLink(const int xid, struct cifs_tcon *tcon,
const char *fromName, const char *toName, const char *fromName, const char *toName,
const struct nls_table *nls_codepage, int remap) const struct nls_table *nls_codepage, int remap)
{ {
...@@ -184,6 +184,7 @@ CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon, ...@@ -184,6 +184,7 @@ CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon,
__u16 netfid = 0; __u16 netfid = 0;
u8 *buf; u8 *buf;
unsigned int bytes_written = 0; unsigned int bytes_written = 0;
struct cifs_io_parms io_parms;
buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL); buf = kmalloc(CIFS_MF_SYMLINK_FILE_SIZE, GFP_KERNEL);
if (!buf) if (!buf)
...@@ -203,10 +204,13 @@ CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon, ...@@ -203,10 +204,13 @@ CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon,
return rc; return rc;
} }
rc = CIFSSMBWrite(xid, tcon, netfid, io_parms.netfid = netfid;
CIFS_MF_SYMLINK_FILE_SIZE /* length */, io_parms.pid = current->tgid;
0 /* offset */, io_parms.tcon = tcon;
&bytes_written, buf, NULL, 0); io_parms.offset = 0;
io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE;
rc = CIFSSMBWrite(xid, &io_parms, &bytes_written, buf, NULL, 0);
CIFSSMBClose(xid, tcon, netfid); CIFSSMBClose(xid, tcon, netfid);
kfree(buf); kfree(buf);
if (rc != 0) if (rc != 0)
...@@ -219,7 +223,7 @@ CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon, ...@@ -219,7 +223,7 @@ CIFSCreateMFSymLink(const int xid, struct cifsTconInfo *tcon,
} }
static int static int
CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon, CIFSQueryMFSymLink(const int xid, struct cifs_tcon *tcon,
const unsigned char *searchName, char **symlinkinfo, const unsigned char *searchName, char **symlinkinfo,
const struct nls_table *nls_codepage, int remap) const struct nls_table *nls_codepage, int remap)
{ {
...@@ -231,6 +235,7 @@ CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon, ...@@ -231,6 +235,7 @@ CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon,
unsigned int bytes_read = 0; unsigned int bytes_read = 0;
int buf_type = CIFS_NO_BUFFER; int buf_type = CIFS_NO_BUFFER;
unsigned int link_len = 0; unsigned int link_len = 0;
struct cifs_io_parms io_parms;
FILE_ALL_INFO file_info; FILE_ALL_INFO file_info;
rc = CIFSSMBOpen(xid, tcon, searchName, FILE_OPEN, GENERIC_READ, rc = CIFSSMBOpen(xid, tcon, searchName, FILE_OPEN, GENERIC_READ,
...@@ -249,11 +254,13 @@ CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon, ...@@ -249,11 +254,13 @@ CIFSQueryMFSymLink(const int xid, struct cifsTconInfo *tcon,
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
pbuf = buf; pbuf = buf;
io_parms.netfid = netfid;
io_parms.pid = current->tgid;
io_parms.tcon = tcon;
io_parms.offset = 0;
io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE;
rc = CIFSSMBRead(xid, tcon, netfid, rc = CIFSSMBRead(xid, &io_parms, &bytes_read, &pbuf, &buf_type);
CIFS_MF_SYMLINK_FILE_SIZE /* length */,
0 /* offset */,
&bytes_read, &pbuf, &buf_type);
CIFSSMBClose(xid, tcon, netfid); CIFSSMBClose(xid, tcon, netfid);
if (rc != 0) { if (rc != 0) {
kfree(buf); kfree(buf);
...@@ -291,7 +298,8 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr, ...@@ -291,7 +298,8 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr,
int oplock = 0; int oplock = 0;
__u16 netfid = 0; __u16 netfid = 0;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct cifs_io_parms io_parms;
u8 *buf; u8 *buf;
char *pbuf; char *pbuf;
unsigned int bytes_read = 0; unsigned int bytes_read = 0;
...@@ -328,11 +336,13 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr, ...@@ -328,11 +336,13 @@ CIFSCheckMFSymlink(struct cifs_fattr *fattr,
goto out; goto out;
} }
pbuf = buf; pbuf = buf;
io_parms.netfid = netfid;
io_parms.pid = current->tgid;
io_parms.tcon = pTcon;
io_parms.offset = 0;
io_parms.length = CIFS_MF_SYMLINK_FILE_SIZE;
rc = CIFSSMBRead(xid, pTcon, netfid, rc = CIFSSMBRead(xid, &io_parms, &bytes_read, &pbuf, &buf_type);
CIFS_MF_SYMLINK_FILE_SIZE /* length */,
0 /* offset */,
&bytes_read, &pbuf, &buf_type);
CIFSSMBClose(xid, pTcon, netfid); CIFSSMBClose(xid, pTcon, netfid);
if (rc != 0) { if (rc != 0) {
kfree(buf); kfree(buf);
...@@ -370,7 +380,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, ...@@ -370,7 +380,7 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
char *toName = NULL; char *toName = NULL;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct cifsInodeInfo *cifsInode; struct cifsInodeInfo *cifsInode;
tlink = cifs_sb_tlink(cifs_sb); tlink = cifs_sb_tlink(cifs_sb);
...@@ -445,7 +455,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd) ...@@ -445,7 +455,7 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
char *target_path = NULL; char *target_path = NULL;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink = NULL; struct tcon_link *tlink = NULL;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
xid = GetXid(); xid = GetXid();
...@@ -518,7 +528,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) ...@@ -518,7 +528,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
int xid; int xid;
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
char *full_path = NULL; char *full_path = NULL;
struct inode *newinode = NULL; struct inode *newinode = NULL;
......
...@@ -67,12 +67,12 @@ _FreeXid(unsigned int xid) ...@@ -67,12 +67,12 @@ _FreeXid(unsigned int xid)
spin_unlock(&GlobalMid_Lock); spin_unlock(&GlobalMid_Lock);
} }
struct cifsSesInfo * struct cifs_ses *
sesInfoAlloc(void) sesInfoAlloc(void)
{ {
struct cifsSesInfo *ret_buf; struct cifs_ses *ret_buf;
ret_buf = kzalloc(sizeof(struct cifsSesInfo), GFP_KERNEL); ret_buf = kzalloc(sizeof(struct cifs_ses), GFP_KERNEL);
if (ret_buf) { if (ret_buf) {
atomic_inc(&sesInfoAllocCount); atomic_inc(&sesInfoAllocCount);
ret_buf->status = CifsNew; ret_buf->status = CifsNew;
...@@ -85,7 +85,7 @@ sesInfoAlloc(void) ...@@ -85,7 +85,7 @@ sesInfoAlloc(void)
} }
void void
sesInfoFree(struct cifsSesInfo *buf_to_free) sesInfoFree(struct cifs_ses *buf_to_free)
{ {
if (buf_to_free == NULL) { if (buf_to_free == NULL) {
cFYI(1, "Null buffer passed to sesInfoFree"); cFYI(1, "Null buffer passed to sesInfoFree");
...@@ -105,11 +105,11 @@ sesInfoFree(struct cifsSesInfo *buf_to_free) ...@@ -105,11 +105,11 @@ sesInfoFree(struct cifsSesInfo *buf_to_free)
kfree(buf_to_free); kfree(buf_to_free);
} }
struct cifsTconInfo * struct cifs_tcon *
tconInfoAlloc(void) tconInfoAlloc(void)
{ {
struct cifsTconInfo *ret_buf; struct cifs_tcon *ret_buf;
ret_buf = kzalloc(sizeof(struct cifsTconInfo), GFP_KERNEL); ret_buf = kzalloc(sizeof(struct cifs_tcon), GFP_KERNEL);
if (ret_buf) { if (ret_buf) {
atomic_inc(&tconInfoAllocCount); atomic_inc(&tconInfoAllocCount);
ret_buf->tidStatus = CifsNew; ret_buf->tidStatus = CifsNew;
...@@ -124,7 +124,7 @@ tconInfoAlloc(void) ...@@ -124,7 +124,7 @@ tconInfoAlloc(void)
} }
void void
tconInfoFree(struct cifsTconInfo *buf_to_free) tconInfoFree(struct cifs_tcon *buf_to_free)
{ {
if (buf_to_free == NULL) { if (buf_to_free == NULL) {
cFYI(1, "Null buffer passed to tconInfoFree"); cFYI(1, "Null buffer passed to tconInfoFree");
...@@ -295,11 +295,11 @@ __u16 GetNextMid(struct TCP_Server_Info *server) ...@@ -295,11 +295,11 @@ __u16 GetNextMid(struct TCP_Server_Info *server)
case it is responsbility of caller to set the mid */ case it is responsbility of caller to set the mid */
void void
header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
const struct cifsTconInfo *treeCon, int word_count const struct cifs_tcon *treeCon, int word_count
/* length of fixed section (word count) in two byte units */) /* length of fixed section (word count) in two byte units */)
{ {
struct list_head *temp_item; struct list_head *temp_item;
struct cifsSesInfo *ses; struct cifs_ses *ses;
char *temp = (char *) buffer; char *temp = (char *) buffer;
memset(temp, 0, 256); /* bigger than MAX_CIFS_HDR_SIZE */ memset(temp, 0, 256); /* bigger than MAX_CIFS_HDR_SIZE */
...@@ -359,7 +359,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -359,7 +359,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
"did not match tcon uid"); "did not match tcon uid");
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
list_for_each(temp_item, &treeCon->ses->server->smb_ses_list) { list_for_each(temp_item, &treeCon->ses->server->smb_ses_list) {
ses = list_entry(temp_item, struct cifsSesInfo, smb_ses_list); ses = list_entry(temp_item, struct cifs_ses, smb_ses_list);
if (ses->linux_uid == current_fsuid()) { if (ses->linux_uid == current_fsuid()) {
if (ses->server == treeCon->ses->server) { if (ses->server == treeCon->ses->server) {
cFYI(1, "found matching uid substitute right smb_uid"); cFYI(1, "found matching uid substitute right smb_uid");
...@@ -380,7 +380,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -380,7 +380,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
if (treeCon->nocase) if (treeCon->nocase)
buffer->Flags |= SMBFLG_CASELESS; buffer->Flags |= SMBFLG_CASELESS;
if ((treeCon->ses) && (treeCon->ses->server)) if ((treeCon->ses) && (treeCon->ses->server))
if (treeCon->ses->server->secMode & if (treeCon->ses->server->sec_mode &
(SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
} }
...@@ -507,8 +507,8 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -507,8 +507,8 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
{ {
struct smb_com_lock_req *pSMB = (struct smb_com_lock_req *)buf; struct smb_com_lock_req *pSMB = (struct smb_com_lock_req *)buf;
struct list_head *tmp, *tmp1, *tmp2; struct list_head *tmp, *tmp1, *tmp2;
struct cifsSesInfo *ses; struct cifs_ses *ses;
struct cifsTconInfo *tcon; struct cifs_tcon *tcon;
struct cifsInodeInfo *pCifsInode; struct cifsInodeInfo *pCifsInode;
struct cifsFileInfo *netfile; struct cifsFileInfo *netfile;
...@@ -566,9 +566,9 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -566,9 +566,9 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
/* look up tcon based on tid & uid */ /* look up tcon based on tid & uid */
spin_lock(&cifs_tcp_ses_lock); spin_lock(&cifs_tcp_ses_lock);
list_for_each(tmp, &srv->smb_ses_list) { list_for_each(tmp, &srv->smb_ses_list) {
ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list); ses = list_entry(tmp, struct cifs_ses, smb_ses_list);
list_for_each(tmp1, &ses->tcon_list) { list_for_each(tmp1, &ses->tcon_list) {
tcon = list_entry(tmp1, struct cifsTconInfo, tcon_list); tcon = list_entry(tmp1, struct cifs_tcon, tcon_list);
if (tcon->tid != buf->Tid) if (tcon->tid != buf->Tid)
continue; continue;
......
...@@ -836,7 +836,7 @@ ntstatus_to_dos(__u32 ntstatus, __u8 *eclass, __u16 *ecode) ...@@ -836,7 +836,7 @@ ntstatus_to_dos(__u32 ntstatus, __u8 *eclass, __u16 *ecode)
} }
int int
map_smb_to_linux_error(struct smb_hdr *smb, int logErr) map_smb_to_linux_error(struct smb_hdr *smb, bool logErr)
{ {
unsigned int i; unsigned int i;
int rc = -EIO; /* if transport error smb error may not be set */ int rc = -EIO; /* if transport error smb error may not be set */
......
...@@ -195,7 +195,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb, ...@@ -195,7 +195,7 @@ int get_symlink_reparse_path(char *full_path, struct cifs_sb_info *cifs_sb,
int len; int len;
int oplock = 0; int oplock = 0;
int rc; int rc;
struct cifsTconInfo *ptcon = cifs_sb_tcon(cifs_sb); struct cifs_tcon *ptcon = cifs_sb_tcon(cifs_sb);
char *tmpbuffer; char *tmpbuffer;
rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ, rc = CIFSSMBOpen(xid, ptcon, full_path, FILE_OPEN, GENERIC_READ,
...@@ -223,7 +223,7 @@ static int initiate_cifs_search(const int xid, struct file *file) ...@@ -223,7 +223,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
struct cifsFileInfo *cifsFile; struct cifsFileInfo *cifsFile;
struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
struct tcon_link *tlink = NULL; struct tcon_link *tlink = NULL;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
if (file->private_data == NULL) { if (file->private_data == NULL) {
tlink = cifs_sb_tlink(cifs_sb); tlink = cifs_sb_tlink(cifs_sb);
...@@ -496,7 +496,7 @@ static int cifs_save_resume_key(const char *current_entry, ...@@ -496,7 +496,7 @@ static int cifs_save_resume_key(const char *current_entry,
assume that they are located in the findfirst return buffer.*/ assume that they are located in the findfirst return buffer.*/
/* We start counting in the buffer with entry 2 and increment for every /* We start counting in the buffer with entry 2 and increment for every
entry (do not increment for . or .. entry) */ entry (do not increment for . or .. entry) */
static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, static int find_cifs_entry(const int xid, struct cifs_tcon *pTcon,
struct file *file, char **ppCurrentEntry, int *num_to_ret) struct file *file, char **ppCurrentEntry, int *num_to_ret)
{ {
int rc = 0; int rc = 0;
...@@ -764,7 +764,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -764,7 +764,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
{ {
int rc = 0; int rc = 0;
int xid, i; int xid, i;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct cifsFileInfo *cifsFile = NULL; struct cifsFileInfo *cifsFile = NULL;
char *current_entry; char *current_entry;
int num_to_fill = 0; int num_to_fill = 0;
......
...@@ -37,13 +37,13 @@ ...@@ -37,13 +37,13 @@
* the socket has been reestablished (so we know whether to use vc 0). * the socket has been reestablished (so we know whether to use vc 0).
* Called while holding the cifs_tcp_ses_lock, so do not block * Called while holding the cifs_tcp_ses_lock, so do not block
*/ */
static bool is_first_ses_reconnect(struct cifsSesInfo *ses) static bool is_first_ses_reconnect(struct cifs_ses *ses)
{ {
struct list_head *tmp; struct list_head *tmp;
struct cifsSesInfo *tmp_ses; struct cifs_ses *tmp_ses;
list_for_each(tmp, &ses->server->smb_ses_list) { list_for_each(tmp, &ses->server->smb_ses_list) {
tmp_ses = list_entry(tmp, struct cifsSesInfo, tmp_ses = list_entry(tmp, struct cifs_ses,
smb_ses_list); smb_ses_list);
if (tmp_ses->need_reconnect == false) if (tmp_ses->need_reconnect == false)
return false; return false;
...@@ -61,11 +61,11 @@ static bool is_first_ses_reconnect(struct cifsSesInfo *ses) ...@@ -61,11 +61,11 @@ static bool is_first_ses_reconnect(struct cifsSesInfo *ses)
* any vc but zero (some servers reset the connection on vcnum zero) * any vc but zero (some servers reset the connection on vcnum zero)
* *
*/ */
static __le16 get_next_vcnum(struct cifsSesInfo *ses) static __le16 get_next_vcnum(struct cifs_ses *ses)
{ {
__u16 vcnum = 0; __u16 vcnum = 0;
struct list_head *tmp; struct list_head *tmp;
struct cifsSesInfo *tmp_ses; struct cifs_ses *tmp_ses;
__u16 max_vcs = ses->server->max_vcs; __u16 max_vcs = ses->server->max_vcs;
__u16 i; __u16 i;
int free_vc_found = 0; int free_vc_found = 0;
...@@ -87,7 +87,7 @@ static __le16 get_next_vcnum(struct cifsSesInfo *ses) ...@@ -87,7 +87,7 @@ static __le16 get_next_vcnum(struct cifsSesInfo *ses)
free_vc_found = 1; free_vc_found = 1;
list_for_each(tmp, &ses->server->smb_ses_list) { list_for_each(tmp, &ses->server->smb_ses_list) {
tmp_ses = list_entry(tmp, struct cifsSesInfo, tmp_ses = list_entry(tmp, struct cifs_ses,
smb_ses_list); smb_ses_list);
if (tmp_ses->vcnum == i) { if (tmp_ses->vcnum == i) {
free_vc_found = 0; free_vc_found = 0;
...@@ -114,7 +114,7 @@ static __le16 get_next_vcnum(struct cifsSesInfo *ses) ...@@ -114,7 +114,7 @@ static __le16 get_next_vcnum(struct cifsSesInfo *ses)
return cpu_to_le16(vcnum); return cpu_to_le16(vcnum);
} }
static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB) static __u32 cifs_ssetup_hdr(struct cifs_ses *ses, SESSION_SETUP_ANDX *pSMB)
{ {
__u32 capabilities = 0; __u32 capabilities = 0;
...@@ -136,7 +136,7 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB) ...@@ -136,7 +136,7 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS |
CAP_LARGE_WRITE_X | CAP_LARGE_READ_X; CAP_LARGE_WRITE_X | CAP_LARGE_READ_X;
if (ses->server->secMode & if (ses->server->sec_mode &
(SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
pSMB->req.hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE; pSMB->req.hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
...@@ -181,7 +181,7 @@ unicode_oslm_strings(char **pbcc_area, const struct nls_table *nls_cp) ...@@ -181,7 +181,7 @@ unicode_oslm_strings(char **pbcc_area, const struct nls_table *nls_cp)
*pbcc_area = bcc_ptr; *pbcc_area = bcc_ptr;
} }
static void unicode_domain_string(char **pbcc_area, struct cifsSesInfo *ses, static void unicode_domain_string(char **pbcc_area, struct cifs_ses *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
char *bcc_ptr = *pbcc_area; char *bcc_ptr = *pbcc_area;
...@@ -204,7 +204,7 @@ static void unicode_domain_string(char **pbcc_area, struct cifsSesInfo *ses, ...@@ -204,7 +204,7 @@ static void unicode_domain_string(char **pbcc_area, struct cifsSesInfo *ses,
} }
static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, static void unicode_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
char *bcc_ptr = *pbcc_area; char *bcc_ptr = *pbcc_area;
...@@ -236,7 +236,7 @@ static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, ...@@ -236,7 +236,7 @@ static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
*pbcc_area = bcc_ptr; *pbcc_area = bcc_ptr;
} }
static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
char *bcc_ptr = *pbcc_area; char *bcc_ptr = *pbcc_area;
...@@ -276,7 +276,7 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses, ...@@ -276,7 +276,7 @@ static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
} }
static void static void
decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses, decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifs_ses *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
int len; int len;
...@@ -310,7 +310,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses, ...@@ -310,7 +310,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
} }
static int decode_ascii_ssetup(char **pbcc_area, __u16 bleft, static int decode_ascii_ssetup(char **pbcc_area, __u16 bleft,
struct cifsSesInfo *ses, struct cifs_ses *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
int rc = 0; int rc = 0;
...@@ -364,7 +364,7 @@ static int decode_ascii_ssetup(char **pbcc_area, __u16 bleft, ...@@ -364,7 +364,7 @@ static int decode_ascii_ssetup(char **pbcc_area, __u16 bleft,
} }
static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
struct cifsSesInfo *ses) struct cifs_ses *ses)
{ {
unsigned int tioffset; /* challenge message target info area */ unsigned int tioffset; /* challenge message target info area */
unsigned int tilen; /* challenge message target info area length */ unsigned int tilen; /* challenge message target info area length */
...@@ -411,7 +411,7 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, ...@@ -411,7 +411,7 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
/* We do not malloc the blob, it is passed in pbuffer, because /* We do not malloc the blob, it is passed in pbuffer, because
it is fixed size, and small, making this approach cleaner */ it is fixed size, and small, making this approach cleaner */
static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer, static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
struct cifsSesInfo *ses) struct cifs_ses *ses)
{ {
NEGOTIATE_MESSAGE *sec_blob = (NEGOTIATE_MESSAGE *)pbuffer; NEGOTIATE_MESSAGE *sec_blob = (NEGOTIATE_MESSAGE *)pbuffer;
__u32 flags; __u32 flags;
...@@ -424,7 +424,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer, ...@@ -424,7 +424,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET | flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET |
NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC; NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC;
if (ses->server->secMode & if (ses->server->sec_mode &
(SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) { (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) {
flags |= NTLMSSP_NEGOTIATE_SIGN; flags |= NTLMSSP_NEGOTIATE_SIGN;
if (!ses->server->session_estab) if (!ses->server->session_estab)
...@@ -449,7 +449,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer, ...@@ -449,7 +449,7 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer,
This function returns the length of the data in the blob */ This function returns the length of the data in the blob */
static int build_ntlmssp_auth_blob(unsigned char *pbuffer, static int build_ntlmssp_auth_blob(unsigned char *pbuffer,
u16 *buflen, u16 *buflen,
struct cifsSesInfo *ses, struct cifs_ses *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
int rc; int rc;
...@@ -464,10 +464,10 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer, ...@@ -464,10 +464,10 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer,
NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_TARGET_INFO | NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_TARGET_INFO |
NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE |
NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC; NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_EXTENDED_SEC;
if (ses->server->secMode & if (ses->server->sec_mode &
(SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
flags |= NTLMSSP_NEGOTIATE_SIGN; flags |= NTLMSSP_NEGOTIATE_SIGN;
if (ses->server->secMode & SECMODE_SIGN_REQUIRED) if (ses->server->sec_mode & SECMODE_SIGN_REQUIRED)
flags |= NTLMSSP_NEGOTIATE_ALWAYS_SIGN; flags |= NTLMSSP_NEGOTIATE_ALWAYS_SIGN;
tmp = pbuffer + sizeof(AUTHENTICATE_MESSAGE); tmp = pbuffer + sizeof(AUTHENTICATE_MESSAGE);
...@@ -551,7 +551,7 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer, ...@@ -551,7 +551,7 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer,
} }
int int
CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, CIFS_SessSetup(unsigned int xid, struct cifs_ses *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
int rc = 0; int rc = 0;
...@@ -657,7 +657,7 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -657,7 +657,7 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses,
*/ */
rc = calc_lanman_hash(ses->password, ses->server->cryptkey, rc = calc_lanman_hash(ses->password, ses->server->cryptkey,
ses->server->secMode & SECMODE_PW_ENCRYPT ? ses->server->sec_mode & SECMODE_PW_ENCRYPT ?
true : false, lnm_session_key); true : false, lnm_session_key);
ses->flags |= CIFS_SES_LANMAN; ses->flags |= CIFS_SES_LANMAN;
......
This diff is collapsed.
...@@ -49,7 +49,7 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name) ...@@ -49,7 +49,7 @@ int cifs_removexattr(struct dentry *direntry, const char *ea_name)
int xid; int xid;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct super_block *sb; struct super_block *sb;
char *full_path = NULL; char *full_path = NULL;
...@@ -109,7 +109,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, ...@@ -109,7 +109,7 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
int xid; int xid;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct super_block *sb; struct super_block *sb;
char *full_path; char *full_path;
struct cifs_ntsd *pacl; struct cifs_ntsd *pacl;
...@@ -240,7 +240,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, ...@@ -240,7 +240,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
int xid; int xid;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct super_block *sb; struct super_block *sb;
char *full_path; char *full_path;
...@@ -372,7 +372,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size) ...@@ -372,7 +372,7 @@ ssize_t cifs_listxattr(struct dentry *direntry, char *data, size_t buf_size)
int xid; int xid;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct tcon_link *tlink; struct tcon_link *tlink;
struct cifsTconInfo *pTcon; struct cifs_tcon *pTcon;
struct super_block *sb; struct super_block *sb;
char *full_path; char *full_path;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment