Commit 26c5e98e 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 build warning
  [CIFS] Fixed build warning in is_ip
  [CIFS] cleanup cifsd completion
  [CIFS] Remove over-indented code in find_unc().
  [CIFS] fix typo
  [CIFS] Remove duplicate call to mode_to_acl
  [CIFS] convert usage of implicit booleans to bool
  [CIFS] fixed compatibility issue with samba refferal request
  [CIFS] Fix statfs formatting
  [CIFS] Adds to dns_resolver checking if the server name is an IP addr and skipping upcall in this case.
  [CIFS] Fix spelling mistake
  [CIFS] Update cifs version number
parents a9545ee3 af4b3c35
Version 1.53
------------
Version 1.52 Version 1.52
------------ ------------
Fix oops on second mount to server when null auth is used. Fix oops on second mount to server when null auth is used.
......
...@@ -460,8 +460,8 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -460,8 +460,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
unsigned char *sequence_end; unsigned char *sequence_end;
unsigned long *oid = NULL; unsigned long *oid = NULL;
unsigned int cls, con, tag, oidlen, rc; unsigned int cls, con, tag, oidlen, rc;
int use_ntlmssp = FALSE; bool use_ntlmssp = false;
int use_kerberos = FALSE; bool use_kerberos = false;
*secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/ *secType = NTLM; /* BB eventually make Kerberos or NLTMSSP the default*/
...@@ -561,15 +561,15 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -561,15 +561,15 @@ decode_negTokenInit(unsigned char *security_blob, int length,
if (compare_oid(oid, oidlen, if (compare_oid(oid, oidlen,
MSKRB5_OID, MSKRB5_OID,
MSKRB5_OID_LEN)) MSKRB5_OID_LEN))
use_kerberos = TRUE; use_kerberos = true;
else if (compare_oid(oid, oidlen, else if (compare_oid(oid, oidlen,
KRB5_OID, KRB5_OID,
KRB5_OID_LEN)) KRB5_OID_LEN))
use_kerberos = TRUE; use_kerberos = true;
else if (compare_oid(oid, oidlen, else if (compare_oid(oid, oidlen,
NTLMSSP_OID, NTLMSSP_OID,
NTLMSSP_OID_LEN)) NTLMSSP_OID_LEN))
use_ntlmssp = TRUE; use_ntlmssp = true;
kfree(oid); kfree(oid);
} }
......
...@@ -93,15 +93,11 @@ static char *cifs_get_share_name(const char *node_name) ...@@ -93,15 +93,11 @@ static char *cifs_get_share_name(const char *node_name)
/* find sharename end */ /* find sharename end */
pSep++; pSep++;
pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC)); pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC));
if (!pSep) { if (pSep) {
cERROR(1, ("%s:2 cant find share name in node name: %s", /* trim path up to sharename end
__func__, node_name)); * now we have share name in UNC */
kfree(UNC); *pSep = 0;
return NULL;
} }
/* trim path up to sharename end
* * now we have share name in UNC */
*pSep = 0;
return UNC; return UNC;
} }
...@@ -188,7 +184,7 @@ static char *compose_mount_options(const char *sb_mountdata, ...@@ -188,7 +184,7 @@ static char *compose_mount_options(const char *sb_mountdata,
tkn_e = strchr(tkn_e+1, '\\'); tkn_e = strchr(tkn_e+1, '\\');
if (tkn_e) { if (tkn_e) {
strcat(mountdata, ",prefixpath="); strcat(mountdata, ",prefixpath=");
strcat(mountdata, tkn_e); strcat(mountdata, tkn_e+1);
} }
} }
...@@ -244,7 +240,8 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) ...@@ -244,7 +240,8 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
return NULL; return NULL;
if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) { if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) {
/* we should use full path name to correct working with DFS */ int i;
/* we should use full path name for correct working with DFS */
l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) + l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) +
strnlen(search_path, MAX_PATHCONF) + 1; strnlen(search_path, MAX_PATHCONF) + 1;
tmp_path = kmalloc(l_max_len, GFP_KERNEL); tmp_path = kmalloc(l_max_len, GFP_KERNEL);
...@@ -253,8 +250,14 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) ...@@ -253,8 +250,14 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
return NULL; return NULL;
} }
strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len); strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len);
strcat(tmp_path, search_path);
tmp_path[l_max_len-1] = 0; tmp_path[l_max_len-1] = 0;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
for (i = 0; i < l_max_len; i++) {
if (tmp_path[i] == '\\')
tmp_path[i] = '/';
}
strncat(tmp_path, search_path, l_max_len - strlen(tmp_path));
full_path = tmp_path; full_path = tmp_path;
kfree(search_path); kfree(search_path);
} else { } else {
......
...@@ -559,7 +559,7 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, ...@@ -559,7 +559,7 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode,
const char *path, const __u16 *pfid) const char *path, const __u16 *pfid)
{ {
struct cifsFileInfo *open_file = NULL; struct cifsFileInfo *open_file = NULL;
int unlock_file = FALSE; bool unlock_file = false;
int xid; int xid;
int rc = -EIO; int rc = -EIO;
__u16 fid; __u16 fid;
...@@ -586,10 +586,10 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, ...@@ -586,10 +586,10 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode,
cifs_sb = CIFS_SB(sb); cifs_sb = CIFS_SB(sb);
if (open_file) { if (open_file) {
unlock_file = TRUE; unlock_file = true;
fid = open_file->netfid; fid = open_file->netfid;
} else if (pfid == NULL) { } else if (pfid == NULL) {
int oplock = FALSE; int oplock = 0;
/* open file */ /* open file */
rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN,
READ_CONTROL, 0, &fid, &oplock, NULL, READ_CONTROL, 0, &fid, &oplock, NULL,
...@@ -604,7 +604,7 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode, ...@@ -604,7 +604,7 @@ static struct cifs_ntsd *get_cifs_acl(u32 *pacllen, struct inode *inode,
rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen); rc = CIFSSMBGetCIFSACL(xid, cifs_sb->tcon, fid, &pntsd, pacllen);
cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen)); cFYI(1, ("GetCIFSACL rc = %d ACL len %d", rc, *pacllen));
if (unlock_file == TRUE) /* find_readable_file increments ref count */ if (unlock_file == true) /* find_readable_file increments ref count */
atomic_dec(&open_file->wrtPending); atomic_dec(&open_file->wrtPending);
else if (pfid == NULL) /* if opened above we have to close the handle */ else if (pfid == NULL) /* if opened above we have to close the handle */
CIFSSMBClose(xid, cifs_sb->tcon, fid); CIFSSMBClose(xid, cifs_sb->tcon, fid);
...@@ -619,7 +619,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, ...@@ -619,7 +619,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
struct inode *inode, const char *path) struct inode *inode, const char *path)
{ {
struct cifsFileInfo *open_file; struct cifsFileInfo *open_file;
int unlock_file = FALSE; bool unlock_file = false;
int xid; int xid;
int rc = -EIO; int rc = -EIO;
__u16 fid; __u16 fid;
...@@ -640,10 +640,10 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, ...@@ -640,10 +640,10 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
open_file = find_readable_file(CIFS_I(inode)); open_file = find_readable_file(CIFS_I(inode));
if (open_file) { if (open_file) {
unlock_file = TRUE; unlock_file = true;
fid = open_file->netfid; fid = open_file->netfid;
} else { } else {
int oplock = FALSE; int oplock = 0;
/* open file */ /* open file */
rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN, rc = CIFSSMBOpen(xid, cifs_sb->tcon, path, FILE_OPEN,
WRITE_DAC, 0, &fid, &oplock, NULL, WRITE_DAC, 0, &fid, &oplock, NULL,
...@@ -658,7 +658,7 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, ...@@ -658,7 +658,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);
cFYI(DBG2, ("SetCIFSACL rc = %d", rc)); cFYI(DBG2, ("SetCIFSACL rc = %d", rc));
if (unlock_file == TRUE) if (unlock_file)
atomic_dec(&open_file->wrtPending); atomic_dec(&open_file->wrtPending);
else else
CIFSSMBClose(xid, cifs_sb->tcon, fid); CIFSSMBClose(xid, cifs_sb->tcon, fid);
......
...@@ -222,50 +222,50 @@ static int ...@@ -222,50 +222,50 @@ static int
cifs_statfs(struct dentry *dentry, struct kstatfs *buf) cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb; struct super_block *sb = dentry->d_sb;
int xid; struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
struct cifsTconInfo *tcon = cifs_sb->tcon;
int rc = -EOPNOTSUPP; int rc = -EOPNOTSUPP;
struct cifs_sb_info *cifs_sb; int xid;
struct cifsTconInfo *pTcon;
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(sb);
pTcon = cifs_sb->tcon;
buf->f_type = CIFS_MAGIC_NUMBER; buf->f_type = CIFS_MAGIC_NUMBER;
/* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */ /*
buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would * PATH_MAX may be too long - it would presumably be total path,
presumably be total path, but note * but note that some servers (includinng Samba 3) have a shorter
that some servers (includinng Samba 3) * maximum path.
have a shorter maximum path */ *
* Instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO.
*/
buf->f_namelen = PATH_MAX;
buf->f_files = 0; /* undefined */ buf->f_files = 0; /* undefined */
buf->f_ffree = 0; /* unlimited */ buf->f_ffree = 0; /* unlimited */
/* BB we could add a second check for a QFS Unix capability bit */ /*
/* BB FIXME check CIFS_POSIX_EXTENSIONS Unix cap first FIXME BB */ * We could add a second check for a QFS Unix capability bit
if ((pTcon->ses->capabilities & CAP_UNIX) && (CIFS_POSIX_EXTENSIONS & */
le64_to_cpu(pTcon->fsUnixInfo.Capability))) if ((tcon->ses->capabilities & CAP_UNIX) &&
rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf); (CIFS_POSIX_EXTENSIONS & le64_to_cpu(tcon->fsUnixInfo.Capability)))
rc = CIFSSMBQFSPosixInfo(xid, tcon, buf);
/* Only need to call the old QFSInfo if failed
on newer one */ /*
if (rc) * Only need to call the old QFSInfo if failed on newer one,
if (pTcon->ses->capabilities & CAP_NT_SMBS) * e.g. by OS/2.
rc = CIFSSMBQFSInfo(xid, pTcon, buf); /* not supported by OS2 */ **/
if (rc && (tcon->ses->capabilities & CAP_NT_SMBS))
/* Some old Windows servers also do not support level 103, retry with rc = CIFSSMBQFSInfo(xid, tcon, buf);
older level one if old server failed the previous call or we
bypassed it because we detected that this was an older LANMAN sess */ /*
* Some old Windows servers also do not support level 103, retry with
* older level one if old server failed the previous call or we
* bypassed it because we detected that this was an older LANMAN sess
*/
if (rc) if (rc)
rc = SMBOldQFSInfo(xid, pTcon, buf); rc = SMBOldQFSInfo(xid, tcon, buf);
/* int f_type;
__fsid_t f_fsid;
int f_namelen; */
/* BB get from info in tcon struct at mount time call to QFSAttrInfo */
FreeXid(xid); FreeXid(xid);
return 0; /* always return success? what if volume is no return 0;
longer available? */
} }
static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd) static int cifs_permission(struct inode *inode, int mask, struct nameidata *nd)
...@@ -306,8 +306,8 @@ cifs_alloc_inode(struct super_block *sb) ...@@ -306,8 +306,8 @@ cifs_alloc_inode(struct super_block *sb)
/* Until the file is open and we have gotten oplock /* Until the file is open and we have gotten oplock
info back from the server, can not assume caching of info back from the server, can not assume caching of
file data or metadata */ file data or metadata */
cifs_inode->clientCanCacheRead = FALSE; cifs_inode->clientCanCacheRead = false;
cifs_inode->clientCanCacheAll = FALSE; cifs_inode->clientCanCacheAll = false;
cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */ cifs_inode->vfs_inode.i_blkbits = 14; /* 2**14 = CIFS_MAX_MSGSIZE */
/* Can not set i_flags here - they get immediately overwritten /* Can not set i_flags here - they get immediately overwritten
...@@ -940,7 +940,7 @@ static int cifs_oplock_thread(void *dummyarg) ...@@ -940,7 +940,7 @@ static int cifs_oplock_thread(void *dummyarg)
rc = CIFSSMBLock(0, pTcon, netfid, rc = CIFSSMBLock(0, pTcon, netfid,
0 /* len */ , 0 /* offset */, 0, 0 /* len */ , 0 /* offset */, 0,
0, LOCKING_ANDX_OPLOCK_RELEASE, 0, LOCKING_ANDX_OPLOCK_RELEASE,
0 /* wait flag */); false /* wait flag */);
cFYI(1, ("Oplock release rc = %d", rc)); cFYI(1, ("Oplock release rc = %d", rc));
} }
} else } else
......
...@@ -24,14 +24,6 @@ ...@@ -24,14 +24,6 @@
#define ROOT_I 2 #define ROOT_I 2
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
extern struct file_system_type cifs_fs_type; extern struct file_system_type cifs_fs_type;
extern const struct address_space_operations cifs_addr_ops; extern const struct address_space_operations cifs_addr_ops;
extern const struct address_space_operations cifs_addr_ops_smallbuf; extern const struct address_space_operations cifs_addr_ops_smallbuf;
...@@ -110,5 +102,5 @@ extern int cifs_ioctl(struct inode *inode, struct file *filep, ...@@ -110,5 +102,5 @@ extern int cifs_ioctl(struct inode *inode, struct file *filep,
extern const struct export_operations cifs_export_ops; extern const struct export_operations cifs_export_ops;
#endif /* EXPERIMENTAL */ #endif /* EXPERIMENTAL */
#define CIFS_VERSION "1.52" #define CIFS_VERSION "1.53"
#endif /* _CIFSFS_H */ #endif /* _CIFSFS_H */
...@@ -57,14 +57,6 @@ ...@@ -57,14 +57,6 @@
#include "cifspdu.h" #include "cifspdu.h"
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef XATTR_DOS_ATTRIB #ifndef XATTR_DOS_ATTRIB
#define XATTR_DOS_ATTRIB "user.DOSATTRIB" #define XATTR_DOS_ATTRIB "user.DOSATTRIB"
#endif #endif
...@@ -147,7 +139,7 @@ struct TCP_Server_Info { ...@@ -147,7 +139,7 @@ struct TCP_Server_Info {
enum protocolEnum protocolType; enum protocolEnum protocolType;
char versionMajor; char versionMajor;
char versionMinor; char versionMinor;
unsigned svlocal:1; /* local server or remote */ bool svlocal:1; /* local server or remote */
atomic_t socketUseCount; /* number of open cifs sessions on socket */ atomic_t socketUseCount; /* number of open cifs sessions on socket */
atomic_t inFlight; /* number of requests on the wire to server */ atomic_t inFlight; /* number of requests on the wire to server */
#ifdef CONFIG_CIFS_STATS2 #ifdef CONFIG_CIFS_STATS2
...@@ -286,10 +278,10 @@ struct cifsTconInfo { ...@@ -286,10 +278,10 @@ struct cifsTconInfo {
FILE_SYSTEM_DEVICE_INFO fsDevInfo; FILE_SYSTEM_DEVICE_INFO fsDevInfo;
FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */ FILE_SYSTEM_ATTRIBUTE_INFO fsAttrInfo; /* ok if fs name truncated */
FILE_SYSTEM_UNIX_INFO fsUnixInfo; FILE_SYSTEM_UNIX_INFO fsUnixInfo;
unsigned ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */ bool ipc:1; /* set if connection to IPC$ eg for RPC/PIPES */
unsigned retry:1; bool retry:1;
unsigned nocase:1; bool nocase:1;
unsigned unix_ext:1; /* if off disable Linux extensions to CIFS protocol bool unix_ext:1; /* if false disable Linux extensions to CIFS protocol
for this mount even if server would support */ for this mount even if server would support */
/* BB add field for back pointer to sb struct(s)? */ /* BB add field for back pointer to sb struct(s)? */
}; };
...@@ -317,10 +309,10 @@ struct cifs_search_info { ...@@ -317,10 +309,10 @@ struct cifs_search_info {
char *srch_entries_start; char *srch_entries_start;
char *presume_name; char *presume_name;
unsigned int resume_name_len; unsigned int resume_name_len;
unsigned endOfSearch:1; bool endOfSearch:1;
unsigned emptyDir:1; bool emptyDir:1;
unsigned unicode:1; bool unicode:1;
unsigned smallBuf:1; /* so we know which buf_release function to call */ bool smallBuf:1; /* so we know which buf_release function to call */
}; };
struct cifsFileInfo { struct cifsFileInfo {
...@@ -335,9 +327,9 @@ struct cifsFileInfo { ...@@ -335,9 +327,9 @@ struct cifsFileInfo {
struct inode *pInode; /* needed for oplock break */ struct inode *pInode; /* needed for oplock break */
struct mutex lock_mutex; struct mutex lock_mutex;
struct list_head llist; /* list of byte range locks we have. */ struct list_head llist; /* list of byte range locks we have. */
unsigned closePend:1; /* file is marked to close */ bool closePend:1; /* file is marked to close */
unsigned invalidHandle:1; /* file closed via session abend */ bool invalidHandle:1; /* file closed via session abend */
unsigned messageMode:1; /* for pipes: message vs byte mode */ bool messageMode:1; /* for pipes: message vs byte mode */
atomic_t wrtPending; /* handle in use - defer close */ atomic_t wrtPending; /* handle in use - defer close */
struct semaphore fh_sem; /* prevents reopen race after dead ses*/ struct semaphore fh_sem; /* prevents reopen race after dead ses*/
char *search_resume_name; /* BB removeme BB */ char *search_resume_name; /* BB removeme BB */
...@@ -356,9 +348,9 @@ struct cifsInodeInfo { ...@@ -356,9 +348,9 @@ struct cifsInodeInfo {
__u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */
atomic_t inUse; /* num concurrent users (local openers cifs) of file*/ atomic_t inUse; /* num concurrent users (local openers cifs) of file*/
unsigned long time; /* jiffies of last update/check of inode */ unsigned long time; /* jiffies of last update/check of inode */
unsigned clientCanCacheRead:1; /* read oplock */ bool clientCanCacheRead:1; /* read oplock */
unsigned clientCanCacheAll:1; /* read and writebehind oplock */ bool clientCanCacheAll:1; /* read and writebehind oplock */
unsigned oplockPending:1; bool oplockPending:1;
struct inode vfs_inode; struct inode vfs_inode;
}; };
...@@ -426,9 +418,9 @@ struct mid_q_entry { ...@@ -426,9 +418,9 @@ struct mid_q_entry {
struct smb_hdr *resp_buf; /* response buffer */ struct smb_hdr *resp_buf; /* response buffer */
int midState; /* wish this were enum but can not pass to wait_event */ int midState; /* wish this were enum but can not pass to wait_event */
__u8 command; /* smb command code */ __u8 command; /* smb command code */
unsigned largeBuf:1; /* if valid response, is pointer to large buf */ bool largeBuf:1; /* if valid response, is pointer to large buf */
unsigned multiRsp:1; /* multiple trans2 responses for one request */ bool multiRsp:1; /* multiple trans2 responses for one request */
unsigned multiEnd:1; /* both received */ bool multiEnd:1; /* both received */
}; };
struct oplock_q_entry { struct oplock_q_entry {
......
...@@ -2050,7 +2050,7 @@ typedef struct { ...@@ -2050,7 +2050,7 @@ typedef struct {
to 0xFFFF00 */ to 0xFFFF00 */
#define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080 #define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080
#define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP 0x00000100 /* can do SPNEGO crypt */ #define CIFS_UNIX_TRANSPORT_ENCRYPTION_CAP 0x00000100 /* can do SPNEGO crypt */
#define CIFS_UNIX_TRANPSORT_ENCRYPTION_MANDATORY_CAP 0x00000200 /* must do */ #define CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP 0x00000200 /* must do */
#define CIFS_UNIX_PROXY_CAP 0x00000400 /* Proxy cap: 0xACE ioctl and #define CIFS_UNIX_PROXY_CAP 0x00000400 /* Proxy cap: 0xACE ioctl and
QFS PROXY call */ QFS PROXY call */
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
......
...@@ -59,8 +59,9 @@ extern int SendReceiveBlockingLock(const unsigned int xid, ...@@ -59,8 +59,9 @@ extern int SendReceiveBlockingLock(const unsigned int xid,
struct smb_hdr *out_buf, 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 bool is_valid_oplock_break(struct smb_hdr *smb,
extern int is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof); struct TCP_Server_Info *);
extern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *);
#ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL
extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *); extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *);
...@@ -69,7 +70,7 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr); ...@@ -69,7 +70,7 @@ extern unsigned int smbCalcSize(struct smb_hdr *ptr);
extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr);
extern int decode_negTokenInit(unsigned char *security_blob, int length, extern int decode_negTokenInit(unsigned char *security_blob, int length,
enum securityEnum *secType); enum securityEnum *secType);
extern int cifs_inet_pton(int, char *source, void *dst); extern int cifs_inet_pton(const int, const char *source, void *dst);
extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr);
extern void header_assemble(struct smb_hdr *, char /* command */ , extern void header_assemble(struct smb_hdr *, char /* command */ ,
const struct cifsTconInfo *, int /* length of const struct cifsTconInfo *, int /* length of
...@@ -187,12 +188,12 @@ extern int CIFSSMBSetAttrLegacy(int xid, struct cifsTconInfo *tcon, ...@@ -187,12 +188,12 @@ extern int CIFSSMBSetAttrLegacy(int xid, struct cifsTconInfo *tcon,
#endif /* possibly unneeded function */ #endif /* possibly unneeded function */
extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon,
const char *fileName, __u64 size, const char *fileName, __u64 size,
int setAllocationSizeFlag, bool setAllocationSizeFlag,
const struct nls_table *nls_codepage, const struct nls_table *nls_codepage,
int remap_special_chars); int remap_special_chars);
extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon,
__u64 size, __u16 fileHandle, __u32 opener_pid, __u64 size, __u16 fileHandle, __u32 opener_pid,
int AllocSizeFlag); bool AllocSizeFlag);
extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon, extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon,
char *full_path, __u64 mode, __u64 uid, char *full_path, __u64 mode, __u64 uid,
__u64 gid, dev_t dev, __u64 gid, dev_t dev,
...@@ -291,11 +292,11 @@ extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, ...@@ -291,11 +292,11 @@ extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
const __u16 netfid, const __u64 len, const __u16 netfid, const __u64 len,
const __u64 offset, const __u32 numUnlock, const __u64 offset, const __u32 numUnlock,
const __u32 numLock, const __u8 lockType, const __u32 numLock, const __u8 lockType,
const int waitFlag); const bool waitFlag);
extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, extern int CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
const __u16 smb_file_id, const int get_flag, const __u16 smb_file_id, const int get_flag,
const __u64 len, struct file_lock *, const __u64 len, struct file_lock *,
const __u16 lock_type, const int waitFlag); const __u16 lock_type, const bool waitFlag);
extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon); extern int CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon);
extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses); extern int CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses);
......
...@@ -95,7 +95,7 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon) ...@@ -95,7 +95,7 @@ static void mark_open_files_invalid(struct cifsTconInfo *pTcon)
list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { list_for_each_safe(tmp, tmp1, &pTcon->openFileList) {
open_file = list_entry(tmp, struct cifsFileInfo, tlist); open_file = list_entry(tmp, struct cifsFileInfo, tlist);
if (open_file) if (open_file)
open_file->invalidHandle = TRUE; open_file->invalidHandle = true;
} }
write_unlock(&GlobalSMBSeslock); write_unlock(&GlobalSMBSeslock);
/* BB Add call to invalidate_inodes(sb) for all superblocks mounted /* BB Add call to invalidate_inodes(sb) for all superblocks mounted
...@@ -141,7 +141,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, ...@@ -141,7 +141,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
if (tcon->ses->server->tcpStatus == if (tcon->ses->server->tcpStatus ==
CifsNeedReconnect) { CifsNeedReconnect) {
/* on "soft" mounts we wait once */ /* on "soft" mounts we wait once */
if ((tcon->retry == FALSE) || if (!tcon->retry ||
(tcon->ses->status == CifsExiting)) { (tcon->ses->status == CifsExiting)) {
cFYI(1, ("gave up waiting on " cFYI(1, ("gave up waiting on "
"reconnect in smb_init")); "reconnect in smb_init"));
...@@ -289,7 +289,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, ...@@ -289,7 +289,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon,
if (tcon->ses->server->tcpStatus == if (tcon->ses->server->tcpStatus ==
CifsNeedReconnect) { CifsNeedReconnect) {
/* on "soft" mounts we wait once */ /* on "soft" mounts we wait once */
if ((tcon->retry == FALSE) || if (!tcon->retry ||
(tcon->ses->status == CifsExiting)) { (tcon->ses->status == CifsExiting)) {
cFYI(1, ("gave up waiting on " cFYI(1, ("gave up waiting on "
"reconnect in smb_init")); "reconnect in smb_init"));
...@@ -1686,7 +1686,7 @@ int ...@@ -1686,7 +1686,7 @@ int
CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
const __u16 smb_file_id, const __u64 len, const __u16 smb_file_id, const __u64 len,
const __u64 offset, const __u32 numUnlock, const __u64 offset, const __u32 numUnlock,
const __u32 numLock, const __u8 lockType, const int waitFlag) const __u32 numLock, const __u8 lockType, const bool waitFlag)
{ {
int rc = 0; int rc = 0;
LOCK_REQ *pSMB = NULL; LOCK_REQ *pSMB = NULL;
...@@ -1695,7 +1695,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, ...@@ -1695,7 +1695,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
int timeout = 0; int timeout = 0;
__u16 count; __u16 count;
cFYI(1, ("CIFSSMBLock timeout %d numLock %d", waitFlag, numLock)); cFYI(1, ("CIFSSMBLock timeout %d numLock %d", (int)waitFlag, numLock));
rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB); rc = small_smb_init(SMB_COM_LOCKING_ANDX, 8, tcon, (void **) &pSMB);
if (rc) if (rc)
...@@ -1706,7 +1706,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, ...@@ -1706,7 +1706,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) {
timeout = CIFS_ASYNC_OP; /* no response expected */ timeout = CIFS_ASYNC_OP; /* no response expected */
pSMB->Timeout = 0; pSMB->Timeout = 0;
} else if (waitFlag == TRUE) { } else if (waitFlag) {
timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */ timeout = CIFS_BLOCKING_OP; /* blocking operation, no timeout */
pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */ pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */
} else { } else {
...@@ -1756,7 +1756,7 @@ int ...@@ -1756,7 +1756,7 @@ int
CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon,
const __u16 smb_file_id, const int get_flag, const __u64 len, const __u16 smb_file_id, const int get_flag, const __u64 len,
struct file_lock *pLockData, const __u16 lock_type, struct file_lock *pLockData, const __u16 lock_type,
const int waitFlag) const bool waitFlag)
{ {
struct smb_com_transaction2_sfi_req *pSMB = NULL; struct smb_com_transaction2_sfi_req *pSMB = NULL;
struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
...@@ -3581,9 +3581,9 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, ...@@ -3581,9 +3581,9 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
rc = validate_t2((struct smb_t2_rsp *)pSMBr); rc = validate_t2((struct smb_t2_rsp *)pSMBr);
if (rc == 0) { if (rc == 0) {
if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE)
psrch_inf->unicode = TRUE; psrch_inf->unicode = true;
else else
psrch_inf->unicode = FALSE; psrch_inf->unicode = false;
psrch_inf->ntwrk_buf_start = (char *)pSMBr; psrch_inf->ntwrk_buf_start = (char *)pSMBr;
psrch_inf->smallBuf = 0; psrch_inf->smallBuf = 0;
...@@ -3594,9 +3594,9 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, ...@@ -3594,9 +3594,9 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
le16_to_cpu(pSMBr->t2.ParameterOffset)); le16_to_cpu(pSMBr->t2.ParameterOffset));
if (parms->EndofSearch) if (parms->EndofSearch)
psrch_inf->endOfSearch = TRUE; psrch_inf->endOfSearch = true;
else else
psrch_inf->endOfSearch = FALSE; psrch_inf->endOfSearch = false;
psrch_inf->entries_in_buffer = psrch_inf->entries_in_buffer =
le16_to_cpu(parms->SearchCount); le16_to_cpu(parms->SearchCount);
...@@ -3624,7 +3624,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, ...@@ -3624,7 +3624,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
cFYI(1, ("In FindNext")); cFYI(1, ("In FindNext"));
if (psrch_inf->endOfSearch == TRUE) if (psrch_inf->endOfSearch)
return -ENOENT; return -ENOENT;
rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
...@@ -3682,7 +3682,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, ...@@ -3682,7 +3682,7 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
cifs_stats_inc(&tcon->num_fnext); cifs_stats_inc(&tcon->num_fnext);
if (rc) { if (rc) {
if (rc == -EBADF) { if (rc == -EBADF) {
psrch_inf->endOfSearch = TRUE; psrch_inf->endOfSearch = true;
rc = 0; /* search probably was closed at end of search*/ rc = 0; /* search probably was closed at end of search*/
} else } else
cFYI(1, ("FindNext returned = %d", rc)); cFYI(1, ("FindNext returned = %d", rc));
...@@ -3692,9 +3692,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, ...@@ -3692,9 +3692,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
if (rc == 0) { if (rc == 0) {
/* BB fixme add lock for file (srch_info) struct here */ /* BB fixme add lock for file (srch_info) struct here */
if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE)
psrch_inf->unicode = TRUE; psrch_inf->unicode = true;
else else
psrch_inf->unicode = FALSE; psrch_inf->unicode = false;
response_data = (char *) &pSMBr->hdr.Protocol + response_data = (char *) &pSMBr->hdr.Protocol +
le16_to_cpu(pSMBr->t2.ParameterOffset); le16_to_cpu(pSMBr->t2.ParameterOffset);
parms = (T2_FNEXT_RSP_PARMS *)response_data; parms = (T2_FNEXT_RSP_PARMS *)response_data;
...@@ -3709,9 +3709,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, ...@@ -3709,9 +3709,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
psrch_inf->ntwrk_buf_start = (char *)pSMB; psrch_inf->ntwrk_buf_start = (char *)pSMB;
psrch_inf->smallBuf = 0; psrch_inf->smallBuf = 0;
if (parms->EndofSearch) if (parms->EndofSearch)
psrch_inf->endOfSearch = TRUE; psrch_inf->endOfSearch = true;
else else
psrch_inf->endOfSearch = FALSE; psrch_inf->endOfSearch = false;
psrch_inf->entries_in_buffer = psrch_inf->entries_in_buffer =
le16_to_cpu(parms->SearchCount); le16_to_cpu(parms->SearchCount);
psrch_inf->index_of_last_entry += psrch_inf->index_of_last_entry +=
...@@ -4586,7 +4586,7 @@ CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon, ...@@ -4586,7 +4586,7 @@ CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon,
int int
CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName, CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName,
__u64 size, int SetAllocation, __u64 size, bool SetAllocation,
const struct nls_table *nls_codepage, int remap) const struct nls_table *nls_codepage, int remap)
{ {
struct smb_com_transaction2_spi_req *pSMB = NULL; struct smb_com_transaction2_spi_req *pSMB = NULL;
...@@ -4675,7 +4675,7 @@ CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName, ...@@ -4675,7 +4675,7 @@ CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName,
int int
CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
__u16 fid, __u32 pid_of_opener, int SetAllocation) __u16 fid, __u32 pid_of_opener, bool SetAllocation)
{ {
struct smb_com_transaction2_sfi_req *pSMB = NULL; struct smb_com_transaction2_sfi_req *pSMB = NULL;
char *data_offset; char *data_offset;
......
This diff is collapsed.
...@@ -130,7 +130,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -130,7 +130,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
struct cifsFileInfo *pCifsFile = NULL; struct cifsFileInfo *pCifsFile = NULL;
struct cifsInodeInfo *pCifsInode; struct cifsInodeInfo *pCifsInode;
int disposition = FILE_OVERWRITE_IF; int disposition = FILE_OVERWRITE_IF;
int write_only = FALSE; bool write_only = false;
xid = GetXid(); xid = GetXid();
...@@ -152,7 +152,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -152,7 +152,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
if (oflags & FMODE_WRITE) { if (oflags & FMODE_WRITE) {
desiredAccess |= GENERIC_WRITE; desiredAccess |= GENERIC_WRITE;
if (!(oflags & FMODE_READ)) if (!(oflags & FMODE_READ))
write_only = TRUE; write_only = true;
} }
if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
...@@ -254,7 +254,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -254,7 +254,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
d_instantiate(direntry, newinode); d_instantiate(direntry, newinode);
} }
if ((nd == NULL /* nfsd case - nfs srv does not set nd */) || if ((nd == NULL /* nfsd case - nfs srv does not set nd */) ||
((nd->flags & LOOKUP_OPEN) == FALSE)) { (!(nd->flags & LOOKUP_OPEN))) {
/* mknod case - do not leave file open */ /* mknod case - do not leave file open */
CIFSSMBClose(xid, pTcon, fileHandle); CIFSSMBClose(xid, pTcon, fileHandle);
} else if (newinode) { } else if (newinode) {
...@@ -266,8 +266,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -266,8 +266,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
pCifsFile->netfid = fileHandle; pCifsFile->netfid = fileHandle;
pCifsFile->pid = current->tgid; pCifsFile->pid = current->tgid;
pCifsFile->pInode = newinode; pCifsFile->pInode = newinode;
pCifsFile->invalidHandle = FALSE; pCifsFile->invalidHandle = false;
pCifsFile->closePend = FALSE; pCifsFile->closePend = false;
init_MUTEX(&pCifsFile->fh_sem); init_MUTEX(&pCifsFile->fh_sem);
mutex_init(&pCifsFile->lock_mutex); mutex_init(&pCifsFile->lock_mutex);
INIT_LIST_HEAD(&pCifsFile->llist); INIT_LIST_HEAD(&pCifsFile->llist);
...@@ -280,7 +280,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -280,7 +280,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
pCifsInode = CIFS_I(newinode); pCifsInode = CIFS_I(newinode);
if (pCifsInode) { if (pCifsInode) {
/* if readable file instance put first in list*/ /* if readable file instance put first in list*/
if (write_only == TRUE) { if (write_only) {
list_add_tail(&pCifsFile->flist, list_add_tail(&pCifsFile->flist,
&pCifsInode->openFileList); &pCifsInode->openFileList);
} else { } else {
...@@ -288,12 +288,12 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -288,12 +288,12 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
&pCifsInode->openFileList); &pCifsInode->openFileList);
} }
if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = TRUE; pCifsInode->clientCanCacheAll = true;
pCifsInode->clientCanCacheRead = TRUE; pCifsInode->clientCanCacheRead = true;
cFYI(1, ("Exclusive Oplock inode %p", cFYI(1, ("Exclusive Oplock inode %p",
newinode)); newinode));
} else if ((oplock & 0xF) == OPLOCK_READ) } else if ((oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = TRUE; pCifsInode->clientCanCacheRead = true;
} }
write_unlock(&GlobalSMBSeslock); write_unlock(&GlobalSMBSeslock);
} }
......
...@@ -55,6 +55,32 @@ struct key_type key_type_dns_resolver = { ...@@ -55,6 +55,32 @@ struct key_type key_type_dns_resolver = {
.match = user_match, .match = user_match,
}; };
/* Checks if supplied name is IP address
* returns:
* 1 - name is IP
* 0 - name is not IP
*/
static int is_ip(const char *name)
{
int rc;
struct sockaddr_in sin_server;
struct sockaddr_in6 sin_server6;
rc = cifs_inet_pton(AF_INET, name,
&sin_server.sin_addr.s_addr);
if (rc <= 0) {
/* not ipv4 address, try ipv6 */
rc = cifs_inet_pton(AF_INET6, name,
&sin_server6.sin6_addr.in6_u);
if (rc > 0)
return 1;
} else {
return 1;
}
/* we failed translating address */
return 0;
}
/* Resolves server name to ip address. /* Resolves server name to ip address.
* input: * input:
...@@ -67,8 +93,9 @@ int ...@@ -67,8 +93,9 @@ int
dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
{ {
int rc = -EAGAIN; int rc = -EAGAIN;
struct key *rkey; struct key *rkey = ERR_PTR(-EAGAIN);
char *name; char *name;
char *data = NULL;
int len; int len;
if (!ip_addr || !unc) if (!ip_addr || !unc)
...@@ -97,26 +124,41 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) ...@@ -97,26 +124,41 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr)
memcpy(name, unc+2, len); memcpy(name, unc+2, len);
name[len] = 0; name[len] = 0;
if (is_ip(name)) {
cFYI(1, ("%s: it is IP, skipping dns upcall: %s",
__func__, name));
data = name;
goto skip_upcall;
}
rkey = request_key(&key_type_dns_resolver, name, ""); rkey = request_key(&key_type_dns_resolver, name, "");
if (!IS_ERR(rkey)) { if (!IS_ERR(rkey)) {
len = strlen(rkey->payload.data); data = rkey->payload.data;
*ip_addr = kmalloc(len+1, GFP_KERNEL); cFYI(1, ("%s: resolved: %s to %s", __func__,
if (*ip_addr) {
memcpy(*ip_addr, rkey->payload.data, len);
(*ip_addr)[len] = '\0';
cFYI(1, ("%s: resolved: %s to %s", __func__,
rkey->description, rkey->description,
*ip_addr *ip_addr
)); ));
} else {
cERROR(1, ("%s: unable to resolve: %s", __func__, name));
goto out;
}
skip_upcall:
if (data) {
len = strlen(data);
*ip_addr = kmalloc(len+1, GFP_KERNEL);
if (*ip_addr) {
memcpy(*ip_addr, data, len);
(*ip_addr)[len] = '\0';
rc = 0; rc = 0;
} else { } else {
rc = -ENOMEM; rc = -ENOMEM;
} }
key_put(rkey); if (!IS_ERR(rkey))
} else { key_put(rkey);
cERROR(1, ("%s: unable to resolve: %s", __func__, name));
} }
out:
kfree(name); kfree(name);
return rc; return rc;
} }
......
...@@ -68,7 +68,7 @@ int cifs_dir_notify(struct file *file, unsigned long arg) ...@@ -68,7 +68,7 @@ int cifs_dir_notify(struct file *file, unsigned long arg)
{ {
int xid; int xid;
int rc = -EINVAL; int rc = -EINVAL;
int oplock = FALSE; int oplock = 0;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
char *full_path = NULL; char *full_path = NULL;
......
...@@ -51,8 +51,8 @@ static inline struct cifsFileInfo *cifs_init_private( ...@@ -51,8 +51,8 @@ static inline struct cifsFileInfo *cifs_init_private(
INIT_LIST_HEAD(&private_data->llist); INIT_LIST_HEAD(&private_data->llist);
private_data->pfile = file; /* needed for writepage */ private_data->pfile = file; /* needed for writepage */
private_data->pInode = inode; private_data->pInode = inode;
private_data->invalidHandle = FALSE; private_data->invalidHandle = false;
private_data->closePend = FALSE; private_data->closePend = false;
/* we have to track num writers to the inode, since writepages /* we have to track num writers to the inode, since writepages
does not tell us which handle the write is for so there can does not tell us which handle the write is for so there can
be a close (overlapping with write) of the filehandle that be a close (overlapping with write) of the filehandle that
...@@ -148,12 +148,12 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, ...@@ -148,12 +148,12 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,
full_path, buf, inode->i_sb, xid, NULL); full_path, buf, inode->i_sb, xid, NULL);
if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = TRUE; pCifsInode->clientCanCacheAll = true;
pCifsInode->clientCanCacheRead = TRUE; pCifsInode->clientCanCacheRead = true;
cFYI(1, ("Exclusive Oplock granted on inode %p", cFYI(1, ("Exclusive Oplock granted on inode %p",
file->f_path.dentry->d_inode)); file->f_path.dentry->d_inode));
} else if ((*oplock & 0xF) == OPLOCK_READ) } else if ((*oplock & 0xF) == OPLOCK_READ)
pCifsInode->clientCanCacheRead = TRUE; pCifsInode->clientCanCacheRead = true;
return rc; return rc;
} }
...@@ -247,7 +247,7 @@ int cifs_open(struct inode *inode, struct file *file) ...@@ -247,7 +247,7 @@ int cifs_open(struct inode *inode, struct file *file)
if (oplockEnabled) if (oplockEnabled)
oplock = REQ_OPLOCK; oplock = REQ_OPLOCK;
else else
oplock = FALSE; oplock = 0;
/* BB pass O_SYNC flag through on file attributes .. BB */ /* BB pass O_SYNC flag through on file attributes .. BB */
...@@ -339,7 +339,7 @@ static int cifs_relock_file(struct cifsFileInfo *cifsFile) ...@@ -339,7 +339,7 @@ static int cifs_relock_file(struct cifsFileInfo *cifsFile)
return rc; return rc;
} }
static int cifs_reopen_file(struct file *file, int can_flush) static int cifs_reopen_file(struct file *file, bool can_flush)
{ {
int rc = -EACCES; int rc = -EACCES;
int xid, oplock; int xid, oplock;
...@@ -360,7 +360,7 @@ static int cifs_reopen_file(struct file *file, int can_flush) ...@@ -360,7 +360,7 @@ static int cifs_reopen_file(struct file *file, int can_flush)
xid = GetXid(); xid = GetXid();
down(&pCifsFile->fh_sem); down(&pCifsFile->fh_sem);
if (pCifsFile->invalidHandle == FALSE) { if (!pCifsFile->invalidHandle) {
up(&pCifsFile->fh_sem); up(&pCifsFile->fh_sem);
FreeXid(xid); FreeXid(xid);
return 0; return 0;
...@@ -404,7 +404,7 @@ static int cifs_reopen_file(struct file *file, int can_flush) ...@@ -404,7 +404,7 @@ static int cifs_reopen_file(struct file *file, int can_flush)
if (oplockEnabled) if (oplockEnabled)
oplock = REQ_OPLOCK; oplock = REQ_OPLOCK;
else else
oplock = FALSE; oplock = 0;
/* Can not refresh inode by passing in file_info buf to be returned /* Can not refresh inode by passing in file_info buf to be returned
by SMBOpen and then calling get_inode_info with returned buf by SMBOpen and then calling get_inode_info with returned buf
...@@ -422,7 +422,7 @@ static int cifs_reopen_file(struct file *file, int can_flush) ...@@ -422,7 +422,7 @@ static int cifs_reopen_file(struct file *file, int can_flush)
cFYI(1, ("oplock: %d", oplock)); cFYI(1, ("oplock: %d", oplock));
} else { } else {
pCifsFile->netfid = netfid; pCifsFile->netfid = netfid;
pCifsFile->invalidHandle = FALSE; pCifsFile->invalidHandle = false;
up(&pCifsFile->fh_sem); up(&pCifsFile->fh_sem);
pCifsInode = CIFS_I(inode); pCifsInode = CIFS_I(inode);
if (pCifsInode) { if (pCifsInode) {
...@@ -432,8 +432,8 @@ static int cifs_reopen_file(struct file *file, int can_flush) ...@@ -432,8 +432,8 @@ static int cifs_reopen_file(struct file *file, int can_flush)
CIFS_I(inode)->write_behind_rc = rc; CIFS_I(inode)->write_behind_rc = rc;
/* temporarily disable caching while we /* temporarily disable caching while we
go to server to get inode info */ go to server to get inode info */
pCifsInode->clientCanCacheAll = FALSE; pCifsInode->clientCanCacheAll = false;
pCifsInode->clientCanCacheRead = FALSE; pCifsInode->clientCanCacheRead = false;
if (pTcon->unix_ext) if (pTcon->unix_ext)
rc = cifs_get_inode_info_unix(&inode, rc = cifs_get_inode_info_unix(&inode,
full_path, inode->i_sb, xid); full_path, inode->i_sb, xid);
...@@ -448,16 +448,16 @@ static int cifs_reopen_file(struct file *file, int can_flush) ...@@ -448,16 +448,16 @@ static int cifs_reopen_file(struct file *file, int can_flush)
we can not go to the server to get the new inod we can not go to the server to get the new inod
info */ info */
if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
pCifsInode->clientCanCacheAll = TRUE; pCifsInode->clientCanCacheAll = true;
pCifsInode->clientCanCacheRead = TRUE; pCifsInode->clientCanCacheRead = true;
cFYI(1, ("Exclusive Oplock granted on inode %p", cFYI(1, ("Exclusive Oplock granted on inode %p",
file->f_path.dentry->d_inode)); file->f_path.dentry->d_inode));
} else if ((oplock & 0xF) == OPLOCK_READ) { } else if ((oplock & 0xF) == OPLOCK_READ) {
pCifsInode->clientCanCacheRead = TRUE; pCifsInode->clientCanCacheRead = true;
pCifsInode->clientCanCacheAll = FALSE; pCifsInode->clientCanCacheAll = false;
} else { } else {
pCifsInode->clientCanCacheRead = FALSE; pCifsInode->clientCanCacheRead = false;
pCifsInode->clientCanCacheAll = FALSE; pCifsInode->clientCanCacheAll = false;
} }
cifs_relock_file(pCifsFile); cifs_relock_file(pCifsFile);
} }
...@@ -484,7 +484,7 @@ int cifs_close(struct inode *inode, struct file *file) ...@@ -484,7 +484,7 @@ int cifs_close(struct inode *inode, struct file *file)
if (pSMBFile) { if (pSMBFile) {
struct cifsLockInfo *li, *tmp; struct cifsLockInfo *li, *tmp;
pSMBFile->closePend = TRUE; pSMBFile->closePend = true;
if (pTcon) { if (pTcon) {
/* no sense reconnecting to close a file that is /* no sense reconnecting to close a file that is
already closed */ already closed */
...@@ -553,8 +553,8 @@ int cifs_close(struct inode *inode, struct file *file) ...@@ -553,8 +553,8 @@ int cifs_close(struct inode *inode, struct file *file)
cFYI(1, ("closing last open instance for inode %p", inode)); cFYI(1, ("closing last open instance for inode %p", inode));
/* if the file is not open we do not know if we can cache info /* if the file is not open we do not know if we can cache info
on this inode, much less write behind and read ahead */ on this inode, much less write behind and read ahead */
CIFS_I(inode)->clientCanCacheRead = FALSE; CIFS_I(inode)->clientCanCacheRead = false;
CIFS_I(inode)->clientCanCacheAll = FALSE; CIFS_I(inode)->clientCanCacheAll = false;
} }
read_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
if ((rc == 0) && CIFS_I(inode)->write_behind_rc) if ((rc == 0) && CIFS_I(inode)->write_behind_rc)
...@@ -583,9 +583,9 @@ int cifs_closedir(struct inode *inode, struct file *file) ...@@ -583,9 +583,9 @@ int cifs_closedir(struct inode *inode, struct file *file)
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
cFYI(1, ("Freeing private data in close dir")); cFYI(1, ("Freeing private data in close dir"));
if ((pCFileStruct->srch_inf.endOfSearch == FALSE) && if (!pCFileStruct->srch_inf.endOfSearch &&
(pCFileStruct->invalidHandle == FALSE)) { !pCFileStruct->invalidHandle) {
pCFileStruct->invalidHandle = TRUE; pCFileStruct->invalidHandle = true;
rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid);
cFYI(1, ("Closing uncompleted readdir with rc %d", cFYI(1, ("Closing uncompleted readdir with rc %d",
rc)); rc));
...@@ -637,12 +637,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) ...@@ -637,12 +637,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
__u32 numLock = 0; __u32 numLock = 0;
__u32 numUnlock = 0; __u32 numUnlock = 0;
__u64 length; __u64 length;
int wait_flag = FALSE; bool wait_flag = false;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
__u16 netfid; __u16 netfid;
__u8 lockType = LOCKING_ANDX_LARGE_FILES; __u8 lockType = LOCKING_ANDX_LARGE_FILES;
int posix_locking; bool posix_locking;
length = 1 + pfLock->fl_end - pfLock->fl_start; length = 1 + pfLock->fl_end - pfLock->fl_start;
rc = -EACCES; rc = -EACCES;
...@@ -659,7 +659,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) ...@@ -659,7 +659,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
cFYI(1, ("Flock")); cFYI(1, ("Flock"));
if (pfLock->fl_flags & FL_SLEEP) { if (pfLock->fl_flags & FL_SLEEP) {
cFYI(1, ("Blocking lock")); cFYI(1, ("Blocking lock"));
wait_flag = TRUE; wait_flag = true;
} }
if (pfLock->fl_flags & FL_ACCESS) if (pfLock->fl_flags & FL_ACCESS)
cFYI(1, ("Process suspended by mandatory locking - " cFYI(1, ("Process suspended by mandatory locking - "
...@@ -794,7 +794,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) ...@@ -794,7 +794,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
stored_rc = CIFSSMBLock(xid, pTcon, stored_rc = CIFSSMBLock(xid, pTcon,
netfid, netfid,
li->length, li->offset, li->length, li->offset,
1, 0, li->type, FALSE); 1, 0, li->type, false);
if (stored_rc) if (stored_rc)
rc = stored_rc; rc = stored_rc;
...@@ -866,7 +866,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, ...@@ -866,7 +866,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
filemap_fdatawait from here so tell filemap_fdatawait from here so tell
reopen_file not to flush data to server reopen_file not to flush data to server
now */ now */
rc = cifs_reopen_file(file, FALSE); rc = cifs_reopen_file(file, false);
if (rc != 0) if (rc != 0)
break; break;
} }
...@@ -966,7 +966,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data, ...@@ -966,7 +966,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
filemap_fdatawait from here so tell filemap_fdatawait from here so tell
reopen_file not to flush data to reopen_file not to flush data to
server now */ server now */
rc = cifs_reopen_file(file, FALSE); rc = cifs_reopen_file(file, false);
if (rc != 0) if (rc != 0)
break; break;
} }
...@@ -1093,7 +1093,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode) ...@@ -1093,7 +1093,7 @@ struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *cifs_inode)
read_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
/* Had to unlock since following call can block */ /* Had to unlock since following call can block */
rc = cifs_reopen_file(open_file->pfile, FALSE); rc = cifs_reopen_file(open_file->pfile, false);
if (!rc) { if (!rc) {
if (!open_file->closePend) if (!open_file->closePend)
return open_file; return open_file;
...@@ -1608,7 +1608,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, ...@@ -1608,7 +1608,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
int buf_type = CIFS_NO_BUFFER; int buf_type = CIFS_NO_BUFFER;
if ((open_file->invalidHandle) && if ((open_file->invalidHandle) &&
(!open_file->closePend)) { (!open_file->closePend)) {
rc = cifs_reopen_file(file, TRUE); rc = cifs_reopen_file(file, true);
if (rc != 0) if (rc != 0)
break; break;
} }
...@@ -1693,7 +1693,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, ...@@ -1693,7 +1693,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
while (rc == -EAGAIN) { while (rc == -EAGAIN) {
if ((open_file->invalidHandle) && if ((open_file->invalidHandle) &&
(!open_file->closePend)) { (!open_file->closePend)) {
rc = cifs_reopen_file(file, TRUE); rc = cifs_reopen_file(file, true);
if (rc != 0) if (rc != 0)
break; break;
} }
...@@ -1850,7 +1850,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, ...@@ -1850,7 +1850,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
while (rc == -EAGAIN) { while (rc == -EAGAIN) {
if ((open_file->invalidHandle) && if ((open_file->invalidHandle) &&
(!open_file->closePend)) { (!open_file->closePend)) {
rc = cifs_reopen_file(file, TRUE); rc = cifs_reopen_file(file, true);
if (rc != 0) if (rc != 0)
break; break;
} }
...@@ -2009,10 +2009,10 @@ static int is_inode_writable(struct cifsInodeInfo *cifs_inode) ...@@ -2009,10 +2009,10 @@ static int is_inode_writable(struct cifsInodeInfo *cifs_inode)
refreshing the inode only on increases in the file size refreshing the inode only on increases in the file size
but this is tricky to do without racing with writebehind but this is tricky to do without racing with writebehind
page caching in the current Linux kernel design */ page caching in the current Linux kernel design */
int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file)
{ {
if (!cifsInode) if (!cifsInode)
return 1; return true;
if (is_inode_writable(cifsInode)) { if (is_inode_writable(cifsInode)) {
/* This inode is open for write at least once */ /* This inode is open for write at least once */
...@@ -2022,15 +2022,15 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) ...@@ -2022,15 +2022,15 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file)
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 true;
} }
if (i_size_read(&cifsInode->vfs_inode) < end_of_file) if (i_size_read(&cifsInode->vfs_inode) < end_of_file)
return 1; return true;
return 0; return false;
} else } else
return 1; return true;
} }
static int cifs_prepare_write(struct file *file, struct page *page, static int cifs_prepare_write(struct file *file, struct page *page,
......
...@@ -281,7 +281,7 @@ static int decode_sfu_inode(struct inode *inode, __u64 size, ...@@ -281,7 +281,7 @@ static int decode_sfu_inode(struct inode *inode, __u64 size,
struct cifs_sb_info *cifs_sb, int xid) struct cifs_sb_info *cifs_sb, int xid)
{ {
int rc; int rc;
int oplock = FALSE; int oplock = 0;
__u16 netfid; __u16 netfid;
struct cifsTconInfo *pTcon = cifs_sb->tcon; struct cifsTconInfo *pTcon = cifs_sb->tcon;
char buf[24]; char buf[24];
...@@ -389,7 +389,7 @@ int cifs_get_inode_info(struct inode **pinode, ...@@ -389,7 +389,7 @@ int cifs_get_inode_info(struct inode **pinode,
struct cifs_sb_info *cifs_sb = CIFS_SB(sb); struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
const unsigned char *full_path = NULL; const unsigned char *full_path = NULL;
char *buf = NULL; char *buf = NULL;
int adjustTZ = FALSE; bool adjustTZ = false;
bool is_dfs_referral = false; bool is_dfs_referral = false;
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
...@@ -425,7 +425,7 @@ int cifs_get_inode_info(struct inode **pinode, ...@@ -425,7 +425,7 @@ int cifs_get_inode_info(struct inode **pinode,
pfindData, cifs_sb->local_nls, pfindData, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
adjustTZ = TRUE; adjustTZ = true;
} }
} }
/* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */
...@@ -703,7 +703,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) ...@@ -703,7 +703,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
} else if (rc == -ENOENT) { } else if (rc == -ENOENT) {
d_drop(direntry); d_drop(direntry);
} else if (rc == -ETXTBSY) { } else if (rc == -ETXTBSY) {
int oplock = FALSE; int oplock = 0;
__u16 netfid; __u16 netfid;
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE,
...@@ -736,7 +736,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) ...@@ -736,7 +736,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
if (rc == -EOPNOTSUPP) { if (rc == -EOPNOTSUPP) {
int oplock = FALSE; int oplock = 0;
__u16 netfid; __u16 netfid;
/* rc = CIFSSMBSetAttrLegacy(xid, pTcon, /* rc = CIFSSMBSetAttrLegacy(xid, pTcon,
full_path, full_path,
...@@ -774,7 +774,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) ...@@ -774,7 +774,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
if (direntry->d_inode) if (direntry->d_inode)
drop_nlink(direntry->d_inode); drop_nlink(direntry->d_inode);
} else if (rc == -ETXTBSY) { } else if (rc == -ETXTBSY) {
int oplock = FALSE; int oplock = 0;
__u16 netfid; __u16 netfid;
rc = CIFSSMBOpen(xid, pTcon, full_path, rc = CIFSSMBOpen(xid, pTcon, full_path,
...@@ -1149,7 +1149,7 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry, ...@@ -1149,7 +1149,7 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
cFYI(1, ("rename rc %d", rc)); cFYI(1, ("rename rc %d", rc));
if ((rc == -EIO) || (rc == -EEXIST)) { if ((rc == -EIO) || (rc == -EEXIST)) {
int oplock = FALSE; int oplock = 0;
__u16 netfid; __u16 netfid;
/* BB FIXME Is Generic Read correct for rename? */ /* BB FIXME Is Generic Read correct for rename? */
...@@ -1186,7 +1186,7 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1186,7 +1186,7 @@ int cifs_revalidate(struct dentry *direntry)
struct cifsInodeInfo *cifsInode; struct cifsInodeInfo *cifsInode;
loff_t local_size; loff_t local_size;
struct timespec local_mtime; struct timespec local_mtime;
int invalidate_inode = FALSE; bool invalidate_inode = false;
if (direntry->d_inode == NULL) if (direntry->d_inode == NULL)
return -ENOENT; return -ENOENT;
...@@ -1268,7 +1268,7 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -1268,7 +1268,7 @@ int cifs_revalidate(struct dentry *direntry)
only ones who could have modified the file and the only ones who could have modified the file and the
server copy is staler than ours */ server copy is staler than ours */
} else { } else {
invalidate_inode = TRUE; invalidate_inode = true;
} }
} }
...@@ -1402,8 +1402,8 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -1402,8 +1402,8 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
int rc = -EACCES; int rc = -EACCES;
struct cifsFileInfo *open_file = NULL; struct cifsFileInfo *open_file = NULL;
FILE_BASIC_INFO time_buf; FILE_BASIC_INFO time_buf;
int set_time = FALSE; bool set_time = false;
int set_dosattr = FALSE; bool set_dosattr = false;
__u64 mode = 0xFFFFFFFFFFFFFFFFULL; __u64 mode = 0xFFFFFFFFFFFFFFFFULL;
__u64 uid = 0xFFFFFFFFFFFFFFFFULL; __u64 uid = 0xFFFFFFFFFFFFFFFFULL;
__u64 gid = 0xFFFFFFFFFFFFFFFFULL; __u64 gid = 0xFFFFFFFFFFFFFFFFULL;
...@@ -1464,7 +1464,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -1464,7 +1464,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
__u16 nfid = open_file->netfid; __u16 nfid = open_file->netfid;
__u32 npid = open_file->pid; __u32 npid = open_file->pid;
rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size, rc = CIFSSMBSetFileSize(xid, pTcon, attrs->ia_size,
nfid, npid, FALSE); nfid, npid, false);
atomic_dec(&open_file->wrtPending); atomic_dec(&open_file->wrtPending);
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)) {
...@@ -1484,14 +1484,14 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -1484,14 +1484,14 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
it was found or because there was an error setting it was found or because there was an error setting
it by handle */ it by handle */
rc = CIFSSMBSetEOF(xid, pTcon, full_path, rc = CIFSSMBSetEOF(xid, pTcon, full_path,
attrs->ia_size, FALSE, attrs->ia_size, false,
cifs_sb->local_nls, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR); CIFS_MOUNT_MAP_SPECIAL_CHR);
cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc)); cFYI(1, ("SetEOF by path (setattrs) rc = %d", rc));
if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) { if ((rc == -EINVAL) || (rc == -EOPNOTSUPP)) {
__u16 netfid; __u16 netfid;
int oplock = FALSE; int oplock = 0;
rc = SMBLegacyOpen(xid, pTcon, full_path, rc = SMBLegacyOpen(xid, pTcon, full_path,
FILE_OPEN, FILE_OPEN,
...@@ -1516,7 +1516,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -1516,7 +1516,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
/* Server is ok setting allocation size implicitly - no need /* Server is ok setting allocation size implicitly - no need
to call: to call:
CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size, TRUE, CIFSSMBSetEOF(xid, pTcon, full_path, attrs->ia_size, true,
cifs_sb->local_nls); cifs_sb->local_nls);
*/ */
...@@ -1564,7 +1564,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -1564,7 +1564,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
#endif #endif
/* not writeable */ /* not writeable */
if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) { if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) {
set_dosattr = TRUE; set_dosattr = true;
time_buf.Attributes = time_buf.Attributes =
cpu_to_le32(cifsInode->cifsAttrs | cpu_to_le32(cifsInode->cifsAttrs |
ATTR_READONLY); ATTR_READONLY);
...@@ -1574,28 +1574,24 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -1574,28 +1574,24 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
not be able to write to it - so if any write not be able to write to it - so if any write
bit is enabled for user or group or other we bit is enabled for user or group or other we
need to at least try to remove r/o dos attr */ need to at least try to remove r/o dos attr */
set_dosattr = TRUE; set_dosattr = true;
time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs & time_buf.Attributes = cpu_to_le32(cifsInode->cifsAttrs &
(~ATTR_READONLY)); (~ATTR_READONLY));
/* Windows ignores set to zero */ /* Windows ignores set to zero */
if (time_buf.Attributes == 0) if (time_buf.Attributes == 0)
time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL); time_buf.Attributes |= cpu_to_le32(ATTR_NORMAL);
} }
#ifdef CONFIG_CIFS_EXPERIMENTAL
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL)
mode_to_acl(direntry->d_inode, full_path, mode);
#endif
} }
if (attrs->ia_valid & ATTR_ATIME) { if (attrs->ia_valid & ATTR_ATIME) {
set_time = TRUE; set_time = true;
time_buf.LastAccessTime = time_buf.LastAccessTime =
cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_atime)); cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_atime));
} else } else
time_buf.LastAccessTime = 0; time_buf.LastAccessTime = 0;
if (attrs->ia_valid & ATTR_MTIME) { if (attrs->ia_valid & ATTR_MTIME) {
set_time = TRUE; set_time = true;
time_buf.LastWriteTime = time_buf.LastWriteTime =
cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_mtime)); cpu_to_le64(cifs_UnixTimeToNT(attrs->ia_mtime));
} else } else
...@@ -1606,7 +1602,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -1606,7 +1602,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
server times */ server times */
if (set_time && (attrs->ia_valid & ATTR_CTIME)) { if (set_time && (attrs->ia_valid & ATTR_CTIME)) {
set_time = TRUE; set_time = true;
/* Although Samba throws this field away /* Although Samba throws this field away
it may be useful to Windows - but we do it may be useful to Windows - but we do
not want to set ctime unless some other not want to set ctime unless some other
...@@ -1630,7 +1626,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -1630,7 +1626,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
rc = -EOPNOTSUPP; rc = -EOPNOTSUPP;
if (rc == -EOPNOTSUPP) { if (rc == -EOPNOTSUPP) {
int oplock = FALSE; int oplock = 0;
__u16 netfid; __u16 netfid;
cFYI(1, ("calling SetFileInfo since SetPathInfo for " cFYI(1, ("calling SetFileInfo since SetPathInfo for "
......
...@@ -230,7 +230,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) ...@@ -230,7 +230,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
struct inode *inode = direntry->d_inode; struct inode *inode = direntry->d_inode;
int rc = -EACCES; int rc = -EACCES;
int xid; int xid;
int oplock = FALSE; int oplock = 0;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
char *full_path = NULL; char *full_path = NULL;
......
...@@ -496,7 +496,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) ...@@ -496,7 +496,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
} }
return 0; return 0;
} }
int
bool
is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) 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;
...@@ -522,17 +523,17 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -522,17 +523,17 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
pnotify->Action)); /* BB removeme BB */ pnotify->Action)); /* BB removeme BB */
/* cifs_dump_mem("Rcvd notify Data: ",buf, /* cifs_dump_mem("Rcvd notify Data: ",buf,
sizeof(struct smb_hdr)+60); */ sizeof(struct smb_hdr)+60); */
return TRUE; return true;
} }
if (pSMBr->hdr.Status.CifsError) { if (pSMBr->hdr.Status.CifsError) {
cFYI(1, ("notify err 0x%d", cFYI(1, ("notify err 0x%d",
pSMBr->hdr.Status.CifsError)); pSMBr->hdr.Status.CifsError));
return TRUE; return true;
} }
return FALSE; return false;
} }
if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX)
return FALSE; return false;
if (pSMB->hdr.Flags & SMBFLG_RESPONSE) { if (pSMB->hdr.Flags & SMBFLG_RESPONSE) {
/* no sense logging error on invalid handle on oplock /* no sense logging error on invalid handle on oplock
break - harmless race between close request and oplock break - harmless race between close request and oplock
...@@ -541,21 +542,21 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -541,21 +542,21 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
if ((NT_STATUS_INVALID_HANDLE) == if ((NT_STATUS_INVALID_HANDLE) ==
le32_to_cpu(pSMB->hdr.Status.CifsError)) { le32_to_cpu(pSMB->hdr.Status.CifsError)) {
cFYI(1, ("invalid handle on oplock break")); cFYI(1, ("invalid handle on oplock break"));
return TRUE; return true;
} else if (ERRbadfid == } else if (ERRbadfid ==
le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { le16_to_cpu(pSMB->hdr.Status.DosError.Error)) {
return TRUE; return true;
} else { } else {
return FALSE; /* on valid oplock brk we get "request" */ return false; /* on valid oplock brk we get "request" */
} }
} }
if (pSMB->hdr.WordCount != 8) if (pSMB->hdr.WordCount != 8)
return FALSE; return false;
cFYI(1, ("oplock type 0x%d level 0x%d", cFYI(1, ("oplock type 0x%d level 0x%d",
pSMB->LockType, pSMB->OplockLevel)); pSMB->LockType, pSMB->OplockLevel));
if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE))
return FALSE; return false;
/* look up tcon based on tid & uid */ /* look up tcon based on tid & uid */
read_lock(&GlobalSMBSeslock); read_lock(&GlobalSMBSeslock);
...@@ -573,11 +574,11 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -573,11 +574,11 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
("file id match, oplock break")); ("file id match, oplock break"));
pCifsInode = pCifsInode =
CIFS_I(netfile->pInode); CIFS_I(netfile->pInode);
pCifsInode->clientCanCacheAll = FALSE; pCifsInode->clientCanCacheAll = false;
if (pSMB->OplockLevel == 0) if (pSMB->OplockLevel == 0)
pCifsInode->clientCanCacheRead pCifsInode->clientCanCacheRead
= FALSE; = false;
pCifsInode->oplockPending = TRUE; pCifsInode->oplockPending = true;
AllocOplockQEntry(netfile->pInode, AllocOplockQEntry(netfile->pInode,
netfile->netfid, netfile->netfid,
tcon); tcon);
...@@ -585,17 +586,17 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) ...@@ -585,17 +586,17 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
("about to wake up oplock thread")); ("about to wake up oplock thread"));
if (oplockThread) if (oplockThread)
wake_up_process(oplockThread); wake_up_process(oplockThread);
return TRUE; return true;
} }
} }
read_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
cFYI(1, ("No matching file for oplock break")); cFYI(1, ("No matching file for oplock break"));
return TRUE; return true;
} }
} }
read_unlock(&GlobalSMBSeslock); read_unlock(&GlobalSMBSeslock);
cFYI(1, ("Can not process oplock break for non-existent connection")); cFYI(1, ("Can not process oplock break for non-existent connection"));
return TRUE; return true;
} }
void void
......
...@@ -132,47 +132,17 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = { ...@@ -132,47 +132,17 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
{0, 0} {0, 0}
}; };
/* if the mount helper is missing we need to reverse the 1st slash
from '/' to backslash in order to format the UNC properly for
ip address parsing and for tree connect (unless the user
remembered to put the UNC name in properly). Fortunately we do
not have to call this twice (we check for IPv4 addresses
first, so it is already converted by the time we
try IPv6 addresses */
static int canonicalize_unc(char *cp)
{
int i;
for (i = 0; i <= 46 /* INET6_ADDRSTRLEN */ ; i++) {
if (cp[i] == 0)
break;
if (cp[i] == '\\')
break;
if (cp[i] == '/') {
cFYI(DBG2, ("change slash to \\ in malformed UNC"));
cp[i] = '\\';
return 1;
}
}
return 0;
}
/* Convert string containing dotted ip address to binary form */ /* Convert string containing dotted ip address to binary form */
/* returns 0 if invalid address */ /* returns 0 if invalid address */
int int
cifs_inet_pton(int address_family, char *cp, void *dst) cifs_inet_pton(const int address_family, const char *cp, void *dst)
{ {
int ret = 0; int ret = 0;
/* calculate length by finding first slash or NULL */ /* calculate length by finding first slash or NULL */
if (address_family == AF_INET) { if (address_family == AF_INET) {
ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL); ret = in4_pton(cp, -1 /* len */, dst, '\\', NULL);
if (ret == 0) {
if (canonicalize_unc(cp))
ret = in4_pton(cp, -1, dst, '\\', NULL);
}
} 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);
} }
......
...@@ -447,8 +447,8 @@ static int initiate_cifs_search(const int xid, struct file *file) ...@@ -447,8 +447,8 @@ static int initiate_cifs_search(const int xid, struct file *file)
if (file->private_data == NULL) if (file->private_data == NULL)
return -ENOMEM; return -ENOMEM;
cifsFile = file->private_data; cifsFile = file->private_data;
cifsFile->invalidHandle = TRUE; cifsFile->invalidHandle = true;
cifsFile->srch_inf.endOfSearch = FALSE; cifsFile->srch_inf.endOfSearch = false;
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
if (cifs_sb == NULL) if (cifs_sb == NULL)
...@@ -485,7 +485,7 @@ static int initiate_cifs_search(const int xid, struct file *file) ...@@ -485,7 +485,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
cifs_sb->mnt_cifs_flags & cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb));
if (rc == 0) if (rc == 0)
cifsFile->invalidHandle = FALSE; cifsFile->invalidHandle = false;
if ((rc == -EOPNOTSUPP) && if ((rc == -EOPNOTSUPP) &&
(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) { (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) {
cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
...@@ -670,7 +670,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -670,7 +670,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
(index_to_find < first_entry_in_buffer)) { (index_to_find < first_entry_in_buffer)) {
/* close and restart search */ /* close and restart search */
cFYI(1, ("search backing up - close and restart search")); cFYI(1, ("search backing up - close and restart search"));
cifsFile->invalidHandle = TRUE; cifsFile->invalidHandle = true;
CIFSFindClose(xid, pTcon, cifsFile->netfid); CIFSFindClose(xid, pTcon, cifsFile->netfid);
kfree(cifsFile->search_resume_name); kfree(cifsFile->search_resume_name);
cifsFile->search_resume_name = NULL; cifsFile->search_resume_name = NULL;
...@@ -692,7 +692,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -692,7 +692,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
} }
while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) &&
(rc == 0) && (cifsFile->srch_inf.endOfSearch == FALSE)) { (rc == 0) && !cifsFile->srch_inf.endOfSearch) {
cFYI(1, ("calling findnext2")); cFYI(1, ("calling findnext2"));
rc = CIFSFindNext(xid, pTcon, cifsFile->netfid, rc = CIFSFindNext(xid, pTcon, cifsFile->netfid,
&cifsFile->srch_inf); &cifsFile->srch_inf);
...@@ -1038,7 +1038,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1038,7 +1038,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
break; break;
} }
} /* else { } /* else {
cifsFile->invalidHandle = TRUE; cifsFile->invalidHandle = true;
CIFSFindClose(xid, pTcon, cifsFile->netfid); CIFSFindClose(xid, pTcon, cifsFile->netfid);
} }
kfree(cifsFile->search_resume_name); kfree(cifsFile->search_resume_name);
......
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
#include "cifs_debug.h" #include "cifs_debug.h"
#include "cifsencrypt.h" #include "cifsencrypt.h"
#ifndef FALSE #ifndef false
#define FALSE 0 #define false 0
#endif #endif
#ifndef TRUE #ifndef true
#define TRUE 1 #define true 1
#endif #endif
/* following came from the other byteorder.h to avoid include conflicts */ /* following came from the other byteorder.h to avoid include conflicts */
......
...@@ -264,7 +264,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name, ...@@ -264,7 +264,7 @@ ssize_t cifs_getxattr(struct dentry *direntry, const char *ea_name,
#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 = 0;
struct cifs_ntsd *pacl = NULL; struct cifs_ntsd *pacl = NULL;
__u32 buflen = 0; __u32 buflen = 0;
if (experimEnabled) if (experimEnabled)
......
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