diff options
Diffstat (limited to 'fs/cifs/cifspdu.h')
-rw-r--r-- | fs/cifs/cifspdu.h | 174 |
1 files changed, 163 insertions, 11 deletions
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index aede6a813167..193f06eb43f9 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -36,9 +36,11 @@ | |||
36 | #define SMB_COM_CLOSE 0x04 /* triv req/rsp, timestamp ignored */ | 36 | #define SMB_COM_CLOSE 0x04 /* triv req/rsp, timestamp ignored */ |
37 | #define SMB_COM_DELETE 0x06 /* trivial response */ | 37 | #define SMB_COM_DELETE 0x06 /* trivial response */ |
38 | #define SMB_COM_RENAME 0x07 /* trivial response */ | 38 | #define SMB_COM_RENAME 0x07 /* trivial response */ |
39 | #define SMB_COM_QUERY_INFORMATION 0x08 /* aka getattr */ | ||
39 | #define SMB_COM_SETATTR 0x09 /* trivial response */ | 40 | #define SMB_COM_SETATTR 0x09 /* trivial response */ |
40 | #define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */ | 41 | #define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */ |
41 | #define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/ | 42 | #define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/ |
43 | #define SMB_COM_OPEN_ANDX 0x2D /* Legacy open for old servers */ | ||
42 | #define SMB_COM_READ_ANDX 0x2E | 44 | #define SMB_COM_READ_ANDX 0x2E |
43 | #define SMB_COM_WRITE_ANDX 0x2F | 45 | #define SMB_COM_WRITE_ANDX 0x2F |
44 | #define SMB_COM_TRANSACTION2 0x32 | 46 | #define SMB_COM_TRANSACTION2 0x32 |
@@ -52,6 +54,7 @@ | |||
52 | #define SMB_COM_NT_TRANSACT 0xA0 | 54 | #define SMB_COM_NT_TRANSACT 0xA0 |
53 | #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 | 55 | #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1 |
54 | #define SMB_COM_NT_CREATE_ANDX 0xA2 | 56 | #define SMB_COM_NT_CREATE_ANDX 0xA2 |
57 | #define SMB_COM_NT_CANCEL 0xA4 /* no response */ | ||
55 | #define SMB_COM_NT_RENAME 0xA5 /* trivial response */ | 58 | #define SMB_COM_NT_RENAME 0xA5 /* trivial response */ |
56 | 59 | ||
57 | /* Transact2 subcommand codes */ | 60 | /* Transact2 subcommand codes */ |
@@ -59,6 +62,7 @@ | |||
59 | #define TRANS2_FIND_FIRST 0x01 | 62 | #define TRANS2_FIND_FIRST 0x01 |
60 | #define TRANS2_FIND_NEXT 0x02 | 63 | #define TRANS2_FIND_NEXT 0x02 |
61 | #define TRANS2_QUERY_FS_INFORMATION 0x03 | 64 | #define TRANS2_QUERY_FS_INFORMATION 0x03 |
65 | #define TRANS2_SET_FS_INFORMATION 0x04 | ||
62 | #define TRANS2_QUERY_PATH_INFORMATION 0x05 | 66 | #define TRANS2_QUERY_PATH_INFORMATION 0x05 |
63 | #define TRANS2_SET_PATH_INFORMATION 0x06 | 67 | #define TRANS2_SET_PATH_INFORMATION 0x06 |
64 | #define TRANS2_QUERY_FILE_INFORMATION 0x07 | 68 | #define TRANS2_QUERY_FILE_INFORMATION 0x07 |
@@ -267,10 +271,18 @@ | |||
267 | /* CreateOptions */ | 271 | /* CreateOptions */ |
268 | #define CREATE_NOT_FILE 0x00000001 /* if set must not be file */ | 272 | #define CREATE_NOT_FILE 0x00000001 /* if set must not be file */ |
269 | #define CREATE_WRITE_THROUGH 0x00000002 | 273 | #define CREATE_WRITE_THROUGH 0x00000002 |
270 | #define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */ | 274 | #define CREATE_SEQUENTIAL 0x00000004 |
275 | #define CREATE_SYNC_ALERT 0x00000010 | ||
276 | #define CREATE_ASYNC_ALERT 0x00000020 | ||
277 | #define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */ | ||
278 | #define CREATE_NO_EA_KNOWLEDGE 0x00000200 | ||
279 | #define CREATE_EIGHT_DOT_THREE 0x00000400 | ||
271 | #define CREATE_RANDOM_ACCESS 0x00000800 | 280 | #define CREATE_RANDOM_ACCESS 0x00000800 |
272 | #define CREATE_DELETE_ON_CLOSE 0x00001000 | 281 | #define CREATE_DELETE_ON_CLOSE 0x00001000 |
282 | #define CREATE_OPEN_BY_ID 0x00002000 | ||
273 | #define OPEN_REPARSE_POINT 0x00200000 | 283 | #define OPEN_REPARSE_POINT 0x00200000 |
284 | #define CREATE_OPTIONS_MASK 0x007FFFFF | ||
285 | #define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */ | ||
274 | 286 | ||
275 | /* ImpersonationLevel flags */ | 287 | /* ImpersonationLevel flags */ |
276 | #define SECURITY_ANONYMOUS 0 | 288 | #define SECURITY_ANONYMOUS 0 |
@@ -614,6 +626,7 @@ typedef struct smb_com_findclose_req { | |||
614 | } FINDCLOSE_REQ; | 626 | } FINDCLOSE_REQ; |
615 | 627 | ||
616 | /* OpenFlags */ | 628 | /* OpenFlags */ |
629 | #define REQ_MORE_INFO 0x00000001 /* legacy (OPEN_AND_X) only */ | ||
617 | #define REQ_OPLOCK 0x00000002 | 630 | #define REQ_OPLOCK 0x00000002 |
618 | #define REQ_BATCHOPLOCK 0x00000004 | 631 | #define REQ_BATCHOPLOCK 0x00000004 |
619 | #define REQ_OPENDIRONLY 0x00000008 | 632 | #define REQ_OPENDIRONLY 0x00000008 |
@@ -669,6 +682,62 @@ typedef struct smb_com_open_rsp { | |||
669 | __u16 ByteCount; /* bct = 0 */ | 682 | __u16 ByteCount; /* bct = 0 */ |
670 | } OPEN_RSP; | 683 | } OPEN_RSP; |
671 | 684 | ||
685 | /* format of legacy open request */ | ||
686 | typedef struct smb_com_openx_req { | ||
687 | struct smb_hdr hdr; /* wct = 15 */ | ||
688 | __u8 AndXCommand; | ||
689 | __u8 AndXReserved; | ||
690 | __le16 AndXOffset; | ||
691 | __le16 OpenFlags; | ||
692 | __le16 Mode; | ||
693 | __le16 Sattr; /* search attributes */ | ||
694 | __le16 FileAttributes; /* dos attrs */ | ||
695 | __le32 CreateTime; /* os2 format */ | ||
696 | __le16 OpenFunction; | ||
697 | __le32 EndOfFile; | ||
698 | __le32 Timeout; | ||
699 | __le32 Reserved; | ||
700 | __le16 ByteCount; /* file name follows */ | ||
701 | char fileName[1]; | ||
702 | } OPENX_REQ; | ||
703 | |||
704 | typedef struct smb_com_openx_rsp { | ||
705 | struct smb_hdr hdr; /* wct = 15 */ | ||
706 | __u8 AndXCommand; | ||
707 | __u8 AndXReserved; | ||
708 | __le16 AndXOffset; | ||
709 | __u16 Fid; | ||
710 | __le16 FileAttributes; | ||
711 | __le32 LastWriteTime; /* os2 format */ | ||
712 | __le32 EndOfFile; | ||
713 | __le16 Access; | ||
714 | __le16 FileType; | ||
715 | __le16 IPCState; | ||
716 | __le16 Action; | ||
717 | __u32 FileId; | ||
718 | __u16 Reserved; | ||
719 | __u16 ByteCount; | ||
720 | } OPENX_RSP; | ||
721 | |||
722 | /* Legacy write request for older servers */ | ||
723 | typedef struct smb_com_writex_req { | ||
724 | struct smb_hdr hdr; /* wct = 12 */ | ||
725 | __u8 AndXCommand; | ||
726 | __u8 AndXReserved; | ||
727 | __le16 AndXOffset; | ||
728 | __u16 Fid; | ||
729 | __le32 OffsetLow; | ||
730 | __u32 Reserved; /* Timeout */ | ||
731 | __le16 WriteMode; /* 1 = write through */ | ||
732 | __le16 Remaining; | ||
733 | __le16 Reserved2; | ||
734 | __le16 DataLengthLow; | ||
735 | __le16 DataOffset; | ||
736 | __le16 ByteCount; | ||
737 | __u8 Pad; /* BB check for whether padded to DWORD boundary and optimum performance here */ | ||
738 | char Data[0]; | ||
739 | } WRITEX_REQ; | ||
740 | |||
672 | typedef struct smb_com_write_req { | 741 | typedef struct smb_com_write_req { |
673 | struct smb_hdr hdr; /* wct = 14 */ | 742 | struct smb_hdr hdr; /* wct = 14 */ |
674 | __u8 AndXCommand; | 743 | __u8 AndXCommand; |
@@ -700,6 +769,21 @@ typedef struct smb_com_write_rsp { | |||
700 | __u16 ByteCount; | 769 | __u16 ByteCount; |
701 | } WRITE_RSP; | 770 | } WRITE_RSP; |
702 | 771 | ||
772 | /* legacy read request for older servers */ | ||
773 | typedef struct smb_com_readx_req { | ||
774 | struct smb_hdr hdr; /* wct = 10 */ | ||
775 | __u8 AndXCommand; | ||
776 | __u8 AndXReserved; | ||
777 | __le16 AndXOffset; | ||
778 | __u16 Fid; | ||
779 | __le32 OffsetLow; | ||
780 | __le16 MaxCount; | ||
781 | __le16 MinCount; /* obsolete */ | ||
782 | __le32 Reserved; | ||
783 | __le16 Remaining; | ||
784 | __le16 ByteCount; | ||
785 | } READX_REQ; | ||
786 | |||
703 | typedef struct smb_com_read_req { | 787 | typedef struct smb_com_read_req { |
704 | struct smb_hdr hdr; /* wct = 12 */ | 788 | struct smb_hdr hdr; /* wct = 12 */ |
705 | __u8 AndXCommand; | 789 | __u8 AndXCommand; |
@@ -876,6 +960,22 @@ typedef struct smb_com_create_directory_rsp { | |||
876 | __u16 ByteCount; /* bct = 0 */ | 960 | __u16 ByteCount; /* bct = 0 */ |
877 | } CREATE_DIRECTORY_RSP; | 961 | } CREATE_DIRECTORY_RSP; |
878 | 962 | ||
963 | typedef struct smb_com_query_information_req { | ||
964 | struct smb_hdr hdr; /* wct = 0 */ | ||
965 | __le16 ByteCount; /* 1 + namelen + 1 */ | ||
966 | __u8 BufferFormat; /* 4 = ASCII */ | ||
967 | unsigned char FileName[1]; | ||
968 | } QUERY_INFORMATION_REQ; | ||
969 | |||
970 | typedef struct smb_com_query_information_rsp { | ||
971 | struct smb_hdr hdr; /* wct = 10 */ | ||
972 | __le16 attr; | ||
973 | __le32 last_write_time; | ||
974 | __le32 size; | ||
975 | __u16 reserved[5]; | ||
976 | __le16 ByteCount; /* bcc = 0 */ | ||
977 | } QUERY_INFORMATION_RSP; | ||
978 | |||
879 | typedef struct smb_com_setattr_req { | 979 | typedef struct smb_com_setattr_req { |
880 | struct smb_hdr hdr; /* wct = 8 */ | 980 | struct smb_hdr hdr; /* wct = 8 */ |
881 | __le16 attr; | 981 | __le16 attr; |
@@ -1411,6 +1511,43 @@ typedef struct smb_com_transaction_qfsi_rsp { | |||
1411 | __u8 Pad; /* may be three bytes *//* followed by data area */ | 1511 | __u8 Pad; /* may be three bytes *//* followed by data area */ |
1412 | } TRANSACTION2_QFSI_RSP; | 1512 | } TRANSACTION2_QFSI_RSP; |
1413 | 1513 | ||
1514 | |||
1515 | /* SETFSInfo Levels */ | ||
1516 | #define SMB_SET_CIFS_UNIX_INFO 0x200 | ||
1517 | typedef struct smb_com_transaction2_setfsi_req { | ||
1518 | struct smb_hdr hdr; /* wct = 15 */ | ||
1519 | __le16 TotalParameterCount; | ||
1520 | __le16 TotalDataCount; | ||
1521 | __le16 MaxParameterCount; | ||
1522 | __le16 MaxDataCount; | ||
1523 | __u8 MaxSetupCount; | ||
1524 | __u8 Reserved; | ||
1525 | __le16 Flags; | ||
1526 | __le32 Timeout; | ||
1527 | __u16 Reserved2; | ||
1528 | __le16 ParameterCount; /* 4 */ | ||
1529 | __le16 ParameterOffset; | ||
1530 | __le16 DataCount; /* 12 */ | ||
1531 | __le16 DataOffset; | ||
1532 | __u8 SetupCount; /* one */ | ||
1533 | __u8 Reserved3; | ||
1534 | __le16 SubCommand; /* TRANS2_SET_FS_INFORMATION */ | ||
1535 | __le16 ByteCount; | ||
1536 | __u8 Pad; | ||
1537 | __u16 FileNum; /* Parameters start. */ | ||
1538 | __le16 InformationLevel;/* Parameters end. */ | ||
1539 | __le16 ClientUnixMajor; /* Data start. */ | ||
1540 | __le16 ClientUnixMinor; | ||
1541 | __le64 ClientUnixCap; /* Data end */ | ||
1542 | } TRANSACTION2_SETFSI_REQ; | ||
1543 | |||
1544 | typedef struct smb_com_transaction2_setfsi_rsp { | ||
1545 | struct smb_hdr hdr; /* wct = 10 */ | ||
1546 | struct trans2_resp t2; | ||
1547 | __u16 ByteCount; | ||
1548 | } TRANSACTION2_SETFSI_RSP; | ||
1549 | |||
1550 | |||
1414 | typedef struct smb_com_transaction2_get_dfs_refer_req { | 1551 | typedef struct smb_com_transaction2_get_dfs_refer_req { |
1415 | struct smb_hdr hdr; /* wct = 15 */ | 1552 | struct smb_hdr hdr; /* wct = 15 */ |
1416 | __le16 TotalParameterCount; | 1553 | __le16 TotalParameterCount; |
@@ -1547,16 +1684,32 @@ typedef struct { | |||
1547 | } FILE_SYSTEM_INFO; /* size info, level 0x103 */ | 1684 | } FILE_SYSTEM_INFO; /* size info, level 0x103 */ |
1548 | 1685 | ||
1549 | typedef struct { | 1686 | typedef struct { |
1687 | __le32 fsid; | ||
1688 | __le32 SectorsPerAllocationUnit; | ||
1689 | __le32 TotalAllocationUnits; | ||
1690 | __le32 FreeAllocationUnits; | ||
1691 | __le16 BytesPerSector; | ||
1692 | } FILE_SYSTEM_ALLOC_INFO; | ||
1693 | |||
1694 | typedef struct { | ||
1550 | __le16 MajorVersionNumber; | 1695 | __le16 MajorVersionNumber; |
1551 | __le16 MinorVersionNumber; | 1696 | __le16 MinorVersionNumber; |
1552 | __le64 Capability; | 1697 | __le64 Capability; |
1553 | } FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ | 1698 | } FILE_SYSTEM_UNIX_INFO; /* Unix extensions info, level 0x200 */ |
1699 | |||
1700 | /* Version numbers for CIFS UNIX major and minor. */ | ||
1701 | #define CIFS_UNIX_MAJOR_VERSION 1 | ||
1702 | #define CIFS_UNIX_MINOR_VERSION 0 | ||
1703 | |||
1554 | /* Linux/Unix extensions capability flags */ | 1704 | /* Linux/Unix extensions capability flags */ |
1555 | #define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */ | 1705 | #define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */ |
1556 | #define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */ | 1706 | #define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */ |
1557 | #define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */ | 1707 | #define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */ |
1558 | #define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */ | 1708 | #define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */ |
1709 | #define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Use POSIX pathnames on the wire. */ | ||
1710 | |||
1559 | #define CIFS_POSIX_EXTENSIONS 0x00000010 /* support for new QFSInfo */ | 1711 | #define CIFS_POSIX_EXTENSIONS 0x00000010 /* support for new QFSInfo */ |
1712 | |||
1560 | typedef struct { | 1713 | typedef struct { |
1561 | /* For undefined recommended transfer size return -1 in that field */ | 1714 | /* For undefined recommended transfer size return -1 in that field */ |
1562 | __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */ | 1715 | __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */ |
@@ -1907,18 +2060,17 @@ struct data_blob { | |||
1907 | perhaps add a CreateDevice - to create Pipes and other special .inodes | 2060 | perhaps add a CreateDevice - to create Pipes and other special .inodes |
1908 | Also note POSIX open flags | 2061 | Also note POSIX open flags |
1909 | 2) Close - to return the last write time to do cache across close more safely | 2062 | 2) Close - to return the last write time to do cache across close more safely |
1910 | 3) PosixQFSInfo - to return statfs info | 2063 | 3) FindFirst return unique inode number - what about resume key, two |
1911 | 4) FindFirst return unique inode number - what about resume key, two forms short (matches readdir) and full (enough info to cache inodes) | 2064 | forms short (matches readdir) and full (enough info to cache inodes) |
1912 | 5) Mkdir - set mode | 2065 | 4) Mkdir - set mode |
1913 | 2066 | ||
1914 | And under consideration: | 2067 | And under consideration: |
1915 | 6) FindClose2 (return nanosecond timestamp ??) | 2068 | 5) FindClose2 (return nanosecond timestamp ??) |
1916 | 7) Use nanosecond timestamps throughout all time fields if | 2069 | 6) Use nanosecond timestamps throughout all time fields if |
1917 | corresponding attribute flag is set | 2070 | corresponding attribute flag is set |
1918 | 8) sendfile - handle based copy | 2071 | 7) sendfile - handle based copy |
1919 | 9) Direct i/o | 2072 | 8) Direct i/o |
1920 | 10) "POSIX ACL" support | 2073 | 9) Misc fcntls? |
1921 | 11) Misc fcntls? | ||
1922 | 2074 | ||
1923 | what about fixing 64 bit alignment | 2075 | what about fixing 64 bit alignment |
1924 | 2076 | ||
@@ -1974,7 +2126,7 @@ struct data_blob { | |||
1974 | 2126 | ||
1975 | */ | 2127 | */ |
1976 | 2128 | ||
1977 | /* xsymlink is a symlink format that can be used | 2129 | /* xsymlink is a symlink format (used by MacOS) that can be used |
1978 | to save symlink info in a regular file when | 2130 | to save symlink info in a regular file when |
1979 | mounted to operating systems that do not | 2131 | mounted to operating systems that do not |
1980 | support the cifs Unix extensions or EAs (for xattr | 2132 | support the cifs Unix extensions or EAs (for xattr |