X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fcifs%2Fcifspdu.h;h=20430a2d201614e771a564f3e8961caecd0a0622;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=8d9b134c2b52f718507ad6d09d500e70ed646ecf;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 8d9b134c2..20430a2d2 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h @@ -34,9 +34,10 @@ #define SMB_COM_DELETE 0x06 #define SMB_COM_RENAME 0x07 #define SMB_COM_LOCKING_ANDX 0x24 +#define SMB_COM_COPY 0x29 #define SMB_COM_READ_ANDX 0x2E #define SMB_COM_WRITE_ANDX 0x2F -#define SMB_COM_TRANSACTION2 0x32 +#define SMB_COM_TRANSACTION2 0x32 #define SMB_COM_TRANSACTION2_SECONDARY 0x33 #define SMB_COM_FIND_CLOSE2 0x34 #define SMB_COM_TREE_DISCONNECT 0x71 @@ -136,15 +137,15 @@ /* * SMB flag2 definitions */ -#define SMBFLG2_KNOWS_LONG_NAMES 0x0001 /* can send long (non-8.3) path names in response */ -#define SMBFLG2_KNOWS_EAS 0x0002 -#define SMBFLG2_SECURITY_SIGNATURE 0x0004 -#define SMBFLG2_IS_LONG_NAME 0x0040 -#define SMBFLG2_EXT_SEC 0x0800 -#define SMBFLG2_DFS 0x1000 -#define SMBFLG2_PAGING_IO 0x2000 -#define SMBFLG2_ERR_STATUS 0x4000 -#define SMBFLG2_UNICODE 0x8000 +#define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3) path names in response */ +#define SMBFLG2_KNOWS_EAS cpu_to_le16(2) +#define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4) +#define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40) +#define SMBFLG2_EXT_SEC cpu_to_le16(0x80) +#define SMBFLG2_DFS cpu_to_le16(0x1000) +#define SMBFLG2_PAGING_IO cpu_to_le16(0x2000) +#define SMBFLG2_ERR_STATUS cpu_to_le16(0x4000) +#define SMBFLG2_UNICODE cpu_to_le16(0x8000) /* * These are the file access permission bits defined in CIFS for the @@ -302,23 +303,23 @@ struct smb_hdr { struct { __u8 ErrorClass; __u8 Reserved; - __u16 Error; /* note: treated as little endian (le) on wire */ + __le16 Error; } DosError; - __u32 CifsError; /* note: le */ + __le32 CifsError; } Status; __u8 Flags; - __u16 Flags2; /* note: le */ - __u16 PidHigh; /* note: le */ + __le16 Flags2; /* note: le */ + __le16 PidHigh; union { struct { - __u32 SequenceNumber; /* le */ + __le32 SequenceNumber; /* le */ __u32 Reserved; /* zero */ } Sequence; __u8 SecuritySignature[8]; /* le */ } Signature; __u8 pad[2]; __u16 Tid; - __u16 Pid; /* note: le */ + __le16 Pid; __u16 Uid; __u16 Mid; __u8 WordCount; @@ -327,7 +328,7 @@ struct smb_hdr { #define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) ) ) /* given a pointer to an smb_hdr retrieve the pointer to the byte area */ -#define pByteArea(smb_var) ((char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) +#define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2* smb_var->WordCount) + 2 ) /* * Computer Name Length @@ -372,23 +373,23 @@ struct smb_hdr { typedef struct negotiate_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; unsigned char DialectsArray[1]; } NEGOTIATE_REQ; typedef struct negotiate_rsp { struct smb_hdr hdr; /* wct = 17 */ - __u16 DialectIndex; + __le16 DialectIndex; __u8 SecurityMode; - __u16 MaxMpxCount; - __u16 MaxNumberVcs; - __u32 MaxBufferSize; - __u32 MaxRawSize; - __u32 SessionKey; - __u32 Capabilities; /* see below */ - __u32 SystemTimeLow; - __u32 SystemTimeHigh; - __u16 ServerTimeZone; + __le16 MaxMpxCount; + __le16 MaxNumberVcs; + __le32 MaxBufferSize; + __le32 MaxRawSize; + __le32 SessionKey; + __le32 Capabilities; /* see below */ + __le32 SystemTimeLow; + __le32 SystemTimeHigh; + __le16 ServerTimeZone; __u8 EncryptionKeyLength; __u16 ByteCount; union { @@ -435,15 +436,15 @@ typedef union smb_com_session_setup_andx { struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 MaxBufferSize; - __u16 MaxMpxCount; - __u16 VcNumber; + __le16 AndXOffset; + __le16 MaxBufferSize; + __le16 MaxMpxCount; + __le16 VcNumber; __u32 SessionKey; - __u16 SecurityBlobLength; + __le16 SecurityBlobLength; __u32 Reserved; - __u32 Capabilities; /* see below */ - __u16 ByteCount; + __le32 Capabilities; /* see below */ + __le16 ByteCount; unsigned char SecurityBlob[1]; /* followed by */ /* STRING NativeOS */ /* STRING NativeLanMan */ @@ -453,16 +454,16 @@ typedef union smb_com_session_setup_andx { struct smb_hdr hdr; /* wct = 13 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 MaxBufferSize; - __u16 MaxMpxCount; - __u16 VcNumber; + __le16 AndXOffset; + __le16 MaxBufferSize; + __le16 MaxMpxCount; + __le16 VcNumber; __u32 SessionKey; - __u16 CaseInsensitivePasswordLength; /* ASCII password length */ - __u16 CaseSensitivePasswordLength; /* Unicode password length */ + __le16 CaseInsensitivePasswordLength; /* ASCII password length */ + __le16 CaseSensitivePasswordLength; /* Unicode password length */ __u32 Reserved; /* see below */ - __u32 Capabilities; - __u16 ByteCount; + __le32 Capabilities; + __le16 ByteCount; unsigned char CaseInsensitivePassword[1]; /* followed by: */ /* unsigned char * CaseSensitivePassword; */ /* STRING AccountName */ @@ -475,9 +476,9 @@ typedef union smb_com_session_setup_andx { struct smb_hdr hdr; /* wct = 4 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Action; /* see below */ - __u16 SecurityBlobLength; + __le16 AndXOffset; + __le16 Action; /* see below */ + __le16 SecurityBlobLength; __u16 ByteCount; unsigned char SecurityBlob[1]; /* followed by */ /* unsigned char * NativeOS; */ @@ -489,14 +490,14 @@ typedef union smb_com_session_setup_andx { struct smb_hdr hdr; /* wct = 10 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 MaxBufferSize; - __u16 MaxMpxCount; - __u16 VcNumber; + __le16 AndXOffset; + __le16 MaxBufferSize; + __le16 MaxMpxCount; + __le16 VcNumber; __u32 SessionKey; - __u16 PassswordLength; + __le16 PassswordLength; __u32 Reserved; - __u16 ByteCount; + __le16 ByteCount; unsigned char AccountPassword[1]; /* followed by */ /* STRING AccountName */ /* STRING PrimaryDomain */ @@ -508,8 +509,8 @@ typedef union smb_com_session_setup_andx { struct smb_hdr hdr; /* wct = 3 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Action; /* see below */ + __le16 AndXOffset; + __le16 Action; /* see below */ __u16 ByteCount; unsigned char NativeOS[1]; /* followed by */ /* unsigned char * NativeLanMan; */ @@ -536,10 +537,10 @@ typedef struct smb_com_tconx_req { struct smb_hdr hdr; /* wct = 4 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Flags; /* see below */ - __u16 PasswordLength; - __u16 ByteCount; + __le16 AndXOffset; + __le16 Flags; /* see below */ + __le16 PasswordLength; + __le16 ByteCount; unsigned char Password[1]; /* followed by */ /* STRING Path *//* \\server\share name */ /* STRING Service */ @@ -549,8 +550,8 @@ typedef struct smb_com_tconx_rsp { struct smb_hdr hdr; /* wct = 3 *//* note that Win2000 has sent wct=7 in some cases on responses. Four unspecified words followed OptionalSupport */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 OptionalSupport; /* see below */ + __le16 AndXOffset; + __le16 OptionalSupport; /* see below */ __u16 ByteCount; unsigned char Service[1]; /* always ASCII, not Unicode */ /* STRING NativeFileSystem */ @@ -618,20 +619,20 @@ typedef struct smb_com_open_req { /* also handles create */ struct smb_hdr hdr; /* wct = 24 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u8 Reserved; /* Must Be Zero */ - __u16 NameLength; - __u32 OpenFlags; - __u32 RootDirectoryFid; - __u32 DesiredAccess; - __u64 AllocationSize; - __u32 FileAttributes; - __u32 ShareAccess; - __u32 CreateDisposition; - __u32 CreateOptions; - __u32 ImpersonationLevel; + __le16 NameLength; + __le32 OpenFlags; + __le32 RootDirectoryFid; + __le32 DesiredAccess; + __le64 AllocationSize; + __le32 FileAttributes; + __le32 ShareAccess; + __le32 CreateDisposition; + __le32 CreateOptions; + __le32 ImpersonationLevel; __u8 SecurityFlags; - __u16 ByteCount; + __le16 ByteCount; char fileName[1]; } OPEN_REQ; @@ -648,19 +649,19 @@ typedef struct smb_com_open_rsp { struct smb_hdr hdr; /* wct = 34 BB */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u8 OplockLevel; __u16 Fid; - __u32 CreateAction; - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u32 FileAttributes; - __u64 AllocationSize; - __u64 EndOfFile; - __u16 FileType; - __u16 DeviceState; + __le32 CreateAction; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le32 FileAttributes; + __le64 AllocationSize; + __le64 EndOfFile; + __le16 FileType; + __le16 DeviceState; __u8 DirectoryFlag; __u16 ByteCount; /* bct = 0 */ } OPEN_RSP; @@ -669,17 +670,17 @@ typedef struct smb_com_write_req { struct smb_hdr hdr; /* wct = 14 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 Fid; - __u32 OffsetLow; + __le32 OffsetLow; __u32 Reserved; - __u16 WriteMode; - __u16 Remaining; - __u16 DataLengthHigh; - __u16 DataLengthLow; - __u16 DataOffset; - __u32 OffsetHigh; - __u16 ByteCount; + __le16 WriteMode; + __le16 Remaining; + __le16 DataLengthHigh; + __le16 DataLengthLow; + __le16 DataOffset; + __le32 OffsetHigh; + __le16 ByteCount; __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ char Data[1]; } WRITE_REQ; @@ -688,10 +689,10 @@ typedef struct smb_com_write_rsp { struct smb_hdr hdr; /* wct = 6 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Count; - __u16 Remaining; - __u32 Reserved; + __le16 AndXOffset; + __le16 Count; + __le16 Remaining; + __le32 Reserved; __u16 ByteCount; } WRITE_RSP; @@ -699,28 +700,28 @@ typedef struct smb_com_read_req { struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 Fid; - __u32 OffsetLow; - __u16 MaxCount; - __u16 MinCount; /* obsolete */ - __u32 MaxCountHigh; - __u16 Remaining; - __u32 OffsetHigh; - __u16 ByteCount; + __le32 OffsetLow; + __le16 MaxCount; + __le16 MinCount; /* obsolete */ + __le32 MaxCountHigh; + __le16 Remaining; + __le32 OffsetHigh; + __le16 ByteCount; } READ_REQ; typedef struct smb_com_read_rsp { struct smb_hdr hdr; /* wct = 12 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; - __u16 Remaining; - __u16 DataCompactionMode; - __u16 Reserved; - __u16 DataLength; - __u16 DataOffset; - __u16 DataLengthHigh; + __le16 AndXOffset; + __le16 Remaining; + __le16 DataCompactionMode; + __le16 Reserved; + __le16 DataLength; + __le16 DataOffset; + __le16 DataLengthHigh; __u64 Reserved2; __u16 ByteCount; __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ @@ -728,12 +729,12 @@ typedef struct smb_com_read_rsp { } READ_RSP; typedef struct locking_andx_range { - __u16 Pid; - __u16 Pad; - __u32 OffsetHigh; - __u32 OffsetLow; - __u32 LengthHigh; - __u32 LengthLow; + __le16 Pid; + __le16 Pad; + __le32 OffsetHigh; + __le32 OffsetLow; + __le32 LengthHigh; + __le32 LengthLow; } LOCKING_ANDX_RANGE; #define LOCKING_ANDX_SHARED_LOCK 0x01 @@ -746,14 +747,14 @@ typedef struct smb_com_lock_req { struct smb_hdr hdr; /* wct = 8 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 Fid; __u8 LockType; __u8 OplockLevel; - __u32 Timeout; - __u16 NumberOfUnlocks; - __u16 NumberOfLocks; - __u16 ByteCount; + __le32 Timeout; + __le16 NumberOfUnlocks; + __le16 NumberOfLocks; + __le16 ByteCount; LOCKING_ANDX_RANGE Locks[1]; } LOCK_REQ; @@ -761,30 +762,58 @@ typedef struct smb_com_lock_rsp { struct smb_hdr hdr; /* wct = 2 */ __u8 AndXCommand; __u8 AndXReserved; - __u16 AndXOffset; + __le16 AndXOffset; __u16 ByteCount; } LOCK_RSP; typedef struct smb_com_rename_req { struct smb_hdr hdr; /* wct = 1 */ - __u16 SearchAttributes; /* target file attributes */ - __u16 ByteCount; + __le16 SearchAttributes; /* target file attributes */ + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII or Unicode */ unsigned char OldFileName[1]; /* followed by __u8 BufferFormat2 */ /* followed by NewFileName */ } RENAME_REQ; + /* copy request flags */ +#define COPY_MUST_BE_FILE 0x0001 +#define COPY_MUST_BE_DIR 0x0002 +#define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */ +#define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */ +#define COPY_VERIFY_WRITES 0x0010 +#define COPY_TREE 0x0020 + +typedef struct smb_com_copy_req { + struct smb_hdr hdr; /* wct = 3 */ + __u16 Tid2; + __le16 OpenFunction; + __le16 Flags; + __le16 ByteCount; + __u8 BufferFormat; /* 4 = ASCII or Unicode */ + unsigned char OldFileName[1]; + /* followed by __u8 BufferFormat2 */ + /* followed by NewFileName string */ +} COPY_REQ; + +typedef struct smb_com_copy_rsp { + struct smb_hdr hdr; /* wct = 1 */ + __le16 CopyCount; /* number of files copied */ + __u16 ByteCount; /* may be zero */ + __u8 BufferFormat; /* 0x04 - only present if errored file follows */ + unsigned char ErrorFileName[1]; /* only present if error in copy */ +} COPY_RSP; + #define CREATE_HARD_LINK 0x103 #define MOVEFILE_COPY_ALLOWED 0x0002 #define MOVEFILE_REPLACE_EXISTING 0x0001 typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */ struct smb_hdr hdr; /* wct = 4 */ - __u16 SearchAttributes; /* target file attributes */ - __u16 Flags; /* spec says Information Level */ - __u32 ClusterCount; - __u16 ByteCount; + __le16 SearchAttributes; /* target file attributes */ + __le16 Flags; /* spec says Information Level */ + __le32 ClusterCount; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII or Unicode */ unsigned char OldFileName[1]; /* followed by __u8 BufferFormat2 */ @@ -798,8 +827,8 @@ typedef struct smb_com_rename_rsp { typedef struct smb_com_delete_file_req { struct smb_hdr hdr; /* wct = 1 */ - __u16 SearchAttributes; - __u16 ByteCount; + __le16 SearchAttributes; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII */ unsigned char fileName[1]; } DELETE_FILE_REQ; @@ -811,7 +840,7 @@ typedef struct smb_com_delete_file_rsp { typedef struct smb_com_delete_directory_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII */ unsigned char DirName[1]; } DELETE_DIRECTORY_REQ; @@ -823,7 +852,7 @@ typedef struct smb_com_delete_directory_rsp { typedef struct smb_com_create_directory_req { struct smb_hdr hdr; /* wct = 0 */ - __u16 ByteCount; + __le16 ByteCount; __u8 BufferFormat; /* 4 = ASCII */ unsigned char DirName[1]; } CREATE_DIRECTORY_REQ; @@ -833,26 +862,30 @@ typedef struct smb_com_create_directory_rsp { __u16 ByteCount; /* bct = 0 */ } CREATE_DIRECTORY_RSP; +/***************************************************/ +/* NT Transact structure defintions follow */ +/* Currently only ioctl and notify are implemented */ +/***************************************************/ typedef struct smb_com_transaction_ioctl_req { struct smb_hdr hdr; /* wct = 23 */ __u8 MaxSetupCount; __u16 Reserved; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 MaxParameterCount; - __u32 MaxDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 DataCount; - __u32 DataOffset; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 MaxParameterCount; + __le32 MaxDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 DataCount; + __le32 DataOffset; __u8 SetupCount; /* four setup words follow subcommand */ /* SNIA spec incorrectly included spurious pad here */ - __u16 SubCommand;/* 2 = IOCTL/FSCTL */ - __u32 FunctionCode; + __le16 SubCommand;/* 2 = IOCTL/FSCTL */ + __le32 FunctionCode; __u16 Fid; __u8 IsFsctl; /* 1 = File System Control, 0 = device control (IOCTL)*/ __u8 IsRootFlag; /* 1 = apply command to root of share (must be DFS share)*/ - __u16 ByteCount; + __le16 ByteCount; __u8 Pad[3]; __u8 Data[1]; } TRANSACT_IOCTL_REQ; @@ -860,44 +893,60 @@ typedef struct smb_com_transaction_ioctl_req { typedef struct smb_com_transaction_ioctl_rsp { struct smb_hdr hdr; /* wct = 19 */ __u8 Reserved[3]; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 ParameterDisplacement; - __u32 DataCount; - __u32 DataOffset; - __u32 DataDisplacement; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 ParameterDisplacement; + __le32 DataCount; + __le32 DataOffset; + __le32 DataDisplacement; __u8 SetupCount; /* 1 */ - __u16 ReturnedDataLen; + __le16 ReturnedDataLen; __u16 ByteCount; __u8 Pad[3]; } TRANSACT_IOCTL_RSP; typedef struct smb_com_transaction_change_notify_req { - struct smb_hdr hdr; /* wct = 23 */ - __u8 MaxSetupCount; - __u16 Reserved; - __u32 TotalParameterCount; - __u32 TotalDataCount; - __u32 MaxParameterCount; - __u32 MaxDataCount; - __u32 ParameterCount; - __u32 ParameterOffset; - __u32 DataCount; - __u32 DataOffset; - __u8 SetupCount; /* four setup words follow subcommand */ - /* SNIA spec incorrectly included spurious pad here */ - __u16 SubCommand;/* 4 = Change Notify */ - __u32 CompletionFilter; /* operation to monitor */ + struct smb_hdr hdr; /* wct = 23 */ + __u8 MaxSetupCount; + __u16 Reserved; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 MaxParameterCount; + __le32 MaxDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 DataCount; + __le32 DataOffset; + __u8 SetupCount; /* four setup words follow subcommand */ + /* SNIA spec incorrectly included spurious pad here */ + __le16 SubCommand;/* 4 = Change Notify */ + __le32 CompletionFilter; /* operation to monitor */ __u16 Fid; __u8 WatchTree; /* 1 = Monitor subdirectories */ - __u16 ByteCount; - __u8 Pad[3]; - __u8 Data[1]; + __u8 Reserved2; + __le16 ByteCount; +/* __u8 Pad[3];*/ +/* __u8 Data[1];*/ } TRANSACT_CHANGE_NOTIFY_REQ; -/* Completion Filter flags */ +typedef struct smb_com_transaction_change_notify_rsp { + struct smb_hdr hdr; /* wct = 18 */ + __u8 Reserved[3]; + __le32 TotalParameterCount; + __le32 TotalDataCount; + __le32 ParameterCount; + __le32 ParameterOffset; + __le32 ParameterDisplacement; + __le32 DataCount; + __le32 DataOffset; + __le32 DataDisplacement; + __u8 SetupCount; /* 0 */ + __u16 ByteCount; + /* __u8 Pad[3]; */ +} TRANSACT_CHANGE_NOTIFY_RSP; +/* Completion Filter flags for Notify */ #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 #define FILE_NOTIFY_CHANGE_NAME 0x00000003 @@ -912,6 +961,15 @@ typedef struct smb_com_transaction_change_notify_req { #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 +#define FILE_ACTION_ADDED 0x00000001 +#define FILE_ACTION_REMOVED 0x00000002 +#define FILE_ACTION_MODIFIED 0x00000003 +#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 +#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 +#define FILE_ACTION_ADDED_STREAM 0x00000006 +#define FILE_ACTION_REMOVED_STREAM 0x00000007 +#define FILE_ACTION_MODIFIED_STREAM 0x00000008 + /* response contains array of the following structures */ struct file_notify_information { __u32 NextEntryOffset; @@ -988,9 +1046,14 @@ typedef union smb_com_transaction2 { /* PathInfo/FileInfo infolevels */ #define SMB_INFO_STANDARD 1 +#define SMB_SET_FILE_EA 2 +#define SMB_QUERY_FILE_EA_SIZE 2 +#define SMB_INFO_QUERY_EAS_FROM_LIST 3 +#define SMB_INFO_QUERY_ALL_EAS 4 #define SMB_INFO_IS_NAME_VALID 6 #define SMB_QUERY_FILE_BASIC_INFO 0x101 #define SMB_QUERY_FILE_STANDARD_INFO 0x102 +#define SMB_QUERY_FILE_EA_INFO 0x103 #define SMB_QUERY_FILE_NAME_INFO 0x104 #define SMB_QUERY_FILE_ALLOCATION_INFO 0x105 #define SMB_QUERY_FILE_END_OF_FILEINFO 0x106 @@ -1010,8 +1073,13 @@ typedef union smb_com_transaction2 { #define SMB_SET_FILE_UNIX_HLINK 0x203 #define SMB_SET_FILE_BASIC_INFO2 0x3ec #define SMB_SET_FILE_RENAME_INFORMATION 0x3f2 +#define SMB_FILE_ALL_INFO2 0x3fa #define SMB_SET_FILE_ALLOCATION_INFO2 0x3fb #define SMB_SET_FILE_END_OF_FILE_INFO2 0x3fc +#define SMB_FILE_MOVE_CLUSTER_INFO 0x407 +#define SMB_FILE_QUOTA_INFO 0x408 +#define SMB_FILE_REPARSEPOINT_INFO 0x409 +#define SMB_FILE_MAXIMUM_INFO 0x40d /* Find File infolevels */ #define SMB_FIND_FILE_DIRECTORY_INFO 0x101 @@ -1022,40 +1090,40 @@ typedef union smb_com_transaction2 { typedef struct smb_com_transaction2_qpi_req { struct smb_hdr hdr; /* wct = 14+ */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; - __u16 InformationLevel; + __le16 InformationLevel; __u32 Reserved4; char FileName[1]; } TRANSACTION2_QPI_REQ; typedef struct smb_com_transaction2_qpi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 Reserved; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1064,41 +1132,41 @@ typedef struct smb_com_transaction2_qpi_rsp { typedef struct smb_com_transaction2_spi_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; __u16 Pad1; - __u16 InformationLevel; + __le16 InformationLevel; __u32 Reserved4; char FileName[1]; } TRANSACTION2_SPI_REQ; typedef struct smb_com_transaction2_spi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1106,49 +1174,49 @@ typedef struct smb_com_transaction2_spi_rsp { } TRANSACTION2_SPI_RSP; struct set_file_rename { - __u32 overwrite; /* 1 = overwrite dest */ + __le32 overwrite; /* 1 = overwrite dest */ __u32 root_fid; /* zero */ - __u32 target_name_len; + __le32 target_name_len; char target_name[0]; /* Must be unicode */ }; struct smb_com_transaction2_sfi_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; __u16 Pad1; __u16 Fid; - __u16 InformationLevel; + __le16 InformationLevel; __u16 Reserved4; }; struct smb_com_transaction2_sfi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1172,43 +1240,43 @@ struct smb_com_transaction2_sfi_rsp { typedef struct smb_com_transaction2_ffirst_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; /* one */ __u8 Reserved3; - __u16 SubCommand; /* TRANS2_FIND_FIRST */ - __u16 ByteCount; + __le16 SubCommand; /* TRANS2_FIND_FIRST */ + __le16 ByteCount; __u8 Pad; - __u16 SearchAttributes; - __u16 SearchCount; - __u16 SearchFlags; - __u16 InformationLevel; - __u32 SearchStorageType; + __le16 SearchAttributes; + __le16 SearchCount; + __le16 SearchFlags; + __le16 InformationLevel; + __le32 SearchStorageType; char FileName[1]; } TRANSACTION2_FFIRST_REQ; typedef struct smb_com_transaction2_ffirst_rsp { struct smb_hdr hdr; /* wct = 10 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1216,63 +1284,64 @@ typedef struct smb_com_transaction2_ffirst_rsp { typedef struct smb_com_transaction2_ffirst_rsp_parms { __u16 SearchHandle; - __u16 SearchCount; - __u16 EndofSearch; - __u16 EAErrorOffset; - __u16 LastNameOffset; + __le16 SearchCount; + __le16 EndofSearch; + __le16 EAErrorOffset; + __le16 LastNameOffset; } T2_FFIRST_RSP_PARMS; typedef struct smb_com_transaction2_fnext_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; /* one */ __u8 Reserved3; - __u16 SubCommand; /* TRANS2_FIND_NEXT */ - __u16 ByteCount; + __le16 SubCommand; /* TRANS2_FIND_NEXT */ + __le16 ByteCount; __u8 Pad; __u16 SearchHandle; - __u16 SearchCount; - __u16 InformationLevel; + __le16 SearchCount; + __le16 InformationLevel; __u32 ResumeKey; - __u16 SearchFlags; + __le16 SearchFlags; char ResumeFileName[1]; } TRANSACTION2_FNEXT_REQ; typedef struct smb_com_transaction2_fnext_rsp { struct smb_hdr hdr; /* wct = 10 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; } TRANSACTION2_FNEXT_RSP; typedef struct smb_com_transaction2_fnext_rsp_parms { - __u16 SearchCount; - __u16 EndofSearch; - __u16 EAErrorOffset; - __u16 LastNameOffset; + __le16 SearchCount; + __le16 EndofSearch; + __le16 EAErrorOffset; + __le16 LastNameOffset; } T2_FNEXT_RSP_PARMS; +/* QFSInfo Levels */ #define SMB_INFO_ALLOCATION 1 #define SMB_INFO_VOLUME 2 #define SMB_QUERY_FS_VOLUME_INFO 0x102 @@ -1280,41 +1349,43 @@ typedef struct smb_com_transaction2_fnext_rsp_parms { #define SMB_QUERY_FS_DEVICE_INFO 0x104 #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105 #define SMB_QUERY_CIFS_UNIX_INFO 0x200 +#define SMB_QUERY_LABEL_INFO 0x3ea +#define SMB_QUERY_FS_QUOTA_INFO 0x3ee typedef struct smb_com_transaction2_qfsi_req { struct smb_hdr hdr; /* wct = 14+ */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __le16 SubCommand; /* one setup word */ + __le16 ByteCount; __u8 Pad; - __u16 InformationLevel; + __le16 InformationLevel; } TRANSACTION2_QFSI_REQ; typedef struct smb_com_transaction_qfsi_rsp { struct smb_hdr hdr; /* wct = 10 + SetupCount */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* should be zero setup words following */ __u16 ByteCount; @@ -1323,58 +1394,58 @@ typedef struct smb_com_transaction_qfsi_rsp { typedef struct smb_com_transaction2_get_dfs_refer_req { struct smb_hdr hdr; /* wct = 15 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; - __u16 MaxParameterCount; - __u16 MaxDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; + __le16 MaxParameterCount; + __le16 MaxDataCount; __u8 MaxSetupCount; __u8 Reserved; - __u16 Flags; - __u32 Timeout; + __le16 Flags; + __le32 Timeout; __u16 Reserved2; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 DataCount; - __u16 DataOffset; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 DataCount; + __le16 DataOffset; __u8 SetupCount; __u8 Reserved3; - __u16 SubCommand; /* one setup word */ - __u16 ByteCount; + __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 */ - __u16 MaxReferralLevel; + __le16 MaxReferralLevel; char RequestFileName[1]; } TRANSACTION2_GET_DFS_REFER_REQ; typedef struct dfs_referral_level_3 { - __u16 VersionNumber; - __u16 ReferralSize; - __u16 ServerType; /* 0x0001 = CIFS server */ - __u16 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 */ - __u16 TimeToLive; - __u16 Proximity; - __u16 DfsPathOffset; - __u16 DfsAlternatePathOffset; - __u16 NetworkAddressOffset; + __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 TimeToLive; + __le16 Proximity; + __le16 DfsPathOffset; + __le16 DfsAlternatePathOffset; + __le16 NetworkAddressOffset; } REFERRAL3; typedef struct smb_com_transaction_get_dfs_refer_rsp { struct smb_hdr hdr; /* wct = 10 */ - __u16 TotalParameterCount; - __u16 TotalDataCount; + __le16 TotalParameterCount; + __le16 TotalDataCount; __u16 Reserved; - __u16 ParameterCount; - __u16 ParameterOffset; - __u16 ParameterDisplacement; - __u16 DataCount; - __u16 DataOffset; - __u16 DataDisplacement; + __le16 ParameterCount; + __le16 ParameterOffset; + __le16 ParameterDisplacement; + __le16 DataCount; + __le16 DataOffset; + __le16 DataDisplacement; __u8 SetupCount; __u8 Reserved1; /* zero setup words following */ __u16 ByteCount; __u8 Pad; - __u16 PathConsumed; - __u16 NumberOfReferrals; - __u16 DFSFlags; + __le16 PathConsumed; + __le16 NumberOfReferrals; + __le16 DFSFlags; __u16 Pad2; REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */ /* followed by the strings pointed to by the referral structures */ @@ -1460,16 +1531,16 @@ struct aliasInfo92 { }; typedef struct { - __u64 TotalAllocationUnits; - __u64 FreeAllocationUnits; - __u32 SectorsPerAllocationUnit; - __u32 BytesPerSector; + __le64 TotalAllocationUnits; + __le64 FreeAllocationUnits; + __le32 SectorsPerAllocationUnit; + __le32 BytesPerSector; } FILE_SYSTEM_INFO; /* size info, level 0x103 */ typedef struct { - __u16 MajorVersionNumber; - __u16 MinorVersionNumber; - __u64 Capability; + __le16 MajorVersionNumber; + __le16 MinorVersionNumber; + __le64 Capability; } FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ /* Linux/Unix extensions capability flags */ #define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */ @@ -1496,61 +1567,74 @@ typedef struct { #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028 typedef struct { - __u32 DeviceType; - __u32 DeviceCharacteristics; + __le32 DeviceType; + __le32 DeviceCharacteristics; } FILE_SYSTEM_DEVICE_INFO; /* device info, level 0x104 */ typedef struct { - __u32 Attributes; - __u32 MaxPathNameComponentLength; - __u32 FileSystemNameLen; + __le32 Attributes; + __le32 MaxPathNameComponentLength; + __le32 FileSystemNameLen; char FileSystemName[52]; /* do not really need to save this - so potentially get only subset of name */ } FILE_SYSTEM_ATTRIBUTE_INFO; typedef struct { /* data block encoding of response to level 263 QPathInfo */ - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u32 Attributes; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le32 Attributes; __u32 Pad1; - __u64 AllocationSize; - __u64 EndOfFile; /* size ie offset to first free byte in file */ - __u32 NumberOfLinks; /* hard links */ + __le64 AllocationSize; + __le64 EndOfFile; /* size ie offset to first free byte in file */ + __le32 NumberOfLinks; /* hard links */ __u8 DeletePending; __u8 Directory; __u16 Pad2; __u64 IndexNumber; - __u32 EASize; - __u32 AccessFlags; + __le32 EASize; + __le32 AccessFlags; __u64 IndexNumber1; - __u64 CurrentByteOffset; - __u32 Mode; - __u32 AlignmentRequirement; - __u32 FileNameLength; + __le64 CurrentByteOffset; + __le32 Mode; + __le32 AlignmentRequirement; + __le32 FileNameLength; char FileName[1]; } FILE_ALL_INFO; /* level 263 QPathInfo */ typedef struct { - __u64 EndOfFile; - __u64 NumOfBytes; - __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ - __u64 LastAccessTime; - __u64 LastModificationTime; - __u64 Uid; - __u64 Gid; - __u32 Type; - __u64 DevMajor; - __u64 DevMinor; + __le64 EndOfFile; + __le64 NumOfBytes; + __le64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ + __le64 LastAccessTime; + __le64 LastModificationTime; + __le64 Uid; + __le64 Gid; + __le32 Type; + __le64 DevMajor; + __le64 DevMinor; __u64 UniqueId; - __u64 Permissions; - __u64 Nlinks; + __le64 Permissions; + __le64 Nlinks; } FILE_UNIX_BASIC_INFO; /* level 512 QPathInfo */ typedef struct { char LinkDest[1]; } FILE_UNIX_LINK_INFO; /* level 513 QPathInfo */ +typedef struct { + __u16 CreationDate; + __u16 CreationTime; + __u16 LastAccessDate; + __u16 LastAccessTime; + __u16 LastWriteDate; + __u16 LastWriteTime; + __u32 DataSize; /* File Size (EOF) */ + __u32 AllocationSize; + __u16 Attributes; /* verify not u32 */ + __u32 EASize; +} FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */ + /* defines for enumerating possible values of the Unix type field below */ #define UNIX_FILE 0 #define UNIX_DIR 1 @@ -1561,76 +1645,77 @@ typedef struct { #define UNIX_SOCKET 6 typedef struct { - __u32 NextEntryOffset; - __u32 ResumeKey; - __u64 EndOfFile; - __u64 NumOfBytes; - __u64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ - __u64 LastAccessTime; - __u64 LastModificationTime; - __u64 Uid; - __u64 Gid; - __u32 Type; - __u64 DevMajor; - __u64 DevMinor; - __u64 UniqueId; - __u64 Permissions; - __u64 Nlinks; + __le32 NextEntryOffset; + __le32 ResumeKey; + __le64 EndOfFile; + __le64 NumOfBytes; + __le64 LastStatusChange; /*SNIA spec says DCE time for the three time fields */ + __le64 LastAccessTime; + __le64 LastModificationTime; + __le64 Uid; + __le64 Gid; + __le32 Type; + __le64 DevMajor; + __le64 DevMinor; + __le64 UniqueId; + __le64 Permissions; + __le64 Nlinks; char FileName[1]; } FILE_UNIX_INFO; typedef struct { - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u32 Attributes; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le32 Attributes; __u32 Pad; } FILE_BASIC_INFO; /* size info, level 0x101 */ struct file_allocation_info { - __u64 AllocationSize; + __le64 AllocationSize; }; /* size info, level 0x103 */ struct file_end_of_file_info { - __u64 FileSize; /* offset to end of file */ + __le64 FileSize; /* offset to end of file */ }; /* size info, level 0x104 */ typedef struct { - __u32 NextEntryOffset; + __le32 NextEntryOffset; __u32 FileIndex; - __u64 CreationTime; - __u64 LastAccessTime; - __u64 LastWriteTime; - __u64 ChangeTime; - __u64 EndOfFile; - __u64 AllocationSize; - __u32 ExtFileAttributes; - __u32 FileNameLength; + __le64 CreationTime; + __le64 LastAccessTime; + __le64 LastWriteTime; + __le64 ChangeTime; + __le64 EndOfFile; + __le64 AllocationSize; + __le32 ExtFileAttributes; + __le32 FileNameLength; char FileName[1]; } FILE_DIRECTORY_INFO; /* level 257 FF response data area */ struct gea { - unsigned char cbName; - char szName[1]; + unsigned char name_len; + char name[1]; }; struct gealist { - unsigned long cbList; + unsigned long list_len; struct gea list[1]; }; struct fea { - unsigned char fEA; - unsigned char cbName; - unsigned short cbValue; - char szName[1]; + unsigned char EA_flags; + __u8 name_len; + __le16 value_len; + char name[1]; + /* optionally followed by value */ }; /* flags for _FEA.fEA */ #define FEA_NEEDEA 0x80 /* need EA bit */ struct fealist { - unsigned long cbList; + __le32 list_len; struct fea list[1]; }; @@ -1641,6 +1726,112 @@ struct data_blob { void (*free) (struct data_blob * data_blob); }; + +#ifdef CONFIG_CIFS_POSIX +/* + For better POSIX semantics from Linux client, (even better + than the existing CIFS Unix Extensions) we need updated PDUs for: + + 1) PosixCreateX - to set and return the mode, inode#, device info and + perhaps add a CreateDevice - to create Pipes and other special .inodes + Also note POSIX open flags + 2) Close - to return the last write time to do cache across close more safely + 3) PosixQFSInfo - to return statfs info + 4) FindFirst return unique inode number - what about resume key, two forms short (matches readdir) and full (enough info to cache inodes) + 5) Mkdir - set mode + + And under consideration: + 6) FindClose2 (return nanosecond timestamp ??) + 7) Use nanosecond timestamps throughout all time fields if + corresponding attribute flag is set + 8) sendfile - handle based copy + 9) Direct i/o + 10) "POSIX ACL" support + 11) Misc fcntls? + + what about fixing 64 bit alignment + + There are also various legacy SMB/CIFS requests used as is + + From existing Lanman and NTLM dialects: + -------------------------------------- + NEGOTIATE + SESSION_SETUP_ANDX (BB which?) + TREE_CONNECT_ANDX (BB which wct?) + TREE_DISCONNECT (BB add volume timestamp on response) + LOGOFF_ANDX + DELETE (note delete open file behavior) + DELETE_DIRECTORY + READ_AND_X + WRITE_AND_X + LOCKING_AND_X (note posix lock semantics) + RENAME (note rename across dirs and open file rename posix behaviors) + NT_RENAME (for hardlinks) Is this good enough for all features? + FIND_CLOSE2 + TRANSACTION2 (18 cases) + SMB_SET_FILE_END_OF_FILE_INFO2 SMB_SET_PATH_END_OF_FILE_INFO2 + (BB verify that never need to set allocation size) + SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via Unix ext?) + + COPY (note support for copy across directories) - FUTURE, OPTIONAL + setting/getting OS/2 EAs - FUTURE (BB can this handle + setting Linux xattrs perfectly) - OPTIONAL + dnotify - FUTURE, OPTIONAL + quota - FUTURE, OPTIONAL + + Note that various requests implemented for NT interop such as + NT_TRANSACT (IOCTL) QueryReparseInfo + are unneeded to servers compliant with the CIFS POSIX extensions + + From CIFS Unix Extensions: + ------------------------- + 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 + BB what about a) blksize/blkbits/blocks + b) i_version + c) i_rdev + d) notify mask? + e) generation + f) size_seqcount + 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 that can be used + to save symlink info in a regular file when + mounted to operating systems that do not + support the cifs Unix extensions or EAs (for xattr + based symlinks). For such a file to be recognized + as containing symlink data: + + 1) file size must be 1067, + 2) signature must begin file data, + 3) length field must be set to ASCII representation + of a number which is less than or equal to 1024, + 4) md5 must match that of the path data */ + +struct xsymlink { + /* 1067 bytes */ + char signature[4]; /* XSym */ /* not null terminated */ + char cr0; /* \n */ +/* ASCII representation of length (4 bytes decimal) terminated by \n not null */ + char length[4]; + char cr1; /* \n */ +/* md5 of valid subset of path ie path[0] through path[length-1] */ + __u8 md5[32]; + char cr2; /* \n */ +/* if room left, then end with \n then 0x20s by convention but not required */ + char path[1024]; +}; + +#endif + #pragma pack() /* resume default structure packing */ #endif /* _CIFSPDU_H */