Commit a6c0e1f7 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] remove unused variable
  [CIFS] consolidate duplicate code in posix/unix inode handling
  [CIFS] fix build break when proc disabled
  [CIFS] factoring out common code in get_inode_info functions
  [CIFS] fix prepath conversion when server supports posix paths
  [CIFS] Only convert / when server does not support posix paths
  [CIFS] Fix mixed case name in structure dfs_info3_param
  [CIFS] fixup prefixpaths which contain multiple path components
  [CIFS] fix typo
  [CIFS] patch to fix incorrect encoding of number of aces on set mode
  [CIFS] Fix typo in quota operations
  [CIFS] clean up some hard to read ifdefs
  [CIFS] reduce checkpatch warnings
  [CIFS] fix warning in cifs_spnego.c
parents 13b1c3d4 966ea8c4
...@@ -6,7 +6,9 @@ and sync so that events like out of disk space get reported properly on ...@@ -6,7 +6,9 @@ and sync so that events like out of disk space get reported properly on
cached files. Fix setxattr failure to certain Samba versions. Fix mount cached files. Fix setxattr failure to certain Samba versions. Fix mount
of second share to disconnected server session (autoreconnect on this). of second share to disconnected server session (autoreconnect on this).
Add ability to modify cifs acls for handling chmod (when mounted with Add ability to modify cifs acls for handling chmod (when mounted with
cifsacl flag). cifsacl flag). Fix prefixpath path separator so we can handle mounts
with prefixpaths longer than one directory (one path component) when
mounted to Windows servers.
Version 1.51 Version 1.51
------------ ------------
......
...@@ -461,7 +461,7 @@ A partial list of the supported mount options follows: ...@@ -461,7 +461,7 @@ A partial list of the supported mount options follows:
cifsacl Report mode bits (e.g. on stat) based on the Windows ACL for cifsacl Report mode bits (e.g. on stat) based on the Windows ACL for
the file. (EXPERIMENTAL) the file. (EXPERIMENTAL)
servern Specify the server 's netbios name (RFC1001 name) to use servern Specify the server 's netbios name (RFC1001 name) to use
when attempting to setup a session to the server. This is when attempting to setup a session to the server.
This is needed for mounting to some older servers (such This is needed for mounting to some older servers (such
as OS/2 or Windows 98 and Windows ME) since they do not as OS/2 or Windows 98 and Windows ME) since they do not
support a default server name. A server name can be up support a default server name. A server name can be up
......
...@@ -98,8 +98,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server) ...@@ -98,8 +98,7 @@ void cifs_dump_mids(struct TCP_Server_Info *server)
if (mid_entry->resp_buf) { if (mid_entry->resp_buf) {
cifs_dump_detail(mid_entry->resp_buf); cifs_dump_detail(mid_entry->resp_buf);
cifs_dump_mem("existing buf: ", cifs_dump_mem("existing buf: ",
mid_entry->resp_buf, mid_entry->resp_buf, 62);
62 /* fixme */);
} }
} }
} }
...@@ -439,7 +438,7 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset, ...@@ -439,7 +438,7 @@ cifs_stats_read(char *buf, char **beginBuffer, off_t offset,
return length; return length;
} }
#endif #endif /* STATS */
static struct proc_dir_entry *proc_fs_cifs; static struct proc_dir_entry *proc_fs_cifs;
read_proc_t cifs_txanchor_read; read_proc_t cifs_txanchor_read;
...@@ -482,7 +481,7 @@ cifs_proc_init(void) ...@@ -482,7 +481,7 @@ cifs_proc_init(void)
cifs_stats_read, NULL); cifs_stats_read, NULL);
if (pde) if (pde)
pde->write_proc = cifs_stats_write; pde->write_proc = cifs_stats_write;
#endif #endif /* STATS */
pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs, pde = create_proc_read_entry("cifsFYI", 0, proc_fs_cifs,
cifsFYI_read, NULL); cifsFYI_read, NULL);
if (pde) if (pde)
...@@ -918,4 +917,12 @@ security_flags_write(struct file *file, const char __user *buffer, ...@@ -918,4 +917,12 @@ security_flags_write(struct file *file, const char __user *buffer,
/* BB should we turn on MAY flags for other MUST options? */ /* BB should we turn on MAY flags for other MUST options? */
return count; return count;
} }
#endif #else
inline void cifs_proc_init(void)
{
}
inline void cifs_proc_clean(void)
{
}
#endif /* PROC_FS */
...@@ -25,8 +25,11 @@ ...@@ -25,8 +25,11 @@
void cifs_dump_mem(char *label, void *data, int length); void cifs_dump_mem(char *label, void *data, int length);
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
#define DBG2 2
void cifs_dump_detail(struct smb_hdr *); void cifs_dump_detail(struct smb_hdr *);
void cifs_dump_mids(struct TCP_Server_Info *); void cifs_dump_mids(struct TCP_Server_Info *);
#else
#define DBG2 0
#endif #endif
extern int traceSMB; /* flag which enables the function below */ extern int traceSMB; /* flag which enables the function below */
void dump_smb(struct smb_hdr *, int); void dump_smb(struct smb_hdr *, int);
...@@ -64,10 +67,10 @@ extern int cifsERROR; ...@@ -64,10 +67,10 @@ extern int cifsERROR;
* --------- * ---------
*/ */
#else /* _CIFS_DEBUG */ #else /* _CIFS_DEBUG */
#define cERROR(button,prspec) #define cERROR(button, prspec)
#define cEVENT(format,arg...) #define cEVENT(format, arg...)
#define cFYI(button, prspec) #define cFYI(button, prspec)
#define cifserror(format,arg...) #define cifserror(format, arg...)
#endif /* _CIFS_DEBUG */ #endif /* _CIFS_DEBUG */
#endif /* _H_CIFS_DEBUG */ #endif /* _H_CIFS_DEBUG */
...@@ -286,7 +286,7 @@ static void dump_referral(const struct dfs_info3_param *ref) ...@@ -286,7 +286,7 @@ static void dump_referral(const struct dfs_info3_param *ref)
cFYI(1, ("DFS: node path: %s", ref->node_name)); cFYI(1, ("DFS: node path: %s", ref->node_name));
cFYI(1, ("DFS: fl: %hd, srv_type: %hd", ref->flags, ref->server_type)); cFYI(1, ("DFS: fl: %hd, srv_type: %hd", ref->flags, ref->server_type));
cFYI(1, ("DFS: ref_flags: %hd, path_consumed: %hd", ref->ref_flag, cFYI(1, ("DFS: ref_flags: %hd, path_consumed: %hd", ref->ref_flag,
ref->PathConsumed)); ref->path_consumed));
} }
......
...@@ -125,7 +125,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) ...@@ -125,7 +125,7 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
if (cifsFYI && !IS_ERR(spnego_key)) { if (cifsFYI && !IS_ERR(spnego_key)) {
struct cifs_spnego_msg *msg = spnego_key->payload.data; struct cifs_spnego_msg *msg = spnego_key->payload.data;
cifs_dump_mem("SPNEGO reply blob:", msg->data, min(1024, cifs_dump_mem("SPNEGO reply blob:", msg->data, min(1024U,
msg->secblob_len + msg->sesskey_len)); msg->secblob_len + msg->sesskey_len));
} }
#endif /* CONFIG_CIFS_DEBUG2 */ #endif /* CONFIG_CIFS_DEBUG2 */
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* *
*/ */
int int
cifs_strfromUCS_le(char *to, const __le16 * from, cifs_strfromUCS_le(char *to, const __le16 *from,
int len, const struct nls_table *codepage) int len, const struct nls_table *codepage)
{ {
int i; int i;
...@@ -61,7 +61,7 @@ cifs_strfromUCS_le(char *to, const __le16 * from, ...@@ -61,7 +61,7 @@ cifs_strfromUCS_le(char *to, const __le16 * from,
* *
*/ */
int int
cifs_strtoUCS(__le16 * to, const char *from, int len, cifs_strtoUCS(__le16 *to, const char *from, int len,
const struct nls_table *codepage) const struct nls_table *codepage)
{ {
int charlen; int charlen;
......
...@@ -254,7 +254,8 @@ UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2) ...@@ -254,7 +254,8 @@ UniStrstr(const wchar_t *ucs1, const wchar_t *ucs2)
const wchar_t *anchor2 = ucs2; const wchar_t *anchor2 = ucs2;
while (*ucs1) { while (*ucs1) {
if (*ucs1 == *ucs2) { /* Partial match found */ if (*ucs1 == *ucs2) {
/* Partial match found */
ucs1++; ucs1++;
ucs2++; ucs2++;
} else { } else {
...@@ -279,7 +280,8 @@ UniToupper(register wchar_t uc) ...@@ -279,7 +280,8 @@ UniToupper(register wchar_t uc)
{ {
register const struct UniCaseRange *rp; register const struct UniCaseRange *rp;
if (uc < sizeof (CifsUniUpperTable)) { /* Latin characters */ if (uc < sizeof(CifsUniUpperTable)) {
/* Latin characters */
return uc + CifsUniUpperTable[uc]; /* Use base tables */ return uc + CifsUniUpperTable[uc]; /* Use base tables */
} else { } else {
rp = CifsUniUpperRange; /* Use range tables */ rp = CifsUniUpperRange; /* Use range tables */
...@@ -320,7 +322,8 @@ UniTolower(wchar_t uc) ...@@ -320,7 +322,8 @@ UniTolower(wchar_t uc)
{ {
register struct UniCaseRange *rp; register struct UniCaseRange *rp;
if (uc < sizeof (UniLowerTable)) { /* Latin characters */ if (uc < sizeof(UniLowerTable)) {
/* Latin characters */
return uc + UniLowerTable[uc]; /* Use base tables */ return uc + UniLowerTable[uc]; /* Use base tables */
} else { } else {
rp = UniLowerRange; /* Use range tables */ rp = UniLowerRange; /* Use range tables */
......
...@@ -46,8 +46,7 @@ static struct cifs_wksid wksidarr[NUM_WK_SIDS] = { ...@@ -46,8 +46,7 @@ static struct cifs_wksid wksidarr[NUM_WK_SIDS] = {
static const struct cifs_sid sid_everyone = { 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} };
/* group users */ /* group users */
static const struct cifs_sid sid_user = static const struct cifs_sid sid_user = {1, 2 , {0, 0, 0, 0, 0, 5}, {} };
{1, 2 , {0, 0, 0, 0, 0, 5}, {} };
int match_sid(struct cifs_sid *ctsid) int match_sid(struct cifs_sid *ctsid)
...@@ -195,9 +194,9 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode, ...@@ -195,9 +194,9 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
/* For deny ACEs we change the mask so that subsequent allow access /* For deny ACEs we change the mask so that subsequent allow access
control entries do not turn on the bits we are denying */ control entries do not turn on the bits we are denying */
if (type == ACCESS_DENIED) { if (type == ACCESS_DENIED) {
if (flags & GENERIC_ALL) { if (flags & GENERIC_ALL)
*pbits_to_set &= ~S_IRWXUGO; *pbits_to_set &= ~S_IRWXUGO;
}
if ((flags & GENERIC_WRITE) || if ((flags & GENERIC_WRITE) ||
((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS)) ((flags & FILE_WRITE_RIGHTS) == FILE_WRITE_RIGHTS))
*pbits_to_set &= ~S_IWUGO; *pbits_to_set &= ~S_IWUGO;
...@@ -216,9 +215,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode, ...@@ -216,9 +215,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
if (flags & GENERIC_ALL) { if (flags & GENERIC_ALL) {
*pmode |= (S_IRWXUGO & (*pbits_to_set)); *pmode |= (S_IRWXUGO & (*pbits_to_set));
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("all perms"));
cFYI(1, ("all perms"));
#endif
return; return;
} }
if ((flags & GENERIC_WRITE) || if ((flags & GENERIC_WRITE) ||
...@@ -231,9 +228,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode, ...@@ -231,9 +228,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS)) ((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
*pmode |= (S_IXUGO & (*pbits_to_set)); *pmode |= (S_IXUGO & (*pbits_to_set));
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("access flags 0x%x mode now 0x%x", flags, *pmode));
cFYI(1, ("access flags 0x%x mode now 0x%x", flags, *pmode));
#endif
return; return;
} }
...@@ -262,9 +257,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use, ...@@ -262,9 +257,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use,
if (mode & S_IXUGO) if (mode & S_IXUGO)
*pace_flags |= SET_FILE_EXEC_RIGHTS; *pace_flags |= SET_FILE_EXEC_RIGHTS;
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags));
cFYI(1, ("mode: 0x%x, access flags now 0x%x", mode, *pace_flags));
#endif
return; return;
} }
...@@ -358,11 +351,9 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, ...@@ -358,11 +351,9 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
return; return;
} }
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("DACL revision %d size %d num aces %d",
cFYI(1, ("DACL revision %d size %d num aces %d",
le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size), le16_to_cpu(pdacl->revision), le16_to_cpu(pdacl->size),
le32_to_cpu(pdacl->num_aces))); le32_to_cpu(pdacl->num_aces)));
#endif
/* reset rwx permissions for user/group/other. /* reset rwx permissions for user/group/other.
Also, if num_aces is 0 i.e. DACL has no ACEs, Also, if num_aces is 0 i.e. DACL has no ACEs,
...@@ -381,10 +372,6 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, ...@@ -381,10 +372,6 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
ppace = kmalloc(num_aces * sizeof(struct cifs_ace *), ppace = kmalloc(num_aces * sizeof(struct cifs_ace *),
GFP_KERNEL); GFP_KERNEL);
/* cifscred->cecount = pdacl->num_aces;
cifscred->aces = kmalloc(num_aces *
sizeof(struct cifs_ace *), GFP_KERNEL);*/
for (i = 0; i < num_aces; ++i) { for (i = 0; i < num_aces; ++i) {
ppace[i] = (struct cifs_ace *) (acl_base + acl_size); ppace[i] = (struct cifs_ace *) (acl_base + acl_size);
#ifdef CONFIG_CIFS_DEBUG2 #ifdef CONFIG_CIFS_DEBUG2
...@@ -437,7 +424,7 @@ static int set_chmod_dacl(struct cifs_acl *pndacl, struct cifs_sid *pownersid, ...@@ -437,7 +424,7 @@ static int set_chmod_dacl(struct cifs_acl *pndacl, struct cifs_sid *pownersid,
&sid_everyone, nmode, S_IRWXO); &sid_everyone, nmode, S_IRWXO);
pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl)); pndacl->size = cpu_to_le16(size + sizeof(struct cifs_acl));
pndacl->num_aces = 3; pndacl->num_aces = cpu_to_le32(3);
return (0); return (0);
} }
...@@ -495,13 +482,11 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, ...@@ -495,13 +482,11 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len,
le32_to_cpu(pntsd->gsidoffset)); le32_to_cpu(pntsd->gsidoffset));
dacloffset = le32_to_cpu(pntsd->dacloffset); dacloffset = le32_to_cpu(pntsd->dacloffset);
dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset); dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset);
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x "
cFYI(1, ("revision %d type 0x%x ooffset 0x%x goffset 0x%x "
"sacloffset 0x%x dacloffset 0x%x", "sacloffset 0x%x dacloffset 0x%x",
pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset), pntsd->revision, pntsd->type, le32_to_cpu(pntsd->osidoffset),
le32_to_cpu(pntsd->gsidoffset), le32_to_cpu(pntsd->gsidoffset),
le32_to_cpu(pntsd->sacloffset), dacloffset)); le32_to_cpu(pntsd->sacloffset), dacloffset));
#endif
/* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */ /* cifs_dump_mem("owner_sid: ", owner_sid_ptr, 64); */
rc = parse_sid(owner_sid_ptr, end_of_acl); rc = parse_sid(owner_sid_ptr, end_of_acl);
if (rc) if (rc)
...@@ -636,9 +621,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, ...@@ -636,9 +621,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
struct super_block *sb; struct super_block *sb;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("set ACL for %s from mode 0x%x", path, inode->i_mode));
cFYI(1, ("set ACL for %s from mode 0x%x", path, inode->i_mode));
#endif
if (!inode) if (!inode)
return (rc); return (rc);
...@@ -669,9 +652,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, ...@@ -669,9 +652,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
} }
rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen); rc = CIFSSMBSetCIFSACL(xid, cifs_sb->tcon, fid, pnntsd, acllen);
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("SetCIFSACL rc = %d", rc));
cFYI(1, ("SetCIFSACL rc = %d", rc));
#endif
if (unlock_file == TRUE) if (unlock_file == TRUE)
atomic_dec(&open_file->wrtPending); atomic_dec(&open_file->wrtPending);
else else
...@@ -689,9 +670,7 @@ void acl_to_uid_mode(struct inode *inode, const char *path) ...@@ -689,9 +670,7 @@ void acl_to_uid_mode(struct inode *inode, const char *path)
u32 acllen = 0; u32 acllen = 0;
int rc = 0; int rc = 0;
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("converting ACL to mode for %s", path));
cFYI(1, ("converting ACL to mode for %s", path));
#endif
pntsd = get_cifs_acl(&acllen, inode, path); pntsd = get_cifs_acl(&acllen, inode, path);
/* if we can retrieve the ACL, now parse Access Control Entries, ACEs */ /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */
...@@ -712,9 +691,7 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode) ...@@ -712,9 +691,7 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */ struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */
struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("set ACL from mode for %s", path));
cFYI(1, ("set ACL from mode for %s", path));
#endif
/* Get the security descriptor */ /* Get the security descriptor */
pntsd = get_cifs_acl(&acllen, inode, path); pntsd = get_cifs_acl(&acllen, inode, path);
...@@ -736,16 +713,12 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode) ...@@ -736,16 +713,12 @@ int mode_to_acl(struct inode *inode, const char *path, __u64 nmode)
rc = build_sec_desc(pntsd, pnntsd, acllen, inode, nmode); rc = build_sec_desc(pntsd, pnntsd, acllen, inode, nmode);
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("build_sec_desc rc: %d", rc));
cFYI(1, ("build_sec_desc rc: %d", rc));
#endif
if (!rc) { if (!rc) {
/* Set the security descriptor */ /* Set the security descriptor */
rc = set_cifs_acl(pnntsd, acllen, inode, path); rc = set_cifs_acl(pnntsd, acllen, inode, path);
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("set_cifs_acl rc: %d", rc));
cFYI(1, ("set_cifs_acl rc: %d", rc));
#endif
} }
kfree(pnntsd); kfree(pnntsd);
......
...@@ -204,9 +204,8 @@ cifs_put_super(struct super_block *sb) ...@@ -204,9 +204,8 @@ cifs_put_super(struct super_block *sb)
return; return;
} }
rc = cifs_umount(sb, cifs_sb); rc = cifs_umount(sb, cifs_sb);
if (rc) { if (rc)
cERROR(1, ("cifs_umount failed with return code %d", rc)); cERROR(1, ("cifs_umount failed with return code %d", rc));
}
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
if (cifs_sb->mountdata) { if (cifs_sb->mountdata) {
kfree(cifs_sb->mountdata); kfree(cifs_sb->mountdata);
...@@ -461,7 +460,7 @@ int cifs_xstate_get(struct super_block *sb, struct fs_quota_stat *qstats) ...@@ -461,7 +460,7 @@ int cifs_xstate_get(struct super_block *sb, struct fs_quota_stat *qstats)
static struct quotactl_ops cifs_quotactl_ops = { static struct quotactl_ops cifs_quotactl_ops = {
.set_xquota = cifs_xquota_set, .set_xquota = cifs_xquota_set,
.get_xquota = cifs_xquota_set, .get_xquota = cifs_xquota_get,
.set_xstate = cifs_xstate_set, .set_xstate = cifs_xstate_set,
.get_xstate = cifs_xstate_get, .get_xstate = cifs_xstate_get,
}; };
...@@ -472,9 +471,7 @@ static void cifs_umount_begin(struct vfsmount *vfsmnt, int flags) ...@@ -472,9 +471,7 @@ static void cifs_umount_begin(struct vfsmount *vfsmnt, int flags)
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
#ifdef CONFIG_CIFS_DFS_UPCALL
dfs_shrink_umount_helper(vfsmnt); dfs_shrink_umount_helper(vfsmnt);
#endif /* CONFIG CIFS_DFS_UPCALL */
if (!(flags & MNT_FORCE)) if (!(flags & MNT_FORCE))
return; return;
...@@ -992,9 +989,7 @@ static int __init ...@@ -992,9 +989,7 @@ static int __init
init_cifs(void) init_cifs(void)
{ {
int rc = 0; int rc = 0;
#ifdef CONFIG_PROC_FS
cifs_proc_init(); cifs_proc_init();
#endif
/* INIT_LIST_HEAD(&GlobalServerList);*/ /* BB not implemented yet */ /* INIT_LIST_HEAD(&GlobalServerList);*/ /* BB not implemented yet */
INIT_LIST_HEAD(&GlobalSMBSessionList); INIT_LIST_HEAD(&GlobalSMBSessionList);
INIT_LIST_HEAD(&GlobalTreeConnectionList); INIT_LIST_HEAD(&GlobalTreeConnectionList);
...@@ -1095,19 +1090,15 @@ init_cifs(void) ...@@ -1095,19 +1090,15 @@ init_cifs(void)
out_destroy_inodecache: out_destroy_inodecache:
cifs_destroy_inodecache(); cifs_destroy_inodecache();
out_clean_proc: out_clean_proc:
#ifdef CONFIG_PROC_FS
cifs_proc_clean(); cifs_proc_clean();
#endif
return rc; return rc;
} }
static void __exit static void __exit
exit_cifs(void) exit_cifs(void)
{ {
cFYI(0, ("exit_cifs")); cFYI(DBG2, ("exit_cifs"));
#ifdef CONFIG_PROC_FS
cifs_proc_clean(); cifs_proc_clean();
#endif
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
unregister_key_type(&key_type_dns_resolver); unregister_key_type(&key_type_dns_resolver);
#endif #endif
......
...@@ -454,7 +454,7 @@ struct dir_notify_req { ...@@ -454,7 +454,7 @@ struct dir_notify_req {
struct dfs_info3_param { struct dfs_info3_param {
int flags; /* DFSREF_REFERRAL_SERVER, DFSREF_STORAGE_SERVER*/ int flags; /* DFSREF_REFERRAL_SERVER, DFSREF_STORAGE_SERVER*/
int PathConsumed; int path_consumed;
int server_type; int server_type;
int ref_flag; int ref_flag;
char *path_name; char *path_name;
......
...@@ -53,11 +53,11 @@ extern int SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses, ...@@ -53,11 +53,11 @@ extern int SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *,
struct kvec *, int /* nvec to send */, struct kvec *, int /* nvec to send */,
int * /* type of buf returned */ , const int flags); int * /* type of buf returned */ , const int flags);
extern int SendReceiveBlockingLock(const unsigned int /* xid */ , extern int SendReceiveBlockingLock(const unsigned int xid,
struct cifsTconInfo *, struct cifsTconInfo *ptcon,
struct smb_hdr * /* input */ , struct smb_hdr *in_buf ,
struct smb_hdr * /* out */ , struct smb_hdr *out_buf,
int * /* bytes returned */); int *bytes_returned);
extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length); extern int checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length);
extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *);
extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
...@@ -84,7 +84,7 @@ extern __u16 GetNextMid(struct TCP_Server_Info *server); ...@@ -84,7 +84,7 @@ extern __u16 GetNextMid(struct TCP_Server_Info *server);
extern struct oplock_q_entry *AllocOplockQEntry(struct inode *, u16, extern struct oplock_q_entry *AllocOplockQEntry(struct inode *, u16,
struct cifsTconInfo *); struct cifsTconInfo *);
extern void DeleteOplockQEntry(struct oplock_q_entry *); extern void DeleteOplockQEntry(struct oplock_q_entry *);
extern struct timespec cifs_NTtimeToUnix(u64 /* utc nanoseconds since 1601 */ ); extern struct timespec cifs_NTtimeToUnix(u64 utc_nanoseconds_since_1601);
extern u64 cifs_UnixTimeToNT(struct timespec); extern u64 cifs_UnixTimeToNT(struct timespec);
extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time); extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time);
extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time); extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time);
...@@ -104,7 +104,11 @@ extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, ...@@ -104,7 +104,11 @@ extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *,
extern int cifs_umount(struct super_block *, struct cifs_sb_info *); extern int cifs_umount(struct super_block *, struct cifs_sb_info *);
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
extern void dfs_shrink_umount_helper(struct vfsmount *vfsmnt); extern void dfs_shrink_umount_helper(struct vfsmount *vfsmnt);
#endif #else
static inline void dfs_shrink_umount_helper(struct vfsmount *vfsmnt)
{
}
#endif /* DFS_UPCALL */
void cifs_proc_init(void); void cifs_proc_init(void);
void cifs_proc_clean(void); void cifs_proc_clean(void);
...@@ -175,11 +179,11 @@ extern int CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon, ...@@ -175,11 +179,11 @@ extern int CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon,
struct kstatfs *FSData); struct kstatfs *FSData);
extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon,
const char *fileName, const FILE_BASIC_INFO * data, const char *fileName, const FILE_BASIC_INFO *data,
const struct nls_table *nls_codepage, const struct nls_table *nls_codepage,
int remap_special_chars); int remap_special_chars);
extern int CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
const FILE_BASIC_INFO * data, __u16 fid); const FILE_BASIC_INFO *data, __u16 fid);
#if 0 #if 0
extern int CIFSSMBSetAttrLegacy(int xid, struct cifsTconInfo *tcon, extern int CIFSSMBSetAttrLegacy(int xid, struct cifsTconInfo *tcon,
char *fileName, __u16 dos_attributes, char *fileName, __u16 dos_attributes,
......
This diff is collapsed.
...@@ -1722,8 +1722,15 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, ...@@ -1722,8 +1722,15 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon,
originally at mount time */ originally at mount time */
if ((saved_cap & CIFS_UNIX_POSIX_ACL_CAP) == 0) if ((saved_cap & CIFS_UNIX_POSIX_ACL_CAP) == 0)
cap &= ~CIFS_UNIX_POSIX_ACL_CAP; cap &= ~CIFS_UNIX_POSIX_ACL_CAP;
if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) if ((saved_cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) {
if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP)
cERROR(1, ("POSIXPATH support change"));
cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP; cap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP;
} else if ((cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) == 0) {
cERROR(1, ("possible reconnect error"));
cERROR(1,
("server disabled POSIX path support"));
}
} }
cap &= CIFS_UNIX_CAP_MASK; cap &= CIFS_UNIX_CAP_MASK;
...@@ -1753,9 +1760,8 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, ...@@ -1753,9 +1760,8 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon,
if (sb && (CIFS_SB(sb)->rsize > 127 * 1024)) { if (sb && (CIFS_SB(sb)->rsize > 127 * 1024)) {
if ((cap & CIFS_UNIX_LARGE_READ_CAP) == 0) { if ((cap & CIFS_UNIX_LARGE_READ_CAP) == 0) {
CIFS_SB(sb)->rsize = 127 * 1024; CIFS_SB(sb)->rsize = 127 * 1024;
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2,
cFYI(1, ("larger reads not supported by srv")); ("larger reads not supported by srv"));
#endif
} }
} }
...@@ -1792,6 +1798,26 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon, ...@@ -1792,6 +1798,26 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo *tcon,
} }
} }
static 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;
}
}
int int
cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
char *mount_data, const char *devname) char *mount_data, const char *devname)
...@@ -2057,7 +2083,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -2057,7 +2083,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
cifs_sb->prepath = volume_info.prepath; cifs_sb->prepath = volume_info.prepath;
if (cifs_sb->prepath) { if (cifs_sb->prepath) {
cifs_sb->prepathlen = strlen(cifs_sb->prepath); cifs_sb->prepathlen = strlen(cifs_sb->prepath);
cifs_sb->prepath[0] = CIFS_DIR_SEP(cifs_sb); /* we can not convert the / to \ in the path
separators in the prefixpath yet because we do not
know (until reset_cifs_unix_caps is called later)
whether POSIX PATH CAP is available. We normalize
the / to \ after reset_cifs_unix_caps is called */
volume_info.prepath = NULL; volume_info.prepath = NULL;
} else } else
cifs_sb->prepathlen = 0; cifs_sb->prepathlen = 0;
...@@ -2225,11 +2255,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -2225,11 +2255,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
else else
tcon->unix_ext = 0; /* server does not support them */ tcon->unix_ext = 0; /* server does not support them */
/* convert forward to back slashes in prepath here if needed */
if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) == 0)
convert_delimiter(cifs_sb->prepath,
CIFS_DIR_SEP(cifs_sb));
if ((tcon->unix_ext == 0) && (cifs_sb->rsize > (1024 * 127))) { if ((tcon->unix_ext == 0) && (cifs_sb->rsize > (1024 * 127))) {
cifs_sb->rsize = 1024 * 127; cifs_sb->rsize = 1024 * 127;
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2,
cFYI(1, ("no very large read support, rsize now 127K")); ("no very large read support, rsize now 127K"));
#endif
} }
if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X)) if (!(tcon->ses->capabilities & CAP_LARGE_WRITE_X))
cifs_sb->wsize = min(cifs_sb->wsize, cifs_sb->wsize = min(cifs_sb->wsize,
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* vfs operations that deal with dentries * vfs operations that deal with dentries
* *
* 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
...@@ -111,16 +111,6 @@ build_path_from_dentry(struct dentry *direntry) ...@@ -111,16 +111,6 @@ build_path_from_dentry(struct dentry *direntry)
return full_path; return full_path;
} }
/* char * build_wildcard_path_from_dentry(struct dentry *direntry)
{
if(full_path == NULL)
return full_path;
full_path[namelen] = '\\';
full_path[namelen+1] = '*';
full_path[namelen+2] = 0;
BB remove above eight lines BB */
/* Inode operations in similar order to how they appear in Linux file fs.h */ /* Inode operations in similar order to how they appear in Linux file fs.h */
int int
...@@ -171,9 +161,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -171,9 +161,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
disposition = FILE_OVERWRITE_IF; disposition = FILE_OVERWRITE_IF;
else if ((oflags & O_CREAT) == O_CREAT) else if ((oflags & O_CREAT) == O_CREAT)
disposition = FILE_OPEN_IF; disposition = FILE_OPEN_IF;
else { else
cFYI(1, ("Create flag not set in create function")); cFYI(1, ("Create flag not set in create function"));
}
} }
/* BB add processing to set equivalent of mode - e.g. via CreateX with /* BB add processing to set equivalent of mode - e.g. via CreateX with
...@@ -367,7 +356,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, ...@@ -367,7 +356,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) {
int oplock = 0; int oplock = 0;
u16 fileHandle; u16 fileHandle;
FILE_ALL_INFO * buf; FILE_ALL_INFO *buf;
cFYI(1, ("sfu compat create special file")); cFYI(1, ("sfu compat create special file"));
...@@ -534,9 +523,8 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) ...@@ -534,9 +523,8 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
int isValid = 1; int isValid = 1;
if (direntry->d_inode) { if (direntry->d_inode) {
if (cifs_revalidate(direntry)) { if (cifs_revalidate(direntry))
return 0; return 0;
}
} else { } else {
cFYI(1, ("neg dentry 0x%p name = %s", cFYI(1, ("neg dentry 0x%p name = %s",
direntry, direntry->d_name.name)); direntry, direntry->d_name.name));
......
/* /*
* fs/cifs/dns_resolve.h -- DNS Resolver upcall management for CIFS DFS * fs/cifs/dns_resolve.h -- DNS Resolver upcall management for CIFS DFS
* Handles host name to IP address resolution * Handles host name to IP address resolution
* *
* Copyright (c) International Business Machines Corp., 2008 * Copyright (c) International Business Machines Corp., 2008
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
......
...@@ -35,9 +35,8 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags) ...@@ -35,9 +35,8 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags)
/* No way on Linux VFS to ask to monitor xattr /* No way on Linux VFS to ask to monitor xattr
changes (and no stream support either */ changes (and no stream support either */
if (fcntl_notify_flags & DN_ACCESS) { if (fcntl_notify_flags & DN_ACCESS)
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_ACCESS; cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_ACCESS;
}
if (fcntl_notify_flags & DN_MODIFY) { if (fcntl_notify_flags & DN_MODIFY) {
/* What does this mean on directories? */ /* What does this mean on directories? */
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE |
...@@ -47,9 +46,8 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags) ...@@ -47,9 +46,8 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags)
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION |
FILE_NOTIFY_CHANGE_LAST_WRITE; FILE_NOTIFY_CHANGE_LAST_WRITE;
} }
if (fcntl_notify_flags & DN_DELETE) { if (fcntl_notify_flags & DN_DELETE)
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE; cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE;
}
if (fcntl_notify_flags & DN_RENAME) { if (fcntl_notify_flags & DN_RENAME) {
/* BB review this - checking various server behaviors */ /* BB review this - checking various server behaviors */
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME | cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME |
......
...@@ -353,9 +353,9 @@ static int cifs_reopen_file(struct file *file, int can_flush) ...@@ -353,9 +353,9 @@ static int cifs_reopen_file(struct file *file, int can_flush)
int disposition = FILE_OPEN; int disposition = FILE_OPEN;
__u16 netfid; __u16 netfid;
if (file->private_data) { if (file->private_data)
pCifsFile = (struct cifsFileInfo *)file->private_data; pCifsFile = (struct cifsFileInfo *)file->private_data;
} else else
return -EBADF; return -EBADF;
xid = GetXid(); xid = GetXid();
...@@ -499,9 +499,8 @@ int cifs_close(struct inode *inode, struct file *file) ...@@ -499,9 +499,8 @@ int cifs_close(struct inode *inode, struct file *file)
the struct would be in each open file, the struct would be in each open file,
but this should give enough time to but this should give enough time to
clear the socket */ clear the socket */
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2,
cFYI(1, ("close delay, write pending")); ("close delay, write pending"));
#endif /* DEBUG2 */
msleep(timeout); msleep(timeout);
timeout *= 4; timeout *= 4;
} }
...@@ -1423,9 +1422,8 @@ static int cifs_writepage(struct page *page, struct writeback_control *wbc) ...@@ -1423,9 +1422,8 @@ static int cifs_writepage(struct page *page, struct writeback_control *wbc)
xid = GetXid(); xid = GetXid();
/* BB add check for wbc flags */ /* BB add check for wbc flags */
page_cache_get(page); page_cache_get(page);
if (!PageUptodate(page)) { if (!PageUptodate(page))
cFYI(1, ("ppw - page not up to date")); cFYI(1, ("ppw - page not up to date"));
}
/* /*
* Set the "writeback" flag, and clear "dirty" in the radix tree. * Set the "writeback" flag, and clear "dirty" in the radix tree.
...@@ -1460,9 +1458,9 @@ static int cifs_commit_write(struct file *file, struct page *page, ...@@ -1460,9 +1458,9 @@ static int cifs_commit_write(struct file *file, struct page *page,
cFYI(1, ("commit write for page %p up to position %lld for %d", cFYI(1, ("commit write for page %p up to position %lld for %d",
page, position, to)); page, position, to));
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (position > inode->i_size) { if (position > inode->i_size)
i_size_write(inode, position); i_size_write(inode, position);
}
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
if (!PageUptodate(page)) { if (!PageUptodate(page)) {
position = ((loff_t)page->index << PAGE_CACHE_SHIFT) + offset; position = ((loff_t)page->index << PAGE_CACHE_SHIFT) + offset;
...@@ -1596,9 +1594,9 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, ...@@ -1596,9 +1594,9 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
} }
open_file = (struct cifsFileInfo *)file->private_data; open_file = (struct cifsFileInfo *)file->private_data;
if ((file->f_flags & O_ACCMODE) == O_WRONLY) { if ((file->f_flags & O_ACCMODE) == O_WRONLY)
cFYI(1, ("attempting read on write only file instance")); cFYI(1, ("attempting read on write only file instance"));
}
for (total_read = 0, current_offset = read_data; for (total_read = 0, current_offset = read_data;
read_size > total_read; read_size > total_read;
total_read += bytes_read, current_offset += bytes_read) { total_read += bytes_read, current_offset += bytes_read) {
...@@ -1625,9 +1623,8 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, ...@@ -1625,9 +1623,8 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
smb_read_data + smb_read_data +
4 /* RFC1001 length field */ + 4 /* RFC1001 length field */ +
le16_to_cpu(pSMBr->DataOffset), le16_to_cpu(pSMBr->DataOffset),
bytes_read)) { bytes_read))
rc = -EFAULT; rc = -EFAULT;
}
if (buf_type == CIFS_SMALL_BUFFER) if (buf_type == CIFS_SMALL_BUFFER)
cifs_small_buf_release(smb_read_data); cifs_small_buf_release(smb_read_data);
...@@ -1814,9 +1811,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, ...@@ -1814,9 +1811,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
pagevec_init(&lru_pvec, 0); pagevec_init(&lru_pvec, 0);
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("rpages: num pages %d", num_pages));
cFYI(1, ("rpages: num pages %d", num_pages));
#endif
for (i = 0; i < num_pages; ) { for (i = 0; i < num_pages; ) {
unsigned contig_pages; unsigned contig_pages;
struct page *tmp_page; struct page *tmp_page;
...@@ -1849,10 +1844,8 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, ...@@ -1849,10 +1844,8 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
/* Read size needs to be in multiples of one page */ /* Read size needs to be in multiples of one page */
read_size = min_t(const unsigned int, read_size, read_size = min_t(const unsigned int, read_size,
cifs_sb->rsize & PAGE_CACHE_MASK); cifs_sb->rsize & PAGE_CACHE_MASK);
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("rpages: read size 0x%x contiguous pages %d",
cFYI(1, ("rpages: read size 0x%x contiguous pages %d",
read_size, contig_pages)); read_size, contig_pages));
#endif
rc = -EAGAIN; rc = -EAGAIN;
while (rc == -EAGAIN) { while (rc == -EAGAIN) {
if ((open_file->invalidHandle) && if ((open_file->invalidHandle) &&
...@@ -2026,7 +2019,7 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) ...@@ -2026,7 +2019,7 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file)
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb); cifs_sb = CIFS_SB(cifsInode->vfs_inode.i_sb);
if ( cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO ) { if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
/* since no page cache to corrupt on directio /* since no page cache to corrupt on directio
we can change size safely */ we can change size safely */
return 1; return 1;
......
This diff is collapsed.
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) #define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2)
int cifs_ioctl (struct inode *inode, struct file *filep, int cifs_ioctl(struct inode *inode, struct file *filep,
unsigned int command, unsigned long arg) unsigned int command, unsigned long arg)
{ {
int rc = -ENOTTY; /* strange error - but the precedent */ int rc = -ENOTTY; /* strange error - but the precedent */
......
...@@ -56,7 +56,7 @@ lshift(__u32 x, int s) ...@@ -56,7 +56,7 @@ lshift(__u32 x, int s)
/* this applies md4 to 64 byte chunks */ /* this applies md4 to 64 byte chunks */
static void static void
mdfour64(__u32 * M, __u32 * A, __u32 *B, __u32 * C, __u32 *D) mdfour64(__u32 *M, __u32 *A, __u32 *B, __u32 *C, __u32 *D)
{ {
int j; int j;
__u32 AA, BB, CC, DD; __u32 AA, BB, CC, DD;
...@@ -137,7 +137,7 @@ mdfour64(__u32 * M, __u32 * A, __u32 *B, __u32 * C, __u32 *D) ...@@ -137,7 +137,7 @@ mdfour64(__u32 * M, __u32 * A, __u32 *B, __u32 * C, __u32 *D)
} }
static void static void
copy64(__u32 * M, unsigned char *in) copy64(__u32 *M, unsigned char *in)
{ {
int i; int i;
......
...@@ -161,7 +161,7 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx) ...@@ -161,7 +161,7 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
/* This is the central step in the MD5 algorithm. */ /* This is the central step in the MD5 algorithm. */
#define MD5STEP(f, w, x, y, z, data, s) \ #define MD5STEP(f, w, x, y, z, data, s) \
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x ) (w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x)
/* /*
* The core of the MD5 algorithm, this alters an existing MD5 hash to * The core of the MD5 algorithm, this alters an existing MD5 hash to
...@@ -302,9 +302,8 @@ hmac_md5_init_limK_to_64(const unsigned char *key, int key_len, ...@@ -302,9 +302,8 @@ hmac_md5_init_limK_to_64(const unsigned char *key, int key_len,
int i; int i;
/* if key is longer than 64 bytes truncate it */ /* if key is longer than 64 bytes truncate it */
if (key_len > 64) { if (key_len > 64)
key_len = 64; key_len = 64;
}
/* start out by storing key in pads */ /* start out by storing key in pads */
memset(ctx->k_ipad, 0, sizeof(ctx->k_ipad)); memset(ctx->k_ipad, 0, sizeof(ctx->k_ipad));
...@@ -359,9 +358,9 @@ hmac_md5(unsigned char key[16], unsigned char *data, int data_len, ...@@ -359,9 +358,9 @@ hmac_md5(unsigned char key[16], unsigned char *data, int data_len,
{ {
struct HMACMD5Context ctx; struct HMACMD5Context ctx;
hmac_md5_init_limK_to_64(key, 16, &ctx); hmac_md5_init_limK_to_64(key, 16, &ctx);
if (data_len != 0) { if (data_len != 0)
hmac_md5_update(data, data_len, &ctx); hmac_md5_update(data, data_len, &ctx);
}
hmac_md5_final(digest, &ctx); hmac_md5_final(digest, &ctx);
} }
#endif #endif
/* /*
* fs/cifs/misc.c * fs/cifs/misc.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
...@@ -320,9 +320,9 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -320,9 +320,9 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
if (treeCon->ses) { if (treeCon->ses) {
if (treeCon->ses->capabilities & CAP_UNICODE) if (treeCon->ses->capabilities & CAP_UNICODE)
buffer->Flags2 |= SMBFLG2_UNICODE; buffer->Flags2 |= SMBFLG2_UNICODE;
if (treeCon->ses->capabilities & CAP_STATUS32) { if (treeCon->ses->capabilities & CAP_STATUS32)
buffer->Flags2 |= SMBFLG2_ERR_STATUS; buffer->Flags2 |= SMBFLG2_ERR_STATUS;
}
/* Uid is not converted */ /* Uid is not converted */
buffer->Uid = treeCon->ses->Suid; buffer->Uid = treeCon->ses->Suid;
buffer->Mid = GetNextMid(treeCon->ses->server); buffer->Mid = GetNextMid(treeCon->ses->server);
...@@ -610,7 +610,8 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length) ...@@ -610,7 +610,8 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length)
buffer = (unsigned char *) smb_buf; buffer = (unsigned char *) smb_buf;
for (i = 0, j = 0; i < smb_buf_length; i++, j++) { for (i = 0, j = 0; i < smb_buf_length; i++, j++) {
if (i % 8 == 0) { /* have reached the beginning of line */ if (i % 8 == 0) {
/* have reached the beginning of line */
printk(KERN_DEBUG "| "); printk(KERN_DEBUG "| ");
j = 0; j = 0;
} }
...@@ -621,7 +622,8 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length) ...@@ -621,7 +622,8 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length)
else else
debug_line[1 + (2 * j)] = '_'; debug_line[1 + (2 * j)] = '_';
if (i % 8 == 7) { /* reached end of line, time to print ascii */ if (i % 8 == 7) {
/* reached end of line, time to print ascii */
debug_line[16] = 0; debug_line[16] = 0;
printk(" | %s\n", debug_line); printk(" | %s\n", debug_line);
} }
...@@ -631,7 +633,7 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length) ...@@ -631,7 +633,7 @@ dump_smb(struct smb_hdr *smb_buf, int smb_buf_length)
debug_line[2 * j] = ' '; debug_line[2 * j] = ' ';
debug_line[1 + (2 * j)] = ' '; debug_line[1 + (2 * j)] = ' ';
} }
printk( " | %s\n", debug_line); printk(" | %s\n", debug_line);
return; return;
} }
......
/* /*
* fs/cifs/netmisc.c * fs/cifs/netmisc.c
* *
* Copyright (c) International Business Machines Corp., 2002 * Copyright (c) International Business Machines Corp., 2002,2008
* Author(s): Steve French (sfrench@us.ibm.com) * Author(s): Steve French (sfrench@us.ibm.com)
* *
* Error mapping routines from Samba libsmb/errormap.c * Error mapping routines from Samba libsmb/errormap.c
...@@ -150,9 +150,7 @@ static int canonicalize_unc(char *cp) ...@@ -150,9 +150,7 @@ static int canonicalize_unc(char *cp)
if (cp[i] == '\\') if (cp[i] == '\\')
break; break;
if (cp[i] == '/') { if (cp[i] == '/') {
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("change slash to \\ in malformed UNC"));
cFYI(1, ("change slash to backslash in malformed UNC"));
#endif
cp[i] = '\\'; cp[i] = '\\';
return 1; return 1;
} }
...@@ -178,9 +176,7 @@ cifs_inet_pton(int address_family, char *cp, void *dst) ...@@ -178,9 +176,7 @@ cifs_inet_pton(int address_family, char *cp, void *dst)
} else if (address_family == AF_INET6) { } else if (address_family == AF_INET6) {
ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
} }
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("address conversion returned %d for %s", ret, cp));
cFYI(1, ("address conversion returned %d for %s", ret, cp));
#endif
if (ret > 0) if (ret > 0)
ret = 1; ret = 1;
return ret; return ret;
...@@ -253,7 +249,8 @@ static const struct { ...@@ -253,7 +249,8 @@ static const struct {
ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_MIX}, { ERRDOS, 87, NT_STATUS_INVALID_PARAMETER_MIX}, {
ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, { ERRHRD, ERRgeneral, NT_STATUS_INVALID_QUOTA_LOWER}, {
ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, { ERRHRD, ERRgeneral, NT_STATUS_DISK_CORRUPT_ERROR}, {
ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_INVALID}, { /* mapping changed since shell does lookup on * and expects file not found */ /* mapping changed since shell does lookup on * expects FileNotFound */
ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_INVALID}, {
ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, { ERRDOS, ERRbadfile, NT_STATUS_OBJECT_NAME_NOT_FOUND}, {
ERRDOS, ERRalreadyexists, NT_STATUS_OBJECT_NAME_COLLISION}, { ERRDOS, ERRalreadyexists, NT_STATUS_OBJECT_NAME_COLLISION}, {
ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, { ERRHRD, ERRgeneral, NT_STATUS_HANDLE_NOT_WAITABLE}, {
...@@ -820,7 +817,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr) ...@@ -820,7 +817,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr)
/* old style errors */ /* old style errors */
/* DOS class smb error codes - map DOS */ /* DOS class smb error codes - map DOS */
if (smberrclass == ERRDOS) { /* 1 byte field no need to byte reverse */ if (smberrclass == ERRDOS) {
/* 1 byte field no need to byte reverse */
for (i = 0; for (i = 0;
i < i <
sizeof(mapping_table_ERRDOS) / sizeof(mapping_table_ERRDOS) /
...@@ -834,7 +832,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr) ...@@ -834,7 +832,8 @@ map_smb_to_linux_error(struct smb_hdr *smb, int logErr)
} }
/* else try next error mapping one to see if match */ /* else try next error mapping one to see if match */
} }
} else if (smberrclass == ERRSRV) { /* server class of error codes */ } else if (smberrclass == ERRSRV) {
/* server class of error codes */
for (i = 0; for (i = 0;
i < i <
sizeof(mapping_table_ERRSRV) / sizeof(mapping_table_ERRSRV) /
...@@ -922,8 +921,8 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) ...@@ -922,8 +921,8 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
{ {
struct timespec ts; struct timespec ts;
int sec, min, days, month, year; int sec, min, days, month, year;
SMB_TIME * st = (SMB_TIME *)&time; SMB_TIME *st = (SMB_TIME *)&time;
SMB_DATE * sd = (SMB_DATE *)&date; SMB_DATE *sd = (SMB_DATE *)&date;
cFYI(1, ("date %d time %d", date, time)); cFYI(1, ("date %d time %d", date, time));
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Directory search handling * Directory search handling
* *
* Copyright (C) International Business Machines Corp., 2004, 2007 * Copyright (C) International Business Machines Corp., 2004, 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
...@@ -42,17 +42,18 @@ static void dump_cifs_file_struct(struct file *file, char *label) ...@@ -42,17 +42,18 @@ static void dump_cifs_file_struct(struct file *file, char *label)
cFYI(1, ("empty cifs private file data")); cFYI(1, ("empty cifs private file data"));
return; return;
} }
if (cf->invalidHandle) { if (cf->invalidHandle)
cFYI(1, ("invalid handle")); cFYI(1, ("invalid handle"));
} if (cf->srch_inf.endOfSearch)
if (cf->srch_inf.endOfSearch) {
cFYI(1, ("end of search")); cFYI(1, ("end of search"));
} if (cf->srch_inf.emptyDir)
if (cf->srch_inf.emptyDir) {
cFYI(1, ("empty dir")); cFYI(1, ("empty dir"));
}
} }
} }
#else
static inline void dump_cifs_file_struct(struct file *file, char *label)
{
}
#endif /* DEBUG2 */ #endif /* DEBUG2 */
/* Returns one if new inode created (which therefore needs to be hashed) */ /* Returns one if new inode created (which therefore needs to be hashed) */
...@@ -150,7 +151,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, ...@@ -150,7 +151,7 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime));
} else { /* legacy, OS2 and DOS style */ } else { /* legacy, OS2 and DOS style */
/* struct timespec ts;*/ /* struct timespec ts;*/
FIND_FILE_STANDARD_INFO * pfindData = FIND_FILE_STANDARD_INFO *pfindData =
(FIND_FILE_STANDARD_INFO *)buf; (FIND_FILE_STANDARD_INFO *)buf;
tmp_inode->i_mtime = cnvrtDosUnixTm( tmp_inode->i_mtime = cnvrtDosUnixTm(
...@@ -198,9 +199,8 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, ...@@ -198,9 +199,8 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
if (attr & ATTR_DIRECTORY) { if (attr & ATTR_DIRECTORY) {
*pobject_type = DT_DIR; *pobject_type = DT_DIR;
/* override default perms since we do not lock dirs */ /* override default perms since we do not lock dirs */
if (atomic_read(&cifsInfo->inUse) == 0) { if (atomic_read(&cifsInfo->inUse) == 0)
tmp_inode->i_mode = cifs_sb->mnt_dir_mode; tmp_inode->i_mode = cifs_sb->mnt_dir_mode;
}
tmp_inode->i_mode |= S_IFDIR; tmp_inode->i_mode |= S_IFDIR;
} else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) &&
(attr & ATTR_SYSTEM)) { (attr & ATTR_SYSTEM)) {
...@@ -231,9 +231,8 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, ...@@ -231,9 +231,8 @@ static void fill_in_inode(struct inode *tmp_inode, int new_buf_type,
} /* could add code here - to validate if device or weird share type? */ } /* could add code here - to validate if device or weird share type? */
/* can not fill in nlink here as in qpathinfo version and Unx search */ /* can not fill in nlink here as in qpathinfo version and Unx search */
if (atomic_read(&cifsInfo->inUse) == 0) { if (atomic_read(&cifsInfo->inUse) == 0)
atomic_set(&cifsInfo->inUse, 1); atomic_set(&cifsInfo->inUse, 1);
}
spin_lock(&tmp_inode->i_lock); spin_lock(&tmp_inode->i_lock);
if (is_size_safe_to_change(cifsInfo, end_of_file)) { if (is_size_safe_to_change(cifsInfo, end_of_file)) {
...@@ -461,9 +460,8 @@ static int initiate_cifs_search(const int xid, struct file *file) ...@@ -461,9 +460,8 @@ static int initiate_cifs_search(const int xid, struct file *file)
full_path = build_path_from_dentry(file->f_path.dentry); full_path = build_path_from_dentry(file->f_path.dentry);
if (full_path == NULL) { if (full_path == NULL)
return -ENOMEM; return -ENOMEM;
}
cFYI(1, ("Full path: %s start at: %lld", full_path, file->f_pos)); cFYI(1, ("Full path: %s start at: %lld", full_path, file->f_pos));
...@@ -471,9 +469,9 @@ static int initiate_cifs_search(const int xid, struct file *file) ...@@ -471,9 +469,9 @@ static int initiate_cifs_search(const int xid, struct file *file)
/* test for Unix extensions */ /* test for Unix extensions */
/* but now check for them on the share/mount not on the SMB session */ /* but now check for them on the share/mount not on the SMB session */
/* if (pTcon->ses->capabilities & CAP_UNIX) { */ /* if (pTcon->ses->capabilities & CAP_UNIX) { */
if (pTcon->unix_ext) { if (pTcon->unix_ext)
cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX; cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX;
} else if ((pTcon->ses->capabilities & else if ((pTcon->ses->capabilities &
(CAP_NT_SMBS | CAP_NT_FIND)) == 0) { (CAP_NT_SMBS | CAP_NT_FIND)) == 0) {
cifsFile->srch_inf.info_level = SMB_FIND_FILE_INFO_STANDARD; cifsFile->srch_inf.info_level = SMB_FIND_FILE_INFO_STANDARD;
} else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
...@@ -514,10 +512,10 @@ static int cifs_unicode_bytelen(char *str) ...@@ -514,10 +512,10 @@ static int cifs_unicode_bytelen(char *str)
static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
{ {
char *new_entry; char *new_entry;
FILE_DIRECTORY_INFO * pDirInfo = (FILE_DIRECTORY_INFO *)old_entry; FILE_DIRECTORY_INFO *pDirInfo = (FILE_DIRECTORY_INFO *)old_entry;
if (level == SMB_FIND_FILE_INFO_STANDARD) { if (level == SMB_FIND_FILE_INFO_STANDARD) {
FIND_FILE_STANDARD_INFO * pfData; FIND_FILE_STANDARD_INFO *pfData;
pfData = (FIND_FILE_STANDARD_INFO *)pDirInfo; pfData = (FIND_FILE_STANDARD_INFO *)pDirInfo;
new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) + new_entry = old_entry + sizeof(FIND_FILE_STANDARD_INFO) +
...@@ -553,7 +551,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) ...@@ -553,7 +551,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
int len = 0; int len = 0;
if (cfile->srch_inf.info_level == SMB_FIND_FILE_UNIX) { if (cfile->srch_inf.info_level == SMB_FIND_FILE_UNIX) {
FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry;
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
if (cfile->srch_inf.unicode) { if (cfile->srch_inf.unicode) {
len = cifs_unicode_bytelen(filename); len = cifs_unicode_bytelen(filename);
...@@ -562,30 +560,30 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) ...@@ -562,30 +560,30 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
len = strnlen(filename, 5); len = strnlen(filename, 5);
} }
} else if (cfile->srch_inf.info_level == SMB_FIND_FILE_DIRECTORY_INFO) { } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_DIRECTORY_INFO) {
FILE_DIRECTORY_INFO * pFindData = FILE_DIRECTORY_INFO *pFindData =
(FILE_DIRECTORY_INFO *)current_entry; (FILE_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
len = le32_to_cpu(pFindData->FileNameLength); len = le32_to_cpu(pFindData->FileNameLength);
} else if (cfile->srch_inf.info_level == } else if (cfile->srch_inf.info_level ==
SMB_FIND_FILE_FULL_DIRECTORY_INFO) { SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
FILE_FULL_DIRECTORY_INFO * pFindData = FILE_FULL_DIRECTORY_INFO *pFindData =
(FILE_FULL_DIRECTORY_INFO *)current_entry; (FILE_FULL_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
len = le32_to_cpu(pFindData->FileNameLength); len = le32_to_cpu(pFindData->FileNameLength);
} else if (cfile->srch_inf.info_level == } else if (cfile->srch_inf.info_level ==
SMB_FIND_FILE_ID_FULL_DIR_INFO) { SMB_FIND_FILE_ID_FULL_DIR_INFO) {
SEARCH_ID_FULL_DIR_INFO * pFindData = SEARCH_ID_FULL_DIR_INFO *pFindData =
(SEARCH_ID_FULL_DIR_INFO *)current_entry; (SEARCH_ID_FULL_DIR_INFO *)current_entry;
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
len = le32_to_cpu(pFindData->FileNameLength); len = le32_to_cpu(pFindData->FileNameLength);
} else if (cfile->srch_inf.info_level == } else if (cfile->srch_inf.info_level ==
SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
FILE_BOTH_DIRECTORY_INFO * pFindData = FILE_BOTH_DIRECTORY_INFO *pFindData =
(FILE_BOTH_DIRECTORY_INFO *)current_entry; (FILE_BOTH_DIRECTORY_INFO *)current_entry;
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
len = le32_to_cpu(pFindData->FileNameLength); len = le32_to_cpu(pFindData->FileNameLength);
} else if (cfile->srch_inf.info_level == SMB_FIND_FILE_INFO_STANDARD) { } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_INFO_STANDARD) {
FIND_FILE_STANDARD_INFO * pFindData = FIND_FILE_STANDARD_INFO *pFindData =
(FIND_FILE_STANDARD_INFO *)current_entry; (FIND_FILE_STANDARD_INFO *)current_entry;
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
len = pFindData->FileNameLength; len = pFindData->FileNameLength;
...@@ -666,9 +664,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -666,9 +664,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
. and .. for the root of a drive and for those we need . and .. for the root of a drive and for those we need
to start two entries earlier */ to start two entries earlier */
#ifdef CONFIG_CIFS_DEBUG2
dump_cifs_file_struct(file, "In fce "); dump_cifs_file_struct(file, "In fce ");
#endif
if (((index_to_find < cifsFile->srch_inf.index_of_last_entry) && if (((index_to_find < cifsFile->srch_inf.index_of_last_entry) &&
is_dir_changed(file)) || is_dir_changed(file)) ||
(index_to_find < first_entry_in_buffer)) { (index_to_find < first_entry_in_buffer)) {
...@@ -718,7 +714,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -718,7 +714,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
pos_in_buf = index_to_find - first_entry_in_buffer; pos_in_buf = index_to_find - first_entry_in_buffer;
cFYI(1, ("found entry - pos_in_buf %d", pos_in_buf)); cFYI(1, ("found entry - pos_in_buf %d", pos_in_buf));
for (i=0; (i < (pos_in_buf)) && (current_entry != NULL); i++) { for (i = 0; (i < (pos_in_buf)) && (current_entry != NULL); i++) {
/* go entry by entry figuring out which is first */ /* go entry by entry figuring out which is first */
current_entry = nxt_dir_entry(current_entry, end_of_smb, current_entry = nxt_dir_entry(current_entry, end_of_smb,
cifsFile->srch_inf.info_level); cifsFile->srch_inf.info_level);
...@@ -793,7 +789,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst, ...@@ -793,7 +789,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
len = le32_to_cpu(pFindData->FileNameLength); len = le32_to_cpu(pFindData->FileNameLength);
} else if (level == SMB_FIND_FILE_INFO_STANDARD) { } else if (level == SMB_FIND_FILE_INFO_STANDARD) {
FIND_FILE_STANDARD_INFO * pFindData = FIND_FILE_STANDARD_INFO *pFindData =
(FIND_FILE_STANDARD_INFO *)current_entry; (FIND_FILE_STANDARD_INFO *)current_entry;
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
/* one byte length, no name conversion */ /* one byte length, no name conversion */
...@@ -928,7 +924,7 @@ static int cifs_save_resume_key(const char *current_entry, ...@@ -928,7 +924,7 @@ static int cifs_save_resume_key(const char *current_entry,
level = cifsFile->srch_inf.info_level; level = cifsFile->srch_inf.info_level;
if (level == SMB_FIND_FILE_UNIX) { if (level == SMB_FIND_FILE_UNIX) {
FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry;
filename = &pFindData->FileName[0]; filename = &pFindData->FileName[0];
if (cifsFile->srch_inf.unicode) { if (cifsFile->srch_inf.unicode) {
......
...@@ -417,10 +417,6 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time, ...@@ -417,10 +417,6 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
calc_lanman_hash(ses, lnm_session_key); calc_lanman_hash(ses, lnm_session_key);
ses->flags |= CIFS_SES_LANMAN; ses->flags |= CIFS_SES_LANMAN;
/* #ifdef CONFIG_CIFS_DEBUG2
cifs_dump_mem("cryptkey: ",ses->server->cryptKey,
CIFS_SESS_KEY_SIZE);
#endif */
memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_SESS_KEY_SIZE); memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_SESS_KEY_SIZE);
bcc_ptr += CIFS_SESS_KEY_SIZE; bcc_ptr += CIFS_SESS_KEY_SIZE;
......
...@@ -114,42 +114,42 @@ static uchar sbox[8][4][16] = { ...@@ -114,42 +114,42 @@ static uchar sbox[8][4][16] = {
{{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7}, {{14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7},
{0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8}, {0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8},
{4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0}, {4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0},
{15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13}}, {15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13} },
{{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10}, {{15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10},
{3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5}, {3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5},
{0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15}, {0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15},
{13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9}}, {13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9} },
{{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8}, {{10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8},
{13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1}, {13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1},
{13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7}, {13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7},
{1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12}}, {1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12} },
{{7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15}, {{7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15},
{13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9}, {13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9},
{10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4}, {10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4},
{3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14}}, {3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14} },
{{2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9}, {{2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9},
{14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6}, {14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6},
{4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14}, {4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14},
{11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3}}, {11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3} },
{{12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11}, {{12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11},
{10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8}, {10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8},
{9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6}, {9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6},
{4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13}}, {4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13} },
{{4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1}, {{4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1},
{13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6}, {13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6},
{1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2}, {1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2},
{6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12}}, {6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12} },
{{13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7}, {{13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7},
{1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2}, {1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2},
{7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8}, {7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8},
{2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11}} {2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11} }
}; };
static void static void
...@@ -313,9 +313,8 @@ str_to_key(unsigned char *str, unsigned char *key) ...@@ -313,9 +313,8 @@ str_to_key(unsigned char *str, unsigned char *key)
key[5] = ((str[4] & 0x1F) << 2) | (str[5] >> 6); key[5] = ((str[4] & 0x1F) << 2) | (str[5] >> 6);
key[6] = ((str[5] & 0x3F) << 1) | (str[6] >> 7); key[6] = ((str[5] & 0x3F) << 1) | (str[6] >> 7);
key[7] = str[6] & 0x7F; key[7] = str[6] & 0x7F;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++)
key[i] = (key[i] << 1); key[i] = (key[i] << 1);
}
} }
static void static void
...@@ -344,9 +343,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw) ...@@ -344,9 +343,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
dohash(outb, inb, keyb, forw); dohash(outb, inb, keyb, forw);
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++)
out[i] = 0; out[i] = 0;
}
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
if (outb[i]) if (outb[i])
......
/* /*
* fs/cifs/transport.c * fs/cifs/transport.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)
* Jeremy Allison (jra@samba.org) 2006. * Jeremy Allison (jra@samba.org) 2006.
* *
...@@ -358,9 +358,9 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf, ...@@ -358,9 +358,9 @@ static int allocate_mid(struct cifsSesInfo *ses, struct smb_hdr *in_buf,
} else if (ses->status != CifsGood) { } else if (ses->status != CifsGood) {
/* check if SMB session is bad because we are setting it up */ /* check if SMB session is bad because we are setting it up */
if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) && if ((in_buf->Command != SMB_COM_SESSION_SETUP_ANDX) &&
(in_buf->Command != SMB_COM_NEGOTIATE)) { (in_buf->Command != SMB_COM_NEGOTIATE))
return -EAGAIN; return -EAGAIN;
} /* else ok - we are setting up session */ /* else ok - we are setting up session */
} }
*ppmidQ = AllocMidQEntry(in_buf, ses); *ppmidQ = AllocMidQEntry(in_buf, ses);
if (*ppmidQ == NULL) if (*ppmidQ == NULL)
...@@ -437,9 +437,8 @@ SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses, ...@@ -437,9 +437,8 @@ SendReceiveNoRsp(const unsigned int xid, struct cifsSesInfo *ses,
iov[0].iov_len = in_buf->smb_buf_length + 4; iov[0].iov_len = in_buf->smb_buf_length + 4;
flags |= CIFS_NO_RESP; flags |= CIFS_NO_RESP;
rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags); rc = SendReceive2(xid, ses, iov, 1, &resp_buf_type, flags);
#ifdef CONFIG_CIFS_DEBUG2 cFYI(DBG2, ("SendRcvNoRsp flags %d rc %d", flags, rc));
cFYI(1, ("SendRcvNoR flags %d rc %d", flags, rc));
#endif
return rc; return rc;
} }
......
...@@ -139,9 +139,9 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, ...@@ -139,9 +139,9 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name,
} else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) { } else if (strncmp(ea_name, CIFS_XATTR_USER_PREFIX, 5) == 0) {
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
goto set_ea_exit; goto set_ea_exit;
if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0) { if (strncmp(ea_name, CIFS_XATTR_DOS_ATTRIB, 14) == 0)
cFYI(1, ("attempt to set cifs inode metadata")); cFYI(1, ("attempt to set cifs inode metadata"));
}
ea_name += 5; /* skip past user. prefix */ ea_name += 5; /* skip past user. prefix */
rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value,
(__u16)value_size, cifs_sb->local_nls, (__u16)value_size, cifs_sb->local_nls,
...@@ -262,7 +262,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, ...@@ -262,7 +262,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
#ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL
else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) {
__u16 fid; __u16 fid;
int oplock = FALSE; int oplock = FALSE;
struct cifs_ntsd *pacl = NULL; struct cifs_ntsd *pacl = NULL;
...@@ -303,11 +303,10 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, ...@@ -303,11 +303,10 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
} else if (strncmp(ea_name, } else if (strncmp(ea_name,
CIFS_XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) { CIFS_XATTR_SECURITY_PREFIX, XATTR_SECURITY_PREFIX_LEN) == 0) {
cFYI(1, ("Security xattr namespace not supported yet")); cFYI(1, ("Security xattr namespace not supported yet"));
} else { } else
cFYI(1, cFYI(1,
("illegal xattr request %s (only user namespace supported)", ("illegal xattr request %s (only user namespace supported)",
ea_name)); ea_name));
}
/* We could add an additional check for streams ie /* We could add an additional check for streams ie
if proc/fs/cifs/streamstoxattr is set then if proc/fs/cifs/streamstoxattr is set then
......
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