@@ -833,7 +833,8 @@ SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon)
833833int
834834SMB2_open (const unsigned int xid , struct cifs_tcon * tcon , __le16 * path ,
835835 u64 * persistent_fid , u64 * volatile_fid , __u32 desired_access ,
836- __u32 create_disposition , __u32 file_attributes , __u32 create_options )
836+ __u32 create_disposition , __u32 file_attributes , __u32 create_options ,
837+ struct smb2_file_all_info * buf )
837838{
838839 struct smb2_create_req * req ;
839840 struct smb2_create_rsp * rsp ;
@@ -856,9 +857,9 @@ SMB2_open(const unsigned int xid, struct cifs_tcon *tcon, __le16 *path,
856857 if (rc )
857858 return rc ;
858859
859- if (enable_oplocks )
860+ /* if (server->oplocks )
860861 req->RequestedOplockLevel = SMB2_OPLOCK_LEVEL_BATCH;
861- else
862+ else */
862863 req -> RequestedOplockLevel = SMB2_OPLOCK_LEVEL_NONE ;
863864 req -> ImpersonationLevel = IL_IMPERSONATION ;
864865 req -> DesiredAccess = cpu_to_le32 (desired_access );
@@ -906,6 +907,15 @@ SMB2_open(const unsigned int xid, struct cifs_tcon *tcon, __le16 *path,
906907 }
907908 * persistent_fid = rsp -> PersistentFileId ;
908909 * volatile_fid = rsp -> VolatileFileId ;
910+
911+ if (buf ) {
912+ memcpy (buf , & rsp -> CreationTime , 32 );
913+ buf -> AllocationSize = rsp -> AllocationSize ;
914+ buf -> EndOfFile = rsp -> EndofFile ;
915+ buf -> Attributes = rsp -> FileAttributes ;
916+ buf -> NumberOfLinks = cpu_to_le32 (1 );
917+ buf -> DeletePending = 0 ;
918+ }
909919creat_exit :
910920 free_rsp_buf (resp_buftype , rsp );
911921 return rc ;
@@ -1019,10 +1029,10 @@ validate_and_copy_buf(unsigned int offset, unsigned int buffer_length,
10191029 return 0 ;
10201030}
10211031
1022- int
1023- SMB2_query_info (const unsigned int xid , struct cifs_tcon * tcon ,
1024- u64 persistent_fid , u64 volatile_fid ,
1025- struct smb2_file_all_info * data )
1032+ static int
1033+ query_info (const unsigned int xid , struct cifs_tcon * tcon ,
1034+ u64 persistent_fid , u64 volatile_fid , u8 info_class ,
1035+ size_t output_len , size_t min_len , void * data )
10261036{
10271037 struct smb2_query_info_req * req ;
10281038 struct smb2_query_info_rsp * rsp = NULL ;
@@ -1044,14 +1054,13 @@ SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
10441054 return rc ;
10451055
10461056 req -> InfoType = SMB2_O_INFO_FILE ;
1047- req -> FileInfoClass = FILE_ALL_INFORMATION ;
1057+ req -> FileInfoClass = info_class ;
10481058 req -> PersistentFileId = persistent_fid ;
10491059 req -> VolatileFileId = volatile_fid ;
10501060 /* 4 for rfc1002 length field and 1 for Buffer */
10511061 req -> InputBufferOffset =
10521062 cpu_to_le16 (sizeof (struct smb2_query_info_req ) - 1 - 4 );
1053- req -> OutputBufferLength =
1054- cpu_to_le32 (sizeof (struct smb2_file_all_info ) + MAX_NAME * 2 );
1063+ req -> OutputBufferLength = cpu_to_le32 (output_len );
10551064
10561065 iov [0 ].iov_base = (char * )req ;
10571066 /* 4 for rfc1002 length field */
@@ -1067,14 +1076,34 @@ SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
10671076
10681077 rc = validate_and_copy_buf (le16_to_cpu (rsp -> OutputBufferOffset ),
10691078 le32_to_cpu (rsp -> OutputBufferLength ),
1070- & rsp -> hdr , sizeof (struct smb2_file_all_info ),
1071- (char * )data );
1079+ & rsp -> hdr , min_len , data );
10721080
10731081qinf_exit :
10741082 free_rsp_buf (resp_buftype , rsp );
10751083 return rc ;
10761084}
10771085
1086+ int
1087+ SMB2_query_info (const unsigned int xid , struct cifs_tcon * tcon ,
1088+ u64 persistent_fid , u64 volatile_fid ,
1089+ struct smb2_file_all_info * data )
1090+ {
1091+ return query_info (xid , tcon , persistent_fid , volatile_fid ,
1092+ FILE_ALL_INFORMATION ,
1093+ sizeof (struct smb2_file_all_info ) + MAX_NAME * 2 ,
1094+ sizeof (struct smb2_file_all_info ), data );
1095+ }
1096+
1097+ int
1098+ SMB2_get_srv_num (const unsigned int xid , struct cifs_tcon * tcon ,
1099+ u64 persistent_fid , u64 volatile_fid , __le64 * uniqueid )
1100+ {
1101+ return query_info (xid , tcon , persistent_fid , volatile_fid ,
1102+ FILE_INTERNAL_INFORMATION ,
1103+ sizeof (struct smb2_file_internal_info ),
1104+ sizeof (struct smb2_file_internal_info ), uniqueid );
1105+ }
1106+
10781107/*
10791108 * This is a no-op for now. We're not really interested in the reply, but
10801109 * rather in the fact that the server sent one and that server->lstrp
0 commit comments