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

Commit 50c2f753 authored by Steve French's avatar Steve French
Browse files

[CIFS] whitespace/formatting fixes



This should be the last big batch of whitespace/formatting fixes.
checkpatch warnings for the cifs directory are down about 90% and
many of the remaining ones are harder to remove or make the code
harder to read.

Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 7521a3c5
Loading
Loading
Loading
Loading
+31 −26
Original line number Diff line number Diff line
@@ -498,7 +498,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
			return 0;
		} else if ((cls != ASN1_CTX) || (con != ASN1_CON)
			   || (tag != ASN1_EOC)) {
			cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 0",
			cFYI(1,
			     ("cls = %d con = %d tag = %d end = %p (%d) exit 0",
			      cls, con, tag, end, *end));
			return 0;
		}
@@ -508,7 +509,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
			return 0;
		} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
			   || (tag != ASN1_SEQ)) {
			cFYI(1,("cls = %d con = %d tag = %d end = %p (%d) exit 1",
			cFYI(1,
			     ("cls = %d con = %d tag = %d end = %p (%d) exit 1",
			      cls, con, tag, end, *end));
			return 0;
		}
@@ -540,32 +542,34 @@ decode_negTokenInit(unsigned char *security_blob, int length,
			rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
			if (!rc) {
				cFYI(1,
				     ("Error 1 decoding negTokenInit header exit 2"));
				     ("Error decoding negTokenInit hdr exit2"));
				return 0;
			}
			if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
				rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);
				if (rc) {
					cFYI(1,
					  ("OID len = %d oid = 0x%lx 0x%lx 0x%lx 0x%lx",
					   oidlen, *oid, *(oid + 1), *(oid + 2),
					   *(oid + 3)));
					rc = compare_oid(oid, oidlen, NTLMSSP_OID,
						 NTLMSSP_OID_LEN);
					  ("OID len = %d oid = 0x%lx 0x%lx "
					   "0x%lx 0x%lx",
					   oidlen, *oid, *(oid + 1),
					   *(oid + 2), *(oid + 3)));
					rc = compare_oid(oid, oidlen,
						 NTLMSSP_OID, NTLMSSP_OID_LEN);
					kfree(oid);
					if (rc)
						use_ntlmssp = TRUE;
				}
			} else {
				cFYI(1,("This should be an oid what is going on? "));
				cFYI(1, ("Should be an oid what is going on?"));
			}
		}

		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
			cFYI(1,
			     ("Error decoding last part of negTokenInit exit 3"));
			     ("Error decoding last part negTokenInit exit3"));
			return 0;
		} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {	/* tag = 3 indicating mechListMIC */
		} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
			/* tag = 3 indicating mechListMIC */
			cFYI(1,
			     ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
			      cls, con, tag, end, *end));
