diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-09-19 09:22:44 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 22:46:33 -0400 |
commit | b8c32dbb0deb287a5fcb78251e4eae6c7275760d (patch) | |
tree | fa3cddfd4595846921f51a922b7e1722b1e35fa4 /fs/cifs/smb2pdu.h | |
parent | 579f9053236c796d718162c37c72bb3bd32d008c (diff) |
CIFS: Request SMB2.1 leases
if server supports them and we need oplocks.
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/smb2pdu.h')
-rw-r--r-- | fs/cifs/smb2pdu.h | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h index 889ee5e193d9..e818a5cc5bd8 100644 --- a/fs/cifs/smb2pdu.h +++ b/fs/cifs/smb2pdu.h | |||
@@ -150,6 +150,10 @@ struct smb2_err_rsp { | |||
150 | __u8 ErrorData[1]; /* variable length */ | 150 | __u8 ErrorData[1]; /* variable length */ |
151 | } __packed; | 151 | } __packed; |
152 | 152 | ||
153 | #define SMB2_CLIENT_GUID_SIZE 16 | ||
154 | |||
155 | extern __u8 cifs_client_guid[SMB2_CLIENT_GUID_SIZE]; | ||
156 | |||
153 | struct smb2_negotiate_req { | 157 | struct smb2_negotiate_req { |
154 | struct smb2_hdr hdr; | 158 | struct smb2_hdr hdr; |
155 | __le16 StructureSize; /* Must be 36 */ | 159 | __le16 StructureSize; /* Must be 36 */ |
@@ -157,7 +161,7 @@ struct smb2_negotiate_req { | |||
157 | __le16 SecurityMode; | 161 | __le16 SecurityMode; |
158 | __le16 Reserved; /* MBZ */ | 162 | __le16 Reserved; /* MBZ */ |
159 | __le32 Capabilities; | 163 | __le32 Capabilities; |
160 | __u8 ClientGUID[16]; /* MBZ */ | 164 | __u8 ClientGUID[SMB2_CLIENT_GUID_SIZE]; |
161 | __le64 ClientStartTime; /* MBZ */ | 165 | __le64 ClientStartTime; /* MBZ */ |
162 | __le16 Dialects[2]; /* variable length */ | 166 | __le16 Dialects[2]; /* variable length */ |
163 | } __packed; | 167 | } __packed; |
@@ -307,6 +311,8 @@ struct smb2_tree_disconnect_rsp { | |||
307 | #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08 | 311 | #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08 |
308 | #define SMB2_OPLOCK_LEVEL_BATCH 0x09 | 312 | #define SMB2_OPLOCK_LEVEL_BATCH 0x09 |
309 | #define SMB2_OPLOCK_LEVEL_LEASE 0xFF | 313 | #define SMB2_OPLOCK_LEVEL_LEASE 0xFF |
314 | /* Non-spec internal type */ | ||
315 | #define SMB2_OPLOCK_LEVEL_NOCHANGE 0x99 | ||
310 | 316 | ||
311 | /* Desired Access Flags */ | 317 | /* Desired Access Flags */ |
312 | #define FILE_READ_DATA_LE cpu_to_le32(0x00000001) | 318 | #define FILE_READ_DATA_LE cpu_to_le32(0x00000001) |
@@ -404,7 +410,7 @@ struct smb2_create_req { | |||
404 | __le16 NameLength; | 410 | __le16 NameLength; |
405 | __le32 CreateContextsOffset; | 411 | __le32 CreateContextsOffset; |
406 | __le32 CreateContextsLength; | 412 | __le32 CreateContextsLength; |
407 | __u8 Buffer[1]; | 413 | __u8 Buffer[8]; |
408 | } __packed; | 414 | } __packed; |
409 | 415 | ||
410 | struct smb2_create_rsp { | 416 | struct smb2_create_rsp { |
@@ -428,6 +434,39 @@ struct smb2_create_rsp { | |||
428 | __u8 Buffer[1]; | 434 | __u8 Buffer[1]; |
429 | } __packed; | 435 | } __packed; |
430 | 436 | ||
437 | struct create_context { | ||
438 | __le32 Next; | ||
439 | __le16 NameOffset; | ||
440 | __le16 NameLength; | ||
441 | __le16 Reserved; | ||
442 | __le16 DataOffset; | ||
443 | __le32 DataLength; | ||
444 | __u8 Buffer[0]; | ||
445 | } __packed; | ||
446 | |||
447 | #define SMB2_LEASE_NONE __constant_cpu_to_le32(0x00) | ||
448 | #define SMB2_LEASE_READ_CACHING __constant_cpu_to_le32(0x01) | ||
449 | #define SMB2_LEASE_HANDLE_CACHING __constant_cpu_to_le32(0x02) | ||
450 | #define SMB2_LEASE_WRITE_CACHING __constant_cpu_to_le32(0x04) | ||
451 | |||
452 | #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS __constant_cpu_to_le32(0x02) | ||
453 | |||
454 | #define SMB2_LEASE_KEY_SIZE 16 | ||
455 | |||
456 | struct lease_context { | ||
457 | __le64 LeaseKeyLow; | ||
458 | __le64 LeaseKeyHigh; | ||
459 | __le32 LeaseState; | ||
460 | __le32 LeaseFlags; | ||
461 | __le64 LeaseDuration; | ||
462 | } __packed; | ||
463 | |||
464 | struct create_lease { | ||
465 | struct create_context ccontext; | ||
466 | __u8 Name[8]; | ||
467 | struct lease_context lcontext; | ||
468 | } __packed; | ||
469 | |||
431 | /* Currently defined values for close flags */ | 470 | /* Currently defined values for close flags */ |
432 | #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001) | 471 | #define SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB cpu_to_le16(0x0001) |
433 | struct smb2_close_req { | 472 | struct smb2_close_req { |