Commit 3870253e authored by Steve French's avatar Steve French

[CIFS] more whitespace fixes

Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 790fe579
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* Error mapping routines from Samba libsmb/errormap.c * Error mapping routines from Samba libsmb/errormap.c
* Copyright (C) Andrew Tridgell 2001 * Copyright (C) Andrew Tridgell 2001
* *
*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
...@@ -67,22 +66,22 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = { ...@@ -67,22 +66,22 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
{ERRbadshare, -ETXTBSY}, {ERRbadshare, -ETXTBSY},
{ERRlock, -EACCES}, {ERRlock, -EACCES},
{ERRunsup, -EINVAL}, {ERRunsup, -EINVAL},
{ERRnosuchshare,-ENXIO}, {ERRnosuchshare, -ENXIO},
{ERRfilexists, -EEXIST}, {ERRfilexists, -EEXIST},
{ERRinvparm, -EINVAL}, {ERRinvparm, -EINVAL},
{ERRdiskfull, -ENOSPC}, {ERRdiskfull, -ENOSPC},
{ERRinvname, -ENOENT}, {ERRinvname, -ENOENT},
{ERRinvlevel,-EOPNOTSUPP}, {ERRinvlevel, -EOPNOTSUPP},
{ERRdirnotempty, -ENOTEMPTY}, {ERRdirnotempty, -ENOTEMPTY},
{ERRnotlocked, -ENOLCK}, {ERRnotlocked, -ENOLCK},
{ERRcancelviolation, -ENOLCK}, {ERRcancelviolation, -ENOLCK},
{ERRalreadyexists, -EEXIST}, {ERRalreadyexists, -EEXIST},
{ERRmoredata, -EOVERFLOW}, {ERRmoredata, -EOVERFLOW},
{ERReasnotsupported,-EOPNOTSUPP}, {ERReasnotsupported, -EOPNOTSUPP},
{ErrQuota, -EDQUOT}, {ErrQuota, -EDQUOT},
{ErrNotALink, -ENOLINK}, {ErrNotALink, -ENOLINK},
{ERRnetlogonNotStarted,-ENOPROTOOPT}, {ERRnetlogonNotStarted, -ENOPROTOOPT},
{ErrTooManyLinks,-EMLINK}, {ErrTooManyLinks, -EMLINK},
{0, 0} {0, 0}
}; };
...@@ -133,13 +132,13 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = { ...@@ -133,13 +132,13 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
/* 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(int address_family, 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 */
/* BB Should we convert '/' slash to '\' here since it seems already done /* BB Should we convert '/' slash to '\' here since it seems already
before this */ * done before this */
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);
} else if ( address_family == AF_INET6 ) { } else if ( address_family == AF_INET6 ) {
...@@ -332,8 +331,8 @@ static const struct { ...@@ -332,8 +331,8 @@ static const struct {
ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, { ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, {
ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED}, ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED},
/* { This NT error code was 'sqashed' /* { This NT error code was 'sqashed'
from NT_STATUS_INSUFFICIENT_RESOURCES to NT_STATUS_INSUFF_SERVER_RESOURCES from NT_STATUS_INSUFFICIENT_RESOURCES to
during the session setup } */ NT_STATUS_INSUFF_SERVER_RESOURCES during the session setup } */
{ {
ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, { ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, {
ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, { ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, {
...@@ -577,8 +576,8 @@ static const struct { ...@@ -577,8 +576,8 @@ static const struct {
ERRDOS, 19, NT_STATUS_TOO_LATE}, { ERRDOS, 19, NT_STATUS_TOO_LATE}, {
ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET}, ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET},
/* { This NT error code was 'sqashed' /* { This NT error code was 'sqashed'
from NT_STATUS_NO_TRUST_SAM_ACCOUNT to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE from NT_STATUS_NO_TRUST_SAM_ACCOUNT to
during the session setup } */ NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE during the session setup } */
{ {
ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, { ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, {
ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, { ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, {
...@@ -728,7 +727,7 @@ cifs_print_status(__u32 status_code) ...@@ -728,7 +727,7 @@ cifs_print_status(__u32 status_code)
if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) == if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) ==
(status_code & 0xFFFFFF)) { (status_code & 0xFFFFFF)) {
printk(KERN_NOTICE "Status code returned 0x%08x %s\n", printk(KERN_NOTICE "Status code returned 0x%08x %s\n",
status_code,nt_errs[idx].nt_errstr); status_code, nt_errs[idx].nt_errstr);
} }
idx++; idx++;
} }
...@@ -771,7 +770,8 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -771,7 +770,8 @@ map_smb_to_linux_error(struct smb_hdr *smb)
return 0; return 0;
if (smb->Flags2 & SMBFLG2_ERR_STATUS) { if (smb->Flags2 & SMBFLG2_ERR_STATUS) {
/* translate the newer STATUS codes to old style errors and then to POSIX errors */ /* translate the newer STATUS codes to old style SMB errors
* and then to POSIX errors */
__u32 err = le32_to_cpu(smb->Status.CifsError); __u32 err = le32_to_cpu(smb->Status.CifsError);
if (cifsFYI & CIFS_RC) if (cifsFYI & CIFS_RC)
cifs_print_status(err); cifs_print_status(err);
...@@ -784,7 +784,7 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -784,7 +784,7 @@ map_smb_to_linux_error(struct smb_hdr *smb)
/* old style errors */ /* old style errors */
/* DOS class smb error codes - map DOS */ /* DOS class smb error codes - map DOS */
if (smberrclass == ERRDOS) { /* one 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) /
...@@ -795,7 +795,7 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -795,7 +795,7 @@ map_smb_to_linux_error(struct smb_hdr *smb)
rc = mapping_table_ERRDOS[i].posix_code; rc = mapping_table_ERRDOS[i].posix_code;
break; break;
} }
/* else try the next error mapping one to see if it will 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;
...@@ -808,14 +808,16 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -808,14 +808,16 @@ map_smb_to_linux_error(struct smb_hdr *smb)
rc = mapping_table_ERRSRV[i].posix_code; rc = mapping_table_ERRSRV[i].posix_code;
break; break;
} }
/* else try the next error mapping one to see if it will match */ /* else try next error mapping to see if match */
} }
} }
/* else ERRHRD class errors or junk - return EIO */ /* else ERRHRD class errors or junk - return EIO */
cFYI(1, (" !!Mapping smb error code %d to POSIX err %d !!", smberrcode,rc)); cFYI(1, (" !!Mapping smb error code %d to POSIX err %d !!",
smberrcode, rc));
/* generic corrective action e.g. reconnect SMB session on ERRbaduid could be added */ /* generic corrective action e.g. reconnect SMB session on
* ERRbaduid could be added */
return rc; return rc;
} }
...@@ -885,20 +887,20 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time) ...@@ -885,20 +887,20 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
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));
sec = 2 * st->TwoSeconds; sec = 2 * st->TwoSeconds;
min = st->Minutes; min = st->Minutes;
if ((sec > 59) || (min > 59)) if ((sec > 59) || (min > 59))
cERROR(1,("illegal time min %d sec %d", min, sec)); cERROR(1, ("illegal time min %d sec %d", min, sec));
sec += (min * 60); sec += (min * 60);
sec += 60 * 60 * st->Hours; sec += 60 * 60 * st->Hours;
if (st->Hours > 24) if (st->Hours > 24)
cERROR(1,("illegal hours %d",st->Hours)); cERROR(1, ("illegal hours %d", st->Hours));
days = sd->Day; days = sd->Day;
month = sd->Month; month = sd->Month;
if ((days > 31) || (month > 12)) if ((days > 31) || (month > 12))
cERROR(1,("illegal date, month %d day: %d", month, days)); cERROR(1, ("illegal date, month %d day: %d", month, days));
month -= 1; month -= 1;
days += total_days_of_prev_months[month]; days += total_days_of_prev_months[month];
days += 3652; /* account for difference in days between 1980 and 1970 */ days += 3652; /* account for difference in days between 1980 and 1970 */
......
...@@ -431,14 +431,14 @@ static void unix_fill_in_inode(struct inode *tmp_inode, ...@@ -431,14 +431,14 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
static int initiate_cifs_search(const int xid, struct file *file) static int initiate_cifs_search(const int xid, struct file *file)
{ {
int rc = 0; int rc = 0;
char * full_path; char *full_path;
struct cifsFileInfo * cifsFile; struct cifsFileInfo *cifsFile;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
if (file->private_data == NULL) { if (file->private_data == NULL) {
file->private_data = file->private_data =
kzalloc(sizeof(struct cifsFileInfo),GFP_KERNEL); kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
} }
if (file->private_data == NULL) if (file->private_data == NULL)
...@@ -476,7 +476,7 @@ ffirst_retry: ...@@ -476,7 +476,7 @@ ffirst_retry:
cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO; cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO;
} }
rc = CIFSFindFirst(xid, pTcon,full_path,cifs_sb->local_nls, rc = CIFSFindFirst(xid, pTcon, full_path, cifs_sb->local_nls,
&cifsFile->netfid, &cifsFile->srch_inf, &cifsFile->netfid, &cifsFile->srch_inf,
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));
...@@ -497,7 +497,7 @@ static int cifs_unicode_bytelen(char *str) ...@@ -497,7 +497,7 @@ static int cifs_unicode_bytelen(char *str)
int len; int len;
__le16 * ustr = (__le16 *)str; __le16 * ustr = (__le16 *)str;
for(len=0;len <= PATH_MAX;len++) { for (len = 0; len <= PATH_MAX; len++) {
if (ustr[len] == 0) if (ustr[len] == 0)
return len << 1; return len << 1;
} }
...@@ -507,7 +507,7 @@ static int cifs_unicode_bytelen(char *str) ...@@ -507,7 +507,7 @@ 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) {
...@@ -526,10 +526,10 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) ...@@ -526,10 +526,10 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
new_entry, end_of_smb, old_entry)); new_entry, end_of_smb, old_entry));
return NULL; return NULL;
} else if (((level == SMB_FIND_FILE_INFO_STANDARD) && } else if (((level == SMB_FIND_FILE_INFO_STANDARD) &&
(new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb)) || (new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb))
((level != SMB_FIND_FILE_INFO_STANDARD) && || ((level != SMB_FIND_FILE_INFO_STANDARD) &&
(new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) { (new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) {
cERROR(1,("search entry %p extends after end of SMB %p", cERROR(1, ("search entry %p extends after end of SMB %p",
new_entry, end_of_smb)); new_entry, end_of_smb));
return NULL; return NULL;
} else } else
...@@ -543,7 +543,7 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) ...@@ -543,7 +543,7 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
{ {
int rc = 0; int rc = 0;
char * filename = NULL; char *filename = NULL;
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) {
...@@ -598,7 +598,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) ...@@ -598,7 +598,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
} else if (len == 4) { } else if (len == 4) {
/* check for .. */ /* check for .. */
if ((ufilename[0] == UNICODE_DOT) if ((ufilename[0] == UNICODE_DOT)
&&(ufilename[1] == UNICODE_DOT)) && (ufilename[1] == UNICODE_DOT))
rc = 2; rc = 2;
} }
} else /* ASCII */ { } else /* ASCII */ {
...@@ -617,7 +617,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) ...@@ -617,7 +617,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
/* Check if directory that we are searching has changed so we can decide /* Check if directory that we are searching has changed so we can decide
whether we can use the cached search results from the previous search */ whether we can use the cached search results from the previous search */
static int is_dir_changed(struct file * file) static int is_dir_changed(struct file *file)
{ {
struct inode *inode = file->f_path.dentry->d_inode; struct inode *inode = file->f_path.dentry->d_inode;
struct cifsInodeInfo *cifsInfo = CIFS_I(inode); struct cifsInodeInfo *cifsInfo = CIFS_I(inode);
...@@ -642,7 +642,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -642,7 +642,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
int pos_in_buf = 0; int pos_in_buf = 0;
loff_t first_entry_in_buffer; loff_t first_entry_in_buffer;
loff_t index_to_find = file->f_pos; loff_t index_to_find = file->f_pos;
struct cifsFileInfo * cifsFile = file->private_data; struct cifsFileInfo *cifsFile = file->private_data;
/* check if index in the buffer */ /* check if index in the buffer */
if ((cifsFile == NULL) || (ppCurrentEntry == NULL) || if ((cifsFile == NULL) || (ppCurrentEntry == NULL) ||
...@@ -681,7 +681,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -681,7 +681,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
cifs_buf_release(cifsFile->srch_inf. cifs_buf_release(cifsFile->srch_inf.
ntwrk_buf_start); ntwrk_buf_start);
} }
rc = initiate_cifs_search(xid,file); rc = initiate_cifs_search(xid, file);
if (rc) { if (rc) {
cFYI(1, ("error %d reinitiating a search on rewind", cFYI(1, ("error %d reinitiating a search on rewind",
rc)); rc));
...@@ -689,10 +689,10 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -689,10 +689,10 @@ 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 == FALSE)) {
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);
if (rc) if (rc)
return -ENOENT; return -ENOENT;
...@@ -701,8 +701,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -701,8 +701,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
/* we found the buffer that contains the entry */ /* we found the buffer that contains the entry */
/* scan and find it */ /* scan and find it */
int i; int i;
char * current_entry; char *current_entry;
char * end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + char *end_of_smb = cifsFile->srch_inf.ntwrk_buf_start +
smbCalcSize((struct smb_hdr *) smbCalcSize((struct smb_hdr *)
cifsFile->srch_inf.ntwrk_buf_start); cifsFile->srch_inf.ntwrk_buf_start);
...@@ -712,16 +712,16 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -712,16 +712,16 @@ 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);
} }
if ((current_entry == NULL) && (i < pos_in_buf)) { if ((current_entry == NULL) && (i < pos_in_buf)) {
/* BB fixme - check if we should flag this error */ /* BB fixme - check if we should flag this error */
cERROR(1,("reached end of buf searching for pos in buf" cERROR(1, ("reached end of buf searching for pos in buf"
" %d index to find %lld rc %d", " %d index to find %lld rc %d",
pos_in_buf,index_to_find,rc)); pos_in_buf, index_to_find, rc));
} }
rc = 0; rc = 0;
*ppCurrentEntry = current_entry; *ppCurrentEntry = current_entry;
...@@ -742,17 +742,17 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, ...@@ -742,17 +742,17 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
/* inode num, inode type and filename returned */ /* inode num, inode type and filename returned */
static int cifs_get_name_from_search_buf(struct qstr *pqst, static int cifs_get_name_from_search_buf(struct qstr *pqst,
char *current_entry, __u16 level, unsigned int unicode, char *current_entry, __u16 level, unsigned int unicode,
struct cifs_sb_info * cifs_sb, int max_len, ino_t *pinum) struct cifs_sb_info *cifs_sb, int max_len, ino_t *pinum)
{ {
int rc = 0; int rc = 0;
unsigned int len = 0; unsigned int len = 0;
char * filename; char *filename;
struct nls_table * nlt = cifs_sb->local_nls; struct nls_table *nlt = cifs_sb->local_nls;
*pinum = 0; *pinum = 0;
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 (unicode) { if (unicode) {
...@@ -762,27 +762,27 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst, ...@@ -762,27 +762,27 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
len = strnlen(filename, PATH_MAX); len = strnlen(filename, PATH_MAX);
} }
/* BB fixme - hash low and high 32 bits if not 64 bit arch BB fixme */ /* BB fixme - hash low and high 32 bits if not 64 bit arch BB */
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
*pinum = pFindData->UniqueId; *pinum = pFindData->UniqueId;
} else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { } else if (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 (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { } else if (level == 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 (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { } else if (level == 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);
*pinum = pFindData->UniqueId; *pinum = pFindData->UniqueId;
} else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { } else if (level == 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);
...@@ -798,7 +798,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst, ...@@ -798,7 +798,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
} }
if (len > max_len) { if (len > max_len) {
cERROR(1,("bad search response length %d past smb end", len)); cERROR(1, ("bad search response length %d past smb end", len));
return -EINVAL; return -EINVAL;
} }
...@@ -810,12 +810,12 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst, ...@@ -810,12 +810,12 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
(__le16 *)filename, len/2, nlt); (__le16 *)filename, len/2, nlt);
else else
pqst->len = cifs_strfromUCS_le((char *)pqst->name, pqst->len = cifs_strfromUCS_le((char *)pqst->name,
(__le16 *)filename,len/2,nlt); (__le16 *)filename, len/2, nlt);
} else { } else {
pqst->name = filename; pqst->name = filename;
pqst->len = len; pqst->len = len;
} }
pqst->hash = full_name_hash(pqst->name,pqst->len); pqst->hash = full_name_hash(pqst->name, pqst->len);
/* cFYI(1, ("filldir on %s",pqst->name)); */ /* cFYI(1, ("filldir on %s",pqst->name)); */
return rc; return rc;
} }
...@@ -825,10 +825,10 @@ static int cifs_filldir(char *pfindEntry, struct file *file, ...@@ -825,10 +825,10 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
{ {
int rc = 0; int rc = 0;
struct qstr qstring; struct qstr qstring;
struct cifsFileInfo * pCifsF; struct cifsFileInfo *pCifsF;
unsigned obj_type; unsigned obj_type;
ino_t inum; ino_t inum;
struct cifs_sb_info * cifs_sb; struct cifs_sb_info *cifs_sb;
struct inode *tmp_inode; struct inode *tmp_inode;
struct dentry *tmp_dentry; struct dentry *tmp_dentry;
...@@ -843,7 +843,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file, ...@@ -843,7 +843,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
if ((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL)) if ((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL))
return -ENOENT; return -ENOENT;
rc = cifs_entry_is_dot(pfindEntry,pCifsF); rc = cifs_entry_is_dot(pfindEntry, pCifsF);
/* skip . and .. since we added them first */ /* skip . and .. since we added them first */
if (rc != 0) if (rc != 0)
return 0; return 0;
...@@ -851,23 +851,24 @@ static int cifs_filldir(char *pfindEntry, struct file *file, ...@@ -851,23 +851,24 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
qstring.name = scratch_buf; qstring.name = scratch_buf;
rc = cifs_get_name_from_search_buf(&qstring,pfindEntry, rc = cifs_get_name_from_search_buf(&qstring, pfindEntry,
pCifsF->srch_inf.info_level, pCifsF->srch_inf.info_level,
pCifsF->srch_inf.unicode,cifs_sb, pCifsF->srch_inf.unicode, cifs_sb,
max_len, max_len,
&inum /* returned */); &inum /* returned */);
if (rc) if (rc)
return rc; return rc;
rc = construct_dentry(&qstring,file,&tmp_inode, &tmp_dentry); rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry);
if ((tmp_inode == NULL) || (tmp_dentry == NULL)) if ((tmp_inode == NULL) || (tmp_dentry == NULL))
return -ENOMEM; return -ENOMEM;
if (rc) { if (rc) {
/* inode created, we need to hash it with right inode number */ /* inode created, we need to hash it with right inode number */
if (inum != 0) { if (inum != 0) {
/* BB fixme - hash the 2 32 quantities bits together if necessary BB */ /* BB fixme - hash the 2 32 quantities bits together if
* necessary BB */
tmp_inode->i_ino = inum; tmp_inode->i_ino = inum;
} }
insert_inode_hash(tmp_inode); insert_inode_hash(tmp_inode);
...@@ -893,8 +894,8 @@ static int cifs_filldir(char *pfindEntry, struct file *file, ...@@ -893,8 +894,8 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
} }
rc = filldir(direntry,qstring.name,qstring.len,file->f_pos, rc = filldir(direntry, qstring.name, qstring.len, file->f_pos,
tmp_inode->i_ino,obj_type); tmp_inode->i_ino, obj_type);
if (rc) { if (rc) {
cFYI(1, ("filldir rc = %d", rc)); cFYI(1, ("filldir rc = %d", rc));
/* we can not return filldir errors to the caller /* we can not return filldir errors to the caller
...@@ -913,7 +914,7 @@ static int cifs_save_resume_key(const char *current_entry, ...@@ -913,7 +914,7 @@ static int cifs_save_resume_key(const char *current_entry,
int rc = 0; int rc = 0;
unsigned int len = 0; unsigned int len = 0;
__u16 level; __u16 level;
char * filename; char *filename;
if ((cifsFile == NULL) || (current_entry == NULL)) if ((cifsFile == NULL) || (current_entry == NULL))
return -EINVAL; return -EINVAL;
...@@ -932,31 +933,31 @@ static int cifs_save_resume_key(const char *current_entry, ...@@ -932,31 +933,31 @@ static int cifs_save_resume_key(const char *current_entry,
} }
cifsFile->srch_inf.resume_key = pFindData->ResumeKey; cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
} else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { } else if (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);
cifsFile->srch_inf.resume_key = pFindData->FileIndex; cifsFile->srch_inf.resume_key = pFindData->FileIndex;
} else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { } else if (level == 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);
cifsFile->srch_inf.resume_key = pFindData->FileIndex; cifsFile->srch_inf.resume_key = pFindData->FileIndex;
} else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { } else if (level == 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);
cifsFile->srch_inf.resume_key = pFindData->FileIndex; cifsFile->srch_inf.resume_key = pFindData->FileIndex;
} else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { } else if (level == 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);
cifsFile->srch_inf.resume_key = pFindData->FileIndex; cifsFile->srch_inf.resume_key = pFindData->FileIndex;
} 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 */
...@@ -974,13 +975,13 @@ static int cifs_save_resume_key(const char *current_entry, ...@@ -974,13 +975,13 @@ static int cifs_save_resume_key(const char *current_entry,
int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
{ {
int rc = 0; int rc = 0;
int xid,i; int xid, i;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
struct cifsFileInfo *cifsFile = NULL; struct cifsFileInfo *cifsFile = NULL;
char * current_entry; char *current_entry;
int num_to_fill = 0; int num_to_fill = 0;
char * tmp_buf = NULL; char *tmp_buf = NULL;
char * end_of_smb; char * end_of_smb;
int max_len; int max_len;
...@@ -1015,7 +1016,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1015,7 +1016,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
if after then keep searching till find it */ if after then keep searching till find it */
if (file->private_data == NULL) { if (file->private_data == NULL) {
rc = initiate_cifs_search(xid,file); rc = initiate_cifs_search(xid, file);
cFYI(1, ("initiate cifs search rc %d", rc)); cFYI(1, ("initiate cifs search rc %d", rc));
if (rc) { if (rc) {
FreeXid(xid); FreeXid(xid);
...@@ -1041,8 +1042,8 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1041,8 +1042,8 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
kfree(cifsFile->search_resume_name); kfree(cifsFile->search_resume_name);
cifsFile->search_resume_name = NULL; */ cifsFile->search_resume_name = NULL; */
rc = find_cifs_entry(xid,pTcon, file, rc = find_cifs_entry(xid, pTcon, file,
&current_entry,&num_to_fill); &current_entry, &num_to_fill);
if (rc) { if (rc) {
cFYI(1, ("fce error %d", rc)); cFYI(1, ("fce error %d", rc));
goto rddir2_exit; goto rddir2_exit;
......
...@@ -75,7 +75,7 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB) ...@@ -75,7 +75,7 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
return capabilities; return capabilities;
} }
static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses, static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
char *bcc_ptr = *pbcc_area; char *bcc_ptr = *pbcc_area;
...@@ -130,7 +130,7 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses, ...@@ -130,7 +130,7 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
*pbcc_area = bcc_ptr; *pbcc_area = bcc_ptr;
} }
static void ascii_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses, static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
const struct nls_table *nls_cp) const struct nls_table *nls_cp)
{ {
char *bcc_ptr = *pbcc_area; char *bcc_ptr = *pbcc_area;
...@@ -468,7 +468,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time, ...@@ -468,7 +468,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
/* memcpy(bcc_ptr, (char *)ntlm_session_key,LM2_SESS_KEY_SIZE); /* memcpy(bcc_ptr, (char *)ntlm_session_key,LM2_SESS_KEY_SIZE);
bcc_ptr += LM2_SESS_KEY_SIZE; */ bcc_ptr += LM2_SESS_KEY_SIZE; */
memcpy(bcc_ptr, (char *)v2_sess_key, sizeof(struct ntlmv2_resp)); memcpy(bcc_ptr, (char *)v2_sess_key,
sizeof(struct ntlmv2_resp));
bcc_ptr += sizeof(struct ntlmv2_resp); bcc_ptr += sizeof(struct ntlmv2_resp);
kfree(v2_sess_key); kfree(v2_sess_key);
if (ses->capabilities & CAP_UNICODE) { if (ses->capabilities & CAP_UNICODE) {
......
...@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = { ...@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = {
}; };
static void static void
permute(char *out, char *in, uchar * p, int n) permute(char *out, char *in, uchar *p, int n)
{ {
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
...@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw) ...@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw)
char *rl; char *rl;
/* Have to reduce stack usage */ /* Have to reduce stack usage */
pk1 = kmalloc(56+56+64+64,GFP_KERNEL); pk1 = kmalloc(56+56+64+64, GFP_KERNEL);
if(pk1 == NULL) if (pk1 == NULL)
return; return;
ki = kmalloc(16*48, GFP_KERNEL); ki = kmalloc(16*48, GFP_KERNEL);
if(ki == NULL) { if (ki == NULL) {
kfree(pk1); kfree(pk1);
return; return;
} }
cd = pk1 + 56; cd = pk1 + 56;
pd1= cd + 56; pd1 = cd + 56;
rl = pd1 + 64; rl = pd1 + 64;
permute(pk1, key, perm1, 56); permute(pk1, key, perm1, 56);
...@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw) ...@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw)
char *r2; /* r2[32] */ char *r2; /* r2[32] */
er = kmalloc(48+48+32+32+32, GFP_KERNEL); er = kmalloc(48+48+32+32+32, GFP_KERNEL);
if(er == NULL) { if (er == NULL) {
kfree(pk1); kfree(pk1);
kfree(ki); kfree(ki);
return; return;
...@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw) ...@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
char *keyb; /* keyb[64] */ char *keyb; /* keyb[64] */
unsigned char key2[8]; unsigned char key2[8];
outb = kmalloc(64 * 3,GFP_KERNEL); outb = kmalloc(64 * 3, GFP_KERNEL);
if(outb == NULL) if (outb == NULL)
return; return;
inb = outb + 64; inb = outb + 64;
......
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