@@ -573,7 +577,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
		}
		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
			cFYI(1,
			     ("Error decoding last part of negTokenInit exit 5"));
			     ("Error decoding last part negTokenInit exit5"));
			return 0;
		} else if ((cls != ASN1_UNI) || (con != ASN1_CON)
			   || (tag != ASN1_SEQ)) {
@@ -584,7 +588,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,

		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
			cFYI(1,
			     ("Error decoding last part of negTokenInit exit 7"));
			     ("Error decoding last part negTokenInit exit 7"));
			return 0;
		} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
			cFYI(1,
@@ -594,7 +598,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
		}
		if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
			cFYI(1,
			     ("Error decoding last part of negTokenInit exit 9"));
			     ("Error decoding last part negTokenInit exit9"));
			return 0;
		} else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
			   || (tag != ASN1_GENSTR)) {
@@ -603,7 +607,8 @@ decode_negTokenInit(unsigned char *security_blob, int length,
			      cls, con, tag, end, *end));
			return 0;
		}
		cFYI(1, ("Need to call asn1_octets_decode() function for this %s", ctx.pointer));	/* is this UTF-8 or ASCII? */
		cFYI(1, ("Need to call asn1_octets_decode() function for %s",
			 ctx.pointer));	/* is this UTF-8 or ASCII? */
	}

	/* if (use_kerberos)
+0 −1
Original line number Diff line number Diff line
@@ -145,7 +145,6 @@ cifs_debug_data_read(char *buf, char **beginBuffer, off_t offset,
		   (ses->serverNOS == NULL)) {
			buf += sprintf(buf, "\nentry for %s not fully "
					"displayed\n\t", ses->serverName);
			
		} else {
			length =
			    sprintf(buf,
+64 −58
Original line number Diff line number Diff line
@@ -173,18 +173,20 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu,
			return 0;
	}

	/* BB what if signatures are supposed to be on for session but server does not
		send one? BB */
	/* BB what if signatures are supposed to be on for session but
	   server does not send one? BB */

	/* Do not need to verify session setups with signature "BSRSPYL "  */
	if (memcmp(cifs_pdu->Signature.SecuritySignature, "BSRSPYL ", 8) == 0)
		cFYI(1,("dummy signature received for smb command 0x%x",cifs_pdu->Command));
		cFYI(1, ("dummy signature received for smb command 0x%x",
			cifs_pdu->Command));

	/* save off the origiginal signature so we can modify the smb and check
		its signature against what the server sent */
	memcpy(server_response_sig, cifs_pdu->Signature.SecuritySignature, 8);

	cifs_pdu->Signature.Sequence.SequenceNumber = cpu_to_le32(expected_sequence_number);
	cifs_pdu->Signature.Sequence.SequenceNumber =
					cpu_to_le32(expected_sequence_number);
	cifs_pdu->Signature.Sequence.Reserved = 0;

	rc = cifs_calculate_signature(cifs_pdu, mac_key,
@@ -193,8 +195,8 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu,
	if (rc)
		return rc;

	
/*	cifs_dump_mem("what we think it should be: ",what_we_think_sig_should_be,16); */
/*	cifs_dump_mem("what we think it should be: ",
		      what_we_think_sig_should_be, 16); */

	if (memcmp(server_response_sig, what_we_think_sig_should_be, 8))
		return -EACCES;
@@ -254,14 +256,16 @@ int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses,
	for (i = 0; i < user_name_len; i++)
		ucase_buf[i] = nls_info->charset2upper[(int)ses->userName[i]];
	ucase_buf[i] = 0;
	user_name_len = cifs_strtoUCS(unicode_buf, ucase_buf, MAX_USERNAME_SIZE*2, nls_info);
	user_name_len = cifs_strtoUCS(unicode_buf, ucase_buf,
				      MAX_USERNAME_SIZE*2, nls_info);
	unicode_buf[user_name_len] = 0;
	user_name_len++;

	for (i = 0; i < dom_name_len; i++)
		ucase_buf[i] = nls_info->charset2upper[(int)ses->domainName[i]];
	ucase_buf[i] = 0;
	dom_name_len = cifs_strtoUCS(unicode_buf+user_name_len, ucase_buf, MAX_USERNAME_SIZE*2, nls_info);
	dom_name_len = cifs_strtoUCS(unicode_buf+user_name_len, ucase_buf,
				     MAX_USERNAME_SIZE*2, nls_info);

	unicode_buf[user_name_len + dom_name_len] = 0;
	hmac_md5_update((const unsigned char *) unicode_buf,
@@ -288,7 +292,8 @@ void calc_lanman_hash(struct cifsSesInfo * ses, char * lnm_session_key)

	if ((ses->server->secMode & SECMODE_PW_ENCRYPT) == 0)
		if (extended_security & CIFSSEC_MAY_PLNTXT) {
			memcpy(lnm_session_key, password_with_pad, CIFS_ENCPWD_SIZE); 
			memcpy(lnm_session_key, password_with_pad,
				CIFS_ENCPWD_SIZE);
			return;
		}

@@ -403,7 +408,8 @@ void setup_ntlmv2_rsp(struct cifsSesInfo * ses, char * resp_buf,
	ses->server->mac_signing_key.len = 16 + sizeof(struct ntlmv2_resp);
}

void CalcNTLMv2_response(const struct cifsSesInfo * ses, char * v2_session_response)
void CalcNTLMv2_response(const struct cifsSesInfo *ses,
			 char *v2_session_response)
{
	struct HMACMD5Context context;
	/* rest of v2 struct already generated */
+46 −45
Original line number Diff line number Diff line
@@ -448,8 +448,7 @@ static void cifs_umount_begin(struct vfsmount * vfsmnt, int flags)

	/* cancel_brl_requests(tcon); */ /* BB mark all brl mids as exiting */
	/* cancel_notify_requests(tcon); */
	if (tcon->ses && tcon->ses->server)
	{
	if (tcon->ses && tcon->ses->server) {
		cFYI(1, ("wake up tasks now - umount begin not complete"));
		wake_up_all(&tcon->ses->server->request_q);
		wake_up_all(&tcon->ses->server->response_q);
@@ -484,9 +483,10 @@ static const struct super_operations cifs_super_ops = {
	.alloc_inode = cifs_alloc_inode,
	.destroy_inode = cifs_destroy_inode,
/*	.drop_inode	    = generic_delete_inode,
	.delete_inode	= cifs_delete_inode,  *//* Do not need the above two functions     
   unless later we add lazy close of inodes or unless the kernel forgets to call
   us with the same number of releases (closes) as opens */
	.delete_inode	= cifs_delete_inode,  */  /* Do not need above two
	functions unless later we add lazy close of inodes or unless the
	kernel forgets to call us with the same number of releases (closes)
	as opens */
	.show_options = cifs_show_options,
	.umount_begin   = cifs_umount_begin,
	.remount_fs = cifs_remount,
@@ -878,7 +878,8 @@ static int cifs_oplock_thread(void * dummyarg)
				/* mutex_lock(&inode->i_mutex);*/
				if (S_ISREG(inode->i_mode)) {
					rc = filemap_fdatawrite(inode->i_mapping);
					if (CIFS_I(inode)->clientCanCacheRead == 0) {
					if (CIFS_I(inode)->clientCanCacheRead
									 == 0) {
						filemap_fdatawait(inode->i_mapping);
						invalidate_remote_inode(inode);
					}
+149 −135
Original line number Diff line number Diff line
@@ -366,17 +366,19 @@ struct smb_hdr {
#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 )

/*
 * Computer Name Length
 * Computer Name Length (since Netbios name was length 16 with last byte 0x20)
 * No longer as important, now that TCP names are more commonly used to
 * resolve hosts.
 */
#define CNLEN 15

/*
 * Share Name Length					  @S8A
 * Note:  This length is limited by the SMB used to get   @S8A
 *        the Share info.   NetShareEnum only returns 13  @S8A
 *        chars, including the null termination.          @S8A 
 * Share Name Length (SNLEN)
 * Note:  This length was limited by the SMB used to get
 *        the Share info.   NetShareEnum only returned 13
 *        chars, including the null termination.
 * This was removed because it no longer is limiting.
 */
#define SNLEN 12		/*@S8A */

/*
 * Comment Length
@@ -819,7 +821,8 @@ typedef struct smb_com_writex_req {
	__le16 DataLengthLow;
	__le16 DataOffset;
	__le16 ByteCount;
        __u8 Pad;               /* BB check for whether padded to DWORD boundary and optimum performance here */
	__u8 Pad;		/* BB check for whether padded to DWORD
				   boundary and optimum performance here */
	char Data[0];
} __attribute__((packed)) WRITEX_REQ;

@@ -838,7 +841,8 @@ typedef struct smb_com_write_req {
	__le16 DataOffset;
	__le32 OffsetHigh;
	__le16 ByteCount;
	__u8 Pad;		/* BB check for whether padded to DWORD boundary and optimum performance here */
	__u8 Pad;		/* BB check for whether padded to DWORD
				   boundary and optimum performance here */
	char Data[0];
} __attribute__((packed)) WRITE_REQ;

@@ -897,7 +901,8 @@ typedef struct smb_com_read_rsp {
	__le16 DataLengthHigh;
	__u64 Reserved2;
	__u16 ByteCount;
	__u8 Pad;		/* BB check for whether padded to DWORD boundary and optimum performance here */
	__u8 Pad;		/* BB check for whether padded to DWORD
				   boundary and optimum performance here */
	char Data[1];
} __attribute__((packed)) READ_RSP;

@@ -1744,7 +1749,9 @@ typedef struct smb_com_transaction2_get_dfs_refer_req {
	__u8 Reserved3;
	__le16 SubCommand;	/* one setup word */
	__le16 ByteCount;
	__u8 Pad[3];		/* Win2K has sent 0x0F01 (max resp length perhaps?) followed by one byte pad - doesn't seem to matter though */
	__u8 Pad[3];		/* Win2K has sent 0x0F01 (max response length
				   perhaps?) followed by one byte pad - doesn't
				   seem to matter though */
	__le16 MaxReferralLevel;
	char RequestFileName[1];
} __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
@@ -1753,7 +1760,10 @@ typedef struct dfs_referral_level_3 {
	__le16 VersionNumber;
	__le16 ReferralSize;
	__le16 ServerType;	/* 0x0001 = CIFS server */
	__le16 ReferralFlags;	/* or proximity - not clear which since always set to zero - SNIA spec says 0x01 means strip off PathConsumed chars before submitting RequestFileName to remote node */
	__le16 ReferralFlags;	/* or proximity - not clear which since it is
				   always set to zero - SNIA spec says 0x01
				   means strip off PathConsumed chars before
				   submitting RequestFileName to remote node */
	__le16 TimeToLive;
	__le16 Proximity;
	__le16 DfsPathOffset;
@@ -1779,11 +1789,13 @@ typedef struct smb_com_transaction_get_dfs_refer_rsp {
#define DFSREF_STORAGE_SERVER   0x0002

/* IOCTL information */
/* List of ioctl function codes that look to be of interest to remote clients like this. */
/* Need to do some experimentation to make sure they all work remotely.                  */
/* Some of the following such as the encryption/compression ones would be                */
/* invoked from tools via a specialized hook into the VFS rather than via the            */
/* standard vfs entry points */
/*
 * List of ioctl function codes that look to be of interest to remote clients
 * like this one.  Need to do some experimentation to make sure they all work
 * remotely.  Some of the following, such as the encryption/compression ones
 * would be invoked from tools via a specialized hook into the VFS rather
 * than via the standard vfs entry points
 */
#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
#define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004
#define FSCTL_REQUEST_BATCH_OPLOCK   0x00090008
@@ -1872,7 +1884,7 @@ typedef struct {
	__le16 MajorVersionNumber;
	__le16 MinorVersionNumber;
	__le64 Capability;
} __attribute__((packed)) FILE_SYSTEM_UNIX_INFO;	/* Unix extensions info, level 0x200 */
} __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extension level 0x200*/

/* Version numbers for CIFS UNIX major and minor. */
#define CIFS_UNIX_MAJOR_VERSION 1
@@ -2362,8 +2374,10 @@ struct data_blob {
	T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks
	T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2)
	T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK)
	T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) - BB check for missing inode fields
					Actually need QUERY_FILE_UNIX_INFO since has inode num
	T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC)	BB check for missing
							inode fields
				Actually a need QUERY_FILE_UNIX_INFO
				since has inode num
				BB what about a) blksize/blkbits/blocks
							  b) i_version
							  c) i_rdev
@@ -2373,8 +2387,6 @@ struct data_blob {
	T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX
	TRANS2_GET_DFS_REFERRAL		      - OPTIONAL but recommended
	T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL
	
	
 */

/* xsymlink is a symlink format (used by MacOS) that can be used
@@ -2410,7 +2422,8 @@ typedef struct file_xattr_info {
	__u32 xattr_value_len;
	char  xattr_name[0];
	/* followed by xattr_value[xattr_value_len], no pad */
} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute, info level 0x205 */
} __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute info
					      level 0x205 */


/* flags for chattr command */
@@ -2436,7 +2449,8 @@ typedef struct file_xattr_info {
typedef struct file_chattr_info {
	__le64	mask; /* list of all possible attribute bits */
	__le64	mode; /* list of actual attribute bits on this inode */
} __attribute__((packed)) FILE_CHATTR_INFO;  /* ext attributes (chattr, chflags) level 0x206 */
} __attribute__((packed)) FILE_CHATTR_INFO;  /* ext attributes
						(chattr, chflags) level 0x206 */

#endif

Loading