Various cleanup for smb2 patches

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pavel,
As we talked about earlier, these three patches remove the remaining
endian and sparse and compile warnings (and some checkpatch warnings
from your smb2 series.

If you are respinning the smb2 patches for additional cleanup, if you
would prefer to integrate these cleanup patches into the originals,
that might make it easier for Jeff and Christoph etc. to read.  I
don't mind carrying them as deltas on your series.



-- 
Thanks,

Steve
From 17e3ba8c1d61b5b3e6c3dd568e57d346c2dcd3fd Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@xxxxxxxxx>
Date: Mon, 24 Oct 2011 21:57:26 -0500
Subject: [PATCH 2/5] [CIFS] Fix endian warnings

Moving to a common mid means that we now have to endian convert the
older SMB command code

CC: Pavel Shilovsky <piastry@xxxxxxxxxxx>
CC: Jeff Layton <jlayton@xxxxxxxxxx>
Signed-off-by: Steve French <smfrench@xxxxxxxxx>
---
 fs/cifs/cifs_debug.c |    3 ++-
 fs/cifs/connect.c    |    2 +-
 fs/cifs/transport.c  |    2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 66b68e8..b49fed2 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -202,7 +202,8 @@ static void dump_cifs_debug_info(int i, struct seq_file *m,
 			seq_printf(m, "\tState: %d com: %d pid:"
 					" %d cbdata: %p mid %llu\n",
 					mid_entry->mid_state,
-					(int)mid_entry->command, mid_entry->pid,
+					le16_to_cpu(mid_entry->command),
+					mid_entry->pid,
 					mid_entry->callback_data,
 					mid_entry->mid);
 		}
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 305491b..9421135 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -555,7 +555,7 @@ find_cifs_mid(struct TCP_Server_Info *server, struct smb_hdr *buf)
 	list_for_each_entry(mid, &server->pending_mid_q, qhead) {
 		if (mid->mid == buf->Mid &&
 		    mid->mid_state == MID_REQUEST_SUBMITTED &&
-		    mid->command == buf->Command) {
+		    le16_to_cpu(mid->command) == buf->Command) {
 			spin_unlock(&GlobalMid_Lock);
 			return mid;
 		}
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 504a3c2..e205d2a 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -60,7 +60,7 @@ AllocMidQEntry(const struct smb_hdr *smb_buffer, struct TCP_Server_Info *server)
 		memset(temp, 0, sizeof(struct mid_q_entry));
 		temp->mid = smb_buffer->Mid;	/* always LE */
 		temp->pid = current->pid;
-		temp->command = smb_buffer->Command;
+		temp->command = cpu_to_le16(smb_buffer->Command);
 		cFYI(1, "For smb_command %d", temp->command);
 	/*	do_gettimeofday(&temp->when_sent);*/ /* easier to use jiffies */
 		/* when mid allocated can be before when sent */
-- 
1.7.6

From 7ee4381305da641c7f4bf177757949fa9deb2a15 Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@xxxxxxxxx>
Date: Tue, 25 Oct 2011 00:25:54 -0500
Subject: [PATCH 3/5] [CIFS] Fix various sparse and compile warnings

Various minor endian fixes and sparse warnings cleaned up
in Pavel's smb2 code

Signed-off-by: Steve French <smfrench@xxxxxxxxx>
---
 fs/cifs/cifsproto.h     |    4 +-
 fs/cifs/connect.c       |    6 +---
 fs/cifs/smb2file.c      |   10 +++---
 fs/cifs/smb2inode.c     |   65 ++++++++++++++++++++++++----------------------
 fs/cifs/smb2link.c      |    4 +-
 fs/cifs/smb2misc.c      |   12 ++++----
 fs/cifs/smb2pdu.c       |   19 +++++++------
 fs/cifs/smb2pdu.h       |    1 +
 fs/cifs/smb2proto.h     |    8 +++---
 fs/cifs/smb2transport.c |    3 +-
 10 files changed, 68 insertions(+), 64 deletions(-)

diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 7622707..a61da92 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -1,7 +1,7 @@
 /*
  *   fs/cifs/cifsproto.h
  *
- *   Copyright (c) International Business Machines  Corp., 2002,2008
+ *   Copyright (c) International Business Machines  Corp., 2002,2011
  *   Author(s): Steve French (sfrench@xxxxxxxxxx)
  *
  *   This library is free software; you can redistribute it and/or modify
@@ -229,7 +229,7 @@ extern int cifs_fsync_generic(struct file *file, loff_t start, loff_t end,
 void cifs_proc_init(void);
 void cifs_proc_clean(void);
 
-extern inline void inc_rfc1001_len(void *pSMB, int count);
+extern void inc_rfc1001_len(void *pSMB, int count);
 extern int cifs_negotiate_protocol(unsigned int xid,
 				  struct cifs_ses *ses);
 extern int cifs_setup_session(unsigned int xid, struct cifs_ses *ses,
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 9421135..cd1c85c 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -764,19 +764,17 @@ standard_receive3(struct TCP_Server_Info *server, struct mid_q_entry *mid)
 	char *buf = server->smallbuf;
 	unsigned int pdu_length = get_rfc1002_length(buf);
 	size_t buf_size, max_hdr_size;
-	struct smb_hdr *smb_buffer;
+	struct smb_hdr *smb_buffer = (struct smb_hdr *)buf; /* quiet compiler */
 #ifdef CONFIG_CIFS_SMB2
-	struct smb2_hdr *smb2_buffer;
+	struct smb2_hdr *smb2_buffer = (struct smb2_hdr *)buf;
 #endif
 
 #ifdef CONFIG_CIFS_SMB2
 	if (server->is_smb2) {
-		smb2_buffer = (struct smb2_hdr *)buf;
 		max_hdr_size = MAX_SMB2_HDR_SIZE;
 		buf_size = sizeof(struct smb2_hdr);
 	} else {
 #endif
-		smb_buffer = (struct smb_hdr *)buf;
 		max_hdr_size = MAX_CIFS_HDR_SIZE;
 		buf_size = sizeof(struct smb_hdr);
 #ifdef CONFIG_CIFS_SMB2
diff --git a/fs/cifs/smb2file.c b/fs/cifs/smb2file.c
index d359ce1..ba0e9d9 100644
--- a/fs/cifs/smb2file.c
+++ b/fs/cifs/smb2file.c
@@ -200,8 +200,8 @@ smb2_open_helper(struct file *file, struct inode *inode, const char *full_path,
 		 FILE_ALL_INFO *data, struct cifs_tcon *tcon, int xid)
 {
 	int rc;
-	int desired_access = FILE_READ_ATTRIBUTES_LE;
-	int create_disposition;
+	__u32 desired_access = FILE_READ_ATTRIBUTES;
+	__u32 create_disposition;
 	struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
 	__le16 *smb2_path;
 	FILE_ALL_INFO_SMB2 *smb2_data = NULL;
@@ -315,15 +315,15 @@ smb2_reopen_file_cb(struct cifsFileInfo *cifs_file, int xid,
 	int rc = -EACCES;
 	struct cifs_sb_info *cifs_sb;
 	struct inode *inode;
-	__le32 desired_access;
-	__le32 create_disposition = FILE_OPEN_LE;
+	__u32 desired_access;
+	__u32 create_disposition = FILE_OPEN;
 	__le16 *smb2_path = NULL;
 	__u64 persist_fid, volatile_fid;
 
 	inode = cifs_file->dentry->d_inode;
 	cifs_sb = CIFS_SB(inode->i_sb);
 
-	desired_access = cpu_to_le32(cifs_convert_flags(cifs_file->f_flags));
+	desired_access = cifs_convert_flags(cifs_file->f_flags);
 
 	/*
 	 * Can not refresh inode by passing in file_info buf to be returned
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 4fd7145..3adfd73 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -142,8 +142,8 @@ void smb2_set_ops(struct inode *inode)
 
 int
 smb2_open_op_close(int xid, struct cifs_tcon *tcon, __le16 *path,
-		   __le32 desired_access, __le32 create_disposition,
-		   __le32 file_attributes, __le32 create_options,
+		   __u32 desired_access, __u32 create_disposition,
+		   __u32 file_attributes, __u32 create_options,
 		   void *data, int command)
 {
 	int rc, tmprc = 0;
@@ -192,7 +192,8 @@ void
 move_smb2_info_to_cifs(FILE_ALL_INFO *dst, FILE_ALL_INFO_SMB2 *src)
 {
 	memcpy(dst, src,
-	       (unsigned int)(&src->CurrentByteOffset) - (unsigned int)src);
+		(unsigned long long)(&src->CurrentByteOffset) -
+		(unsigned long long)src);
 	dst->CurrentByteOffset = src->CurrentByteOffset;
 	dst->Mode = src->Mode;
 	dst->AlignmentRequirement = src->AlignmentRequirement;
@@ -218,8 +219,8 @@ smb2_qinfo_helper(int xid, struct cifs_sb_info *cifs_sb, struct cifs_tcon *tcon,
 		goto out;
 	}
 
-	rc = smb2_open_op_close(xid, tcon, smb2_path, FILE_READ_ATTRIBUTES_LE,
-				FILE_OPEN_LE, 0, 0, smb2_data,
+	rc = smb2_open_op_close(xid, tcon, smb2_path, FILE_READ_ATTRIBUTES,
+				FILE_OPEN, 0, 0, smb2_data,
 				SMB2_OP_QUERY_INFO);
 	if (rc)
 		goto out;
@@ -371,8 +372,8 @@ int smb2_mkdir(struct inode *inode, struct dentry *direntry, int mode)
 		goto err_out;
 	}
 
-	rc = smb2_open_op_close(xid, tcon, ucs_path, FILE_WRITE_ATTRIBUTES_LE,
-				FILE_CREATE_LE, 0, FILE_DIRECTORY_FILE_LE, NULL,
+	rc = smb2_open_op_close(xid, tcon, ucs_path, FILE_WRITE_ATTRIBUTES,
+				FILE_CREATE, 0, CREATE_NOT_FILE, NULL,
 				SMB2_OP_MKDIR);
 	if (rc)
 		goto err_out;
@@ -403,9 +404,9 @@ int smb2_mkdir(struct inode *inode, struct dentry *direntry, int mode)
 		dosattrs = cifs_i->cifsAttrs | ATTR_READONLY;
 		data.Attributes = cpu_to_le32(dosattrs);
 		tmprc = smb2_open_op_close(xid, tcon, ucs_path,
-					   FILE_WRITE_ATTRIBUTES_LE,
-					   FILE_CREATE_LE, 0,
-					   FILE_DIRECTORY_FILE_LE, &data,
+					   FILE_WRITE_ATTRIBUTES,
+					   FILE_CREATE, 0,
+					   CREATE_NOT_FILE, &data,
 					   SMB2_OP_SET_INFO);
 		if (tmprc == 0)
 			cifs_i->cifsAttrs = dosattrs;
@@ -463,9 +464,9 @@ int smb2_rmdir(struct inode *inode, struct dentry *direntry)
 	}
 	tcon = tlink_tcon(tlink);
 
-	rc = smb2_open_op_close(xid, tcon, ucs_path, FILE_DELETE_LE,
-				FILE_OPEN_LE, 0, FILE_DIRECTORY_FILE_LE |
-				FILE_DELETE_ON_CLOSE_LE, NULL, SMB2_OP_DELETE);
+	rc = smb2_open_op_close(xid, tcon, ucs_path, DELETE,
+				FILE_OPEN, 0, CREATE_NOT_FILE |
+				CREATE_DELETE_ON_CLOSE, NULL, SMB2_OP_DELETE);
 	cifs_put_tlink(tlink);
 
 	if (!rc) {
@@ -524,8 +525,8 @@ int smb2_unlink(struct inode *dir, struct dentry *dentry)
 		goto unlink_out;
 	}
 
-	rc = smb2_open_op_close(xid, tcon, ucs_path, FILE_DELETE_LE,
-				FILE_OPEN_LE, 0, FILE_DELETE_ON_CLOSE_LE, NULL,
+	rc = smb2_open_op_close(xid, tcon, ucs_path, DELETE,
+				FILE_OPEN, 0, CREATE_DELETE_ON_CLOSE, NULL,
 				SMB2_OP_DELETE);
 	if (!rc) {
 		if (inode)
@@ -588,13 +589,13 @@ smb2_create_helper(struct inode *dir, struct dentry *direntry, int mode,
 		   const char *full_path, void *data)
 {
 	int rc;
-	__le32 desired_access;
-	__le32 create_disposition;
-	__le32 create_options = cpu_to_le32(CREATE_NOT_DIR);
-	__le32 oflags;
+	__u32 desired_access;
+	__u32 create_disposition;
+	__u32 create_options = CREATE_NOT_DIR;
+	__u32 oflags;
 	__le16 *smb2_path;
 	struct cifs_sb_info *cifs_sb = CIFS_SB(dir->i_sb);
-	FILE_ALL_INFO_SMB2 *smb2_data;
+	FILE_ALL_INFO_SMB2 *smb2_data = NULL;
 
 	if (nd) {
 		/* if the file is going to stay open, then we
@@ -602,24 +603,26 @@ smb2_create_helper(struct inode *dir, struct dentry *direntry, int mode,
 		oflags = nd->intent.open.file->f_flags;
 
 		/* read attributes access to get attributes of inode */
-		desired_access = FILE_READ_ATTRIBUTES_LE;
+		desired_access = FILE_READ_ATTRIBUTES;
 		if (OPEN_FMODE(oflags) & FMODE_READ)
 			/* is this too little?*/
-			desired_access |= cpu_to_le32(GENERIC_READ);
+			desired_access |= GENERIC_READ;
 		if (OPEN_FMODE(oflags) & FMODE_WRITE)
-			desired_access |= cpu_to_le32(GENERIC_WRITE);
+			desired_access |= GENERIC_WRITE;
 
 		if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
-			create_disposition = FILE_CREATE_LE;
+			create_disposition = FILE_CREATE;
 		else if ((oflags & (O_CREAT | O_TRUNC)) == (O_CREAT | O_TRUNC))
-			create_disposition = FILE_OVERWRITE_IF_LE;
+			create_disposition = FILE_OVERWRITE_IF;
 		else if ((oflags & O_CREAT) == O_CREAT)
-			create_disposition = FILE_OPEN_IF_LE;
-		else
+			create_disposition = FILE_OPEN_IF;
+		else {
+			create_disposition = FILE_OPEN;
 			cFYI(1, "Create flag not set in create function");
+		}
 	} else {
-		desired_access = cpu_to_le32(GENERIC_READ | GENERIC_WRITE);
-		create_disposition = FILE_OVERWRITE_IF_LE;
+		desired_access = GENERIC_READ | GENERIC_WRITE;
+		create_disposition = FILE_OVERWRITE_IF;
 	}
 	/* BB pass O_SYNC flag through on file attributes .. BB */
 
@@ -778,8 +781,8 @@ smb2_do_rename(struct dentry *from_dentry, __le16 *from_path,
 		return PTR_ERR(tlink);
 	tcon = tlink_tcon(tlink);
 
-	rc = smb2_open_op_close(xid, tcon, from_path, FILE_DELETE_LE,
-				FILE_OPEN_LE, 0, 0, to_path, SMB2_OP_RENAME);
+	rc = smb2_open_op_close(xid, tcon, from_path, DELETE,
+				FILE_OPEN, 0, 0, to_path, SMB2_OP_RENAME);
 
 	cifs_put_tlink(tlink);
 	FreeXid(xid);
diff --git a/fs/cifs/smb2link.c b/fs/cifs/smb2link.c
index abeec19..8bac250 100644
--- a/fs/cifs/smb2link.c
+++ b/fs/cifs/smb2link.c
@@ -59,8 +59,8 @@ smb2_hardlink(struct dentry *old_file, struct inode *inode,
 		goto smb2_hl_exit;
 	}
 
-	rc = smb2_open_op_close(xid, tcon, from_name, FILE_READ_ATTRIBUTES_LE,
-				FILE_OPEN_LE, 0, 0, to_name, SMB2_OP_HARDLINK);
+	rc = smb2_open_op_close(xid, tcon, from_name, FILE_READ_ATTRIBUTES,
+				FILE_OPEN, 0, 0, to_name, SMB2_OP_HARDLINK);
 
 	if ((rc == -EIO) || (rc == -EINVAL))
 		rc = -EOPNOTSUPP;
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index e24e954..6b64cd8 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -151,13 +151,13 @@ checkSMB2(struct smb2_hdr *smb, __u64 mid, unsigned int length)
 
 	if (smb2_rsp_struct_sizes[command] !=
 	    le16_to_cpu(smb2->StructureSize2)) {
-		if (command != SMB2_OPLOCK_BREAK && ((smb->Status == 0) ||
+		if (command != SMB2OPLOCK_BREAK && ((smb->Status == 0) ||
 		    (le16_to_cpu(smb2->StructureSize2) != 9))) {
 			/* error packets have 9 byte structure size */
 			cERROR(1, "Illegal response size %d for command %d",
 				   le16_to_cpu(smb2->StructureSize2), command);
 			return 1;
-		} else if (command == SMB2_OPLOCK_BREAK && (smb->Status == 0)
+		} else if (command == SMB2OPLOCK_BREAK && (smb->Status == 0)
 			   && (le16_to_cpu(smb2->StructureSize2) != 44)
 			   && (le16_to_cpu(smb2->StructureSize2) != 36)) {
 			/* special case for SMB2.1 lease break message */
@@ -178,7 +178,7 @@ checkSMB2(struct smb2_hdr *smb, __u64 mid, unsigned int length)
 	if (4 + len != clc_len) {
 		cFYI(1, "Calculated size %d length %d mismatch for mid %lld",
 			 clc_len, 4 + len, smb->MessageId);
-		if (clc_len + 20 == len && command == SMB2_OPLOCK_BREAK)
+		if (clc_len + 20 == len && command == SMB2OPLOCK_BREAK)
 			return 0; /* Windows 7 server returns 24 bytes more */
 		if (clc_len == 4 + len + 1) /* BB FIXME (fix samba) */
 			return 0; /* BB workaround Samba 3 bug SessSetup rsp */
@@ -359,9 +359,9 @@ __le32
 smb2_get_lease_state(struct cifsInodeInfo *cinode)
 {
 	if (cinode->clientCanCacheAll)
-		return cpu_to_le32(SMB2_LEASE_WRITE_CACHING);
+		return SMB2_LEASE_WRITE_CACHING;
 	else if (cinode->clientCanCacheRead)
-		return cpu_to_le32(SMB2_LEASE_READ_CACHING);
+		return SMB2_LEASE_READ_CACHING;
 	return 0;
 }
 
@@ -470,7 +470,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *srv)
 		return false;
 
 	if (le16_to_cpu(pSMB->StructureSize) !=
-				smb2_rsp_struct_sizes[SMB2_OPLOCK_BREAK]) {
+				smb2_rsp_struct_sizes[SMB2OPLOCK_BREAK]) {
 		if (le16_to_cpu(pSMB->StructureSize) == 44)
 			return smb2_is_valid_lease_break(buf, srv);
 		else
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index aded068..7646c7c 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -327,9 +327,9 @@ get_buf:
 	if (tcon != NULL) {
 #ifdef CONFIG_CIFS_STATS2
 		uint16_t com_code = le16_to_cpu(smb2_command);
+		cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]);
 #endif
 		cifs_stats_inc(&tcon->num_smbs_sent);
-		cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]);
 	}
 
 	return rc;
@@ -1147,9 +1147,9 @@ parse_lease_state(struct create_rsp *smb)
 }
 
 int SMB2_open(const int xid, struct cifs_tcon *tcon, __le16 *path,
-	      u64 *persistent_fid, u64 *volatile_fid, __le32 desired_access,
-	      __le32 create_disposition, __le32 file_attributes,
-	      __le32 create_options, u8 *oplock)
+	      u64 *persistent_fid, u64 *volatile_fid, __u32 desired_access,
+	      __u32 create_disposition, __u32 file_attributes,
+	      __u32 create_options, u8 *oplock)
 {
 	struct create_req *pSMB2;
 	struct create_rsp *pSMB2r;
@@ -1176,11 +1176,12 @@ int SMB2_open(const int xid, struct cifs_tcon *tcon, __le16 *path,
 		return rc;
 
 	pSMB2->ImpersonationLevel = IL_IMPERSONATION;
-	pSMB2->DesiredAccess = desired_access;
-	pSMB2->FileAttributes = file_attributes; /* ignored on open */
+	pSMB2->DesiredAccess = cpu_to_le32(desired_access);
+	/* File attributes ignored on open (used in create though) */
+	pSMB2->FileAttributes = cpu_to_le32(file_attributes);
 	pSMB2->ShareAccess = FILE_SHARE_ALL_LE;
-	pSMB2->CreateDisposition = create_disposition;
-	pSMB2->CreateOptions = create_options;
+	pSMB2->CreateDisposition = cpu_to_le32(create_disposition);
+	pSMB2->CreateOptions = cpu_to_le32(create_options);
 	uni_path_len = (2 * UniStrnlen((wchar_t *)path, PATH_MAX)) + 2;
 	pSMB2->NameOffset = cpu_to_le16(sizeof(struct create_req)
 			- 8 /* pad */ - 4 /* do not count rfc1001 len field */);
@@ -1312,7 +1313,7 @@ int SMB2_close(const int xid, struct cifs_tcon *tcon,
 
 	if (rc != 0) {
 		if (tcon)
-			cifs_stats_fail_inc(tcon, SMB2_CLOSE);
+			cifs_stats_fail_inc(tcon, SMB2CLOSE);
 		goto close_exit;
 	}
 
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index 1c1b8ed..d04e8b6 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -379,6 +379,7 @@ struct tree_disconnect_rsp {
 
 /* CreateOptions Flags */
 #define FILE_DIRECTORY_FILE_LE		cpu_to_le32(0x00000001)
+/* same as #define CREATE_NOT_FILE_LE	cpu_to_le32(0x00000001) */
 #define FILE_WRITE_THROUGH_LE		cpu_to_le32(0x00000002)
 #define FILE_SEQUENTIAL_ONLY_LE		cpu_to_le32(0x00000004)
 #define FILE_NO_INTERMEDIATE_BUFFERRING_LE cpu_to_le32(0x00000008)
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index 37198c5..7da88f5 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -108,8 +108,8 @@ extern int smb2_query_inode_info(struct inode **pinode, const char *full_path,
 				 FILE_ALL_INFO *data, struct super_block *sb,
 				 int xid);
 extern int smb2_open_op_close(int xid, struct cifs_tcon *tcon, __le16 *path,
-			      __le32 desired_access, __le32 create_disposition,
-			      __le32 file_attributes, __le32 create_options,
+			      __u32 desired_access, __u32 create_disposition,
+			      __u32 file_attributes, __u32 create_options,
 			      void *data, int command);
 extern void smb2_open_queryfs_close(int xid, struct cifs_tcon *tcon,
 				    struct kstatfs *buf);
@@ -221,8 +221,8 @@ extern int SMB2_rename(const int xid, struct cifs_tcon *tcon,
 		    u64 persistent_fid, u64 volatile_fid, __le16 *target_file);
 extern int SMB2_open(const int xid, struct cifs_tcon *tcon, __le16 *path,
 		      u64 *persistent_fid, u64 *volatile_fid,
-		      __le32 desired_access, __le32 create_disposition,
-		      __le32 file_attributes, __le32 create_options,
+		      __u32 desired_access, __u32 create_disposition,
+		      __u32 file_attributes, __u32 create_options,
 		      u8 *oplock);
 extern int SMB2_symlink_ioctl(const int, struct cifs_tcon *, u32, u64, u64,
 				const char *);
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 73225e6..acdd0c6 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -145,7 +145,8 @@ smb2_calc_signature2(const struct kvec *iov, int n_vec,
 }
 
 /* must be called with server->srv_mutex held */
-int smb2_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server)
+static int smb2_sign_smb2(struct kvec *iov, int n_vec,
+			  struct TCP_Server_Info *server)
 {
 	int rc = 0;
 	struct smb2_hdr *smb2_pdu = iov[0].iov_base;
-- 
1.7.6

From c88af92282af11d01be94817cd38ac48e237463a Mon Sep 17 00:00:00 2001
From: Pavel Shilovsky <piastry@xxxxxxxxxxx>
Date: Tue, 25 Oct 2011 12:24:46 +0400
Subject: [PATCH 4/5] CIFS: Fix compile warnings

Signed-off-by: Pavel Shilovsky <piastry@xxxxxxxxxxx>
Signed-off-by: Steve French <smfrench@xxxxxxxxx>
---
 fs/cifs/smb2inode.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 3adfd73..f689361a 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -191,9 +191,7 @@ smb2_open_op_close(int xid, struct cifs_tcon *tcon, __le16 *path,
 void
 move_smb2_info_to_cifs(FILE_ALL_INFO *dst, FILE_ALL_INFO_SMB2 *src)
 {
-	memcpy(dst, src,
-		(unsigned long long)(&src->CurrentByteOffset) -
-		(unsigned long long)src);
+	memcpy(dst, src, (size_t)(&src->CurrentByteOffset) - (size_t)src);
 	dst->CurrentByteOffset = src->CurrentByteOffset;
 	dst->Mode = src->Mode;
 	dst->AlignmentRequirement = src->AlignmentRequirement;
-- 
1.7.6


[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux