cifspdu.h 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520
  1. /*
  2. * fs/cifs/cifspdu.h
  3. *
  4. * Copyright (c) International Business Machines Corp., 2002,2007
  5. * Author(s): Steve French (sfrench@us.ibm.com)
  6. *
  7. * This library is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published
  9. * by the Free Software Foundation; either version 2.1 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  15. * the GNU Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. */
  21. #ifndef _CIFSPDU_H
  22. #define _CIFSPDU_H
  23. #include <net/sock.h>
  24. #ifdef CONFIG_CIFS_WEAK_PW_HASH
  25. #define LANMAN_PROT 0
  26. #define LANMAN2_PROT 1
  27. #define CIFS_PROT 2
  28. #else
  29. #define CIFS_PROT 0
  30. #endif
  31. #define POSIX_PROT CIFS_PROT+1
  32. #define BAD_PROT 0xFFFF
  33. /* SMB command codes */
  34. /*
  35. * Some commands have minimal (wct=0,bcc=0), or uninteresting, responses
  36. * (ie which include no useful data other than the SMB error code itself).
  37. * Knowing this helps avoid response buffer allocations and copy in some cases
  38. */
  39. #define SMB_COM_CREATE_DIRECTORY 0x00 /* trivial response */
  40. #define SMB_COM_DELETE_DIRECTORY 0x01 /* trivial response */
  41. #define SMB_COM_CLOSE 0x04 /* triv req/rsp, timestamp ignored */
  42. #define SMB_COM_DELETE 0x06 /* trivial response */
  43. #define SMB_COM_RENAME 0x07 /* trivial response */
  44. #define SMB_COM_QUERY_INFORMATION 0x08 /* aka getattr */
  45. #define SMB_COM_SETATTR 0x09 /* trivial response */
  46. #define SMB_COM_LOCKING_ANDX 0x24 /* trivial response */
  47. #define SMB_COM_COPY 0x29 /* trivial rsp, fail filename ignrd*/
  48. #define SMB_COM_OPEN_ANDX 0x2D /* Legacy open for old servers */
  49. #define SMB_COM_READ_ANDX 0x2E
  50. #define SMB_COM_WRITE_ANDX 0x2F
  51. #define SMB_COM_TRANSACTION2 0x32
  52. #define SMB_COM_TRANSACTION2_SECONDARY 0x33
  53. #define SMB_COM_FIND_CLOSE2 0x34 /* trivial response */
  54. #define SMB_COM_TREE_DISCONNECT 0x71 /* trivial response */
  55. #define SMB_COM_NEGOTIATE 0x72
  56. #define SMB_COM_SESSION_SETUP_ANDX 0x73
  57. #define SMB_COM_LOGOFF_ANDX 0x74 /* trivial response */
  58. #define SMB_COM_TREE_CONNECT_ANDX 0x75
  59. #define SMB_COM_NT_TRANSACT 0xA0
  60. #define SMB_COM_NT_TRANSACT_SECONDARY 0xA1
  61. #define SMB_COM_NT_CREATE_ANDX 0xA2
  62. #define SMB_COM_NT_CANCEL 0xA4 /* no response */
  63. #define SMB_COM_NT_RENAME 0xA5 /* trivial response */
  64. /* Transact2 subcommand codes */
  65. #define TRANS2_OPEN 0x00
  66. #define TRANS2_FIND_FIRST 0x01
  67. #define TRANS2_FIND_NEXT 0x02
  68. #define TRANS2_QUERY_FS_INFORMATION 0x03
  69. #define TRANS2_SET_FS_INFORMATION 0x04
  70. #define TRANS2_QUERY_PATH_INFORMATION 0x05
  71. #define TRANS2_SET_PATH_INFORMATION 0x06
  72. #define TRANS2_QUERY_FILE_INFORMATION 0x07
  73. #define TRANS2_SET_FILE_INFORMATION 0x08
  74. #define TRANS2_GET_DFS_REFERRAL 0x10
  75. #define TRANS2_REPORT_DFS_INCOSISTENCY 0x11
  76. /* NT Transact subcommand codes */
  77. #define NT_TRANSACT_CREATE 0x01
  78. #define NT_TRANSACT_IOCTL 0x02
  79. #define NT_TRANSACT_SET_SECURITY_DESC 0x03
  80. #define NT_TRANSACT_NOTIFY_CHANGE 0x04
  81. #define NT_TRANSACT_RENAME 0x05
  82. #define NT_TRANSACT_QUERY_SECURITY_DESC 0x06
  83. #define NT_TRANSACT_GET_USER_QUOTA 0x07
  84. #define NT_TRANSACT_SET_USER_QUOTA 0x08
  85. #define MAX_CIFS_SMALL_BUFFER_SIZE 448 /* big enough for most */
  86. /* future chained NTCreateXReadX bigger, but for time being NTCreateX biggest */
  87. /* among the requests (NTCreateX response is bigger with wct of 34) */
  88. #define MAX_CIFS_HDR_SIZE 0x58 /* 4 len + 32 hdr + (2*24 wct) + 2 bct + 2 pad */
  89. #define CIFS_SMALL_PATH 120 /* allows for (448-88)/3 */
  90. /* internal cifs vfs structures */
  91. /*****************************************************************
  92. * All constants go here
  93. *****************************************************************
  94. */
  95. /*
  96. * Starting value for maximum SMB size negotiation
  97. */
  98. #define CIFS_MAX_MSGSIZE (4*4096)
  99. /*
  100. * Size of encrypted user password in bytes
  101. */
  102. #define CIFS_ENCPWD_SIZE (16)
  103. /*
  104. * Size of the crypto key returned on the negotiate SMB in bytes
  105. */
  106. #define CIFS_CRYPTO_KEY_SIZE (8)
  107. /*
  108. * Size of the session key (crypto key encrypted with the password
  109. */
  110. #define CIFS_SESS_KEY_SIZE (24)
  111. /*
  112. * Maximum user name length
  113. */
  114. #define CIFS_UNLEN (20)
  115. /*
  116. * Flags on SMB open
  117. */
  118. #define SMBOPEN_WRITE_THROUGH 0x4000
  119. #define SMBOPEN_DENY_ALL 0x0010
  120. #define SMBOPEN_DENY_WRITE 0x0020
  121. #define SMBOPEN_DENY_READ 0x0030
  122. #define SMBOPEN_DENY_NONE 0x0040
  123. #define SMBOPEN_READ 0x0000
  124. #define SMBOPEN_WRITE 0x0001
  125. #define SMBOPEN_READWRITE 0x0002
  126. #define SMBOPEN_EXECUTE 0x0003
  127. #define SMBOPEN_OCREATE 0x0010
  128. #define SMBOPEN_OTRUNC 0x0002
  129. #define SMBOPEN_OAPPEND 0x0001
  130. /*
  131. * SMB flag definitions
  132. */
  133. #define SMBFLG_EXTD_LOCK 0x01 /* server supports lock-read write-unlock smb */
  134. #define SMBFLG_RCV_POSTED 0x02 /* obsolete */
  135. #define SMBFLG_RSVD 0x04
  136. #define SMBFLG_CASELESS 0x08 /* all pathnames treated as caseless (off
  137. implies case sensitive file handling request) */
  138. #define SMBFLG_CANONICAL_PATH_FORMAT 0x10 /* obsolete */
  139. #define SMBFLG_OLD_OPLOCK 0x20 /* obsolete */
  140. #define SMBFLG_OLD_OPLOCK_NOTIFY 0x40 /* obsolete */
  141. #define SMBFLG_RESPONSE 0x80 /* this PDU is a response from server */
  142. /*
  143. * SMB flag2 definitions
  144. */
  145. #define SMBFLG2_KNOWS_LONG_NAMES cpu_to_le16(1) /* can send long (non-8.3)
  146. path names in response */
  147. #define SMBFLG2_KNOWS_EAS cpu_to_le16(2)
  148. #define SMBFLG2_SECURITY_SIGNATURE cpu_to_le16(4)
  149. #define SMBFLG2_IS_LONG_NAME cpu_to_le16(0x40)
  150. #define SMBFLG2_EXT_SEC cpu_to_le16(0x800)
  151. #define SMBFLG2_DFS cpu_to_le16(0x1000)
  152. #define SMBFLG2_PAGING_IO cpu_to_le16(0x2000)
  153. #define SMBFLG2_ERR_STATUS cpu_to_le16(0x4000)
  154. #define SMBFLG2_UNICODE cpu_to_le16(0x8000)
  155. /*
  156. * These are the file access permission bits defined in CIFS for the
  157. * NTCreateAndX as well as the level 0x107
  158. * TRANS2_QUERY_PATH_INFORMATION API. The level 0x107, SMB_QUERY_FILE_ALL_INFO
  159. * responds with the AccessFlags.
  160. * The AccessFlags specifies the access permissions a caller has to the
  161. * file and can have any suitable combination of the following values:
  162. */
  163. #define FILE_READ_DATA 0x00000001 /* Data can be read from the file */
  164. #define FILE_WRITE_DATA 0x00000002 /* Data can be written to the file */
  165. #define FILE_APPEND_DATA 0x00000004 /* Data can be appended to the file */
  166. #define FILE_READ_EA 0x00000008 /* Extended attributes associated */
  167. /* with the file can be read */
  168. #define FILE_WRITE_EA 0x00000010 /* Extended attributes associated */
  169. /* with the file can be written */
  170. #define FILE_EXECUTE 0x00000020 /*Data can be read into memory from */
  171. /* the file using system paging I/O */
  172. #define FILE_DELETE_CHILD 0x00000040
  173. #define FILE_READ_ATTRIBUTES 0x00000080 /* Attributes associated with the */
  174. /* file can be read */
  175. #define FILE_WRITE_ATTRIBUTES 0x00000100 /* Attributes associated with the */
  176. /* file can be written */
  177. #define DELETE 0x00010000 /* The file can be deleted */
  178. #define READ_CONTROL 0x00020000 /* The access control list and */
  179. /* ownership associated with the */
  180. /* file can be read */
  181. #define WRITE_DAC 0x00040000 /* The access control list and */
  182. /* ownership associated with the */
  183. /* file can be written. */
  184. #define WRITE_OWNER 0x00080000 /* Ownership information associated */
  185. /* with the file can be written */
  186. #define SYNCHRONIZE 0x00100000 /* The file handle can waited on to */
  187. /* synchronize with the completion */
  188. /* of an input/output request */
  189. #define GENERIC_ALL 0x10000000
  190. #define GENERIC_EXECUTE 0x20000000
  191. #define GENERIC_WRITE 0x40000000
  192. #define GENERIC_READ 0x80000000
  193. /* In summary - Relevant file */
  194. /* access flags from CIFS are */
  195. /* file_read_data, file_write_data */
  196. /* file_execute, file_read_attributes*/
  197. /* write_dac, and delete. */
  198. #define FILE_READ_RIGHTS (FILE_READ_DATA | FILE_READ_EA | FILE_READ_ATTRIBUTES)
  199. #define FILE_WRITE_RIGHTS (FILE_WRITE_DATA | FILE_APPEND_DATA \
  200. | FILE_WRITE_EA | FILE_WRITE_ATTRIBUTES)
  201. #define FILE_EXEC_RIGHTS (FILE_EXECUTE)
  202. #define SET_FILE_READ_RIGHTS (FILE_READ_DATA | FILE_READ_EA | FILE_WRITE_EA \
  203. | FILE_READ_ATTRIBUTES \
  204. | FILE_WRITE_ATTRIBUTES \
  205. | DELETE | READ_CONTROL | WRITE_DAC \
  206. | WRITE_OWNER | SYNCHRONIZE)
  207. #define SET_FILE_WRITE_RIGHTS (FILE_WRITE_DATA | FILE_APPEND_DATA \
  208. | FILE_READ_EA | FILE_WRITE_EA \
  209. | FILE_DELETE_CHILD | FILE_READ_ATTRIBUTES \
  210. | FILE_WRITE_ATTRIBUTES \
  211. | DELETE | READ_CONTROL | WRITE_DAC \
  212. | WRITE_OWNER | SYNCHRONIZE)
  213. #define SET_FILE_EXEC_RIGHTS (FILE_READ_EA | FILE_WRITE_EA | FILE_EXECUTE \
  214. | FILE_READ_ATTRIBUTES \
  215. | FILE_WRITE_ATTRIBUTES \
  216. | DELETE | READ_CONTROL | WRITE_DAC \
  217. | WRITE_OWNER | SYNCHRONIZE)
  218. #define SET_MINIMUM_RIGHTS (FILE_READ_EA | FILE_READ_ATTRIBUTES \
  219. | READ_CONTROL | SYNCHRONIZE)
  220. /*
  221. * Invalid readdir handle
  222. */
  223. #define CIFS_NO_HANDLE 0xFFFF
  224. #define NO_CHANGE_64 cpu_to_le64(0xFFFFFFFFFFFFFFFFULL)
  225. #define NO_CHANGE_32 0xFFFFFFFFUL
  226. /* IPC$ in ASCII */
  227. #define CIFS_IPC_RESOURCE "\x49\x50\x43\x24"
  228. /* IPC$ in Unicode */
  229. #define CIFS_IPC_UNICODE_RESOURCE "\x00\x49\x00\x50\x00\x43\x00\x24\x00\x00"
  230. /* Unicode Null terminate 2 bytes of 0 */
  231. #define UNICODE_NULL "\x00\x00"
  232. #define ASCII_NULL 0x00
  233. /*
  234. * Server type values (returned on EnumServer API
  235. */
  236. #define CIFS_SV_TYPE_DC 0x00000008
  237. #define CIFS_SV_TYPE_BACKDC 0x00000010
  238. /*
  239. * Alias type flags (From EnumAlias API call
  240. */
  241. #define CIFS_ALIAS_TYPE_FILE 0x0001
  242. #define CIFS_SHARE_TYPE_FILE 0x0000
  243. /*
  244. * File Attribute flags
  245. */
  246. #define ATTR_READONLY 0x0001
  247. #define ATTR_HIDDEN 0x0002
  248. #define ATTR_SYSTEM 0x0004
  249. #define ATTR_VOLUME 0x0008
  250. #define ATTR_DIRECTORY 0x0010
  251. #define ATTR_ARCHIVE 0x0020
  252. #define ATTR_DEVICE 0x0040
  253. #define ATTR_NORMAL 0x0080
  254. #define ATTR_TEMPORARY 0x0100
  255. #define ATTR_SPARSE 0x0200
  256. #define ATTR_REPARSE 0x0400
  257. #define ATTR_COMPRESSED 0x0800
  258. #define ATTR_OFFLINE 0x1000 /* ie file not immediately available -
  259. on offline storage */
  260. #define ATTR_NOT_CONTENT_INDEXED 0x2000
  261. #define ATTR_ENCRYPTED 0x4000
  262. #define ATTR_POSIX_SEMANTICS 0x01000000
  263. #define ATTR_BACKUP_SEMANTICS 0x02000000
  264. #define ATTR_DELETE_ON_CLOSE 0x04000000
  265. #define ATTR_SEQUENTIAL_SCAN 0x08000000
  266. #define ATTR_RANDOM_ACCESS 0x10000000
  267. #define ATTR_NO_BUFFERING 0x20000000
  268. #define ATTR_WRITE_THROUGH 0x80000000
  269. /* ShareAccess flags */
  270. #define FILE_NO_SHARE 0x00000000
  271. #define FILE_SHARE_READ 0x00000001
  272. #define FILE_SHARE_WRITE 0x00000002
  273. #define FILE_SHARE_DELETE 0x00000004
  274. #define FILE_SHARE_ALL 0x00000007
  275. /* CreateDisposition flags */
  276. #define FILE_SUPERSEDE 0x00000000
  277. #define FILE_OPEN 0x00000001
  278. #define FILE_CREATE 0x00000002
  279. #define FILE_OPEN_IF 0x00000003
  280. #define FILE_OVERWRITE 0x00000004
  281. #define FILE_OVERWRITE_IF 0x00000005
  282. /* CreateOptions */
  283. #define CREATE_NOT_FILE 0x00000001 /* if set must not be file */
  284. #define CREATE_WRITE_THROUGH 0x00000002
  285. #define CREATE_SEQUENTIAL 0x00000004
  286. #define CREATE_SYNC_ALERT 0x00000010
  287. #define CREATE_ASYNC_ALERT 0x00000020
  288. #define CREATE_NOT_DIR 0x00000040 /* if set must not be directory */
  289. #define CREATE_NO_EA_KNOWLEDGE 0x00000200
  290. #define CREATE_EIGHT_DOT_THREE 0x00000400
  291. #define CREATE_RANDOM_ACCESS 0x00000800
  292. #define CREATE_DELETE_ON_CLOSE 0x00001000
  293. #define CREATE_OPEN_BY_ID 0x00002000
  294. #define OPEN_REPARSE_POINT 0x00200000
  295. #define CREATE_OPTIONS_MASK 0x007FFFFF
  296. #define CREATE_OPTION_SPECIAL 0x20000000 /* system. NB not sent over wire */
  297. /* ImpersonationLevel flags */
  298. #define SECURITY_ANONYMOUS 0
  299. #define SECURITY_IDENTIFICATION 1
  300. #define SECURITY_IMPERSONATION 2
  301. #define SECURITY_DELEGATION 3
  302. /* SecurityFlags */
  303. #define SECURITY_CONTEXT_TRACKING 0x01
  304. #define SECURITY_EFFECTIVE_ONLY 0x02
  305. /*
  306. * Default PID value, used in all SMBs where the PID is not important
  307. */
  308. #define CIFS_DFT_PID 0x1234
  309. /*
  310. * We use the same routine for Copy and Move SMBs. This flag is used to
  311. * distinguish
  312. */
  313. #define CIFS_COPY_OP 1
  314. #define CIFS_RENAME_OP 2
  315. #define GETU16(var) (*((__u16 *)var)) /* BB check for endian issues */
  316. #define GETU32(var) (*((__u32 *)var)) /* BB check for endian issues */
  317. struct smb_hdr {
  318. __u32 smb_buf_length; /* big endian on wire *//* BB length is only two
  319. or three bytes - with one or two byte type preceding it that are
  320. zero - we could mask the type byte off just in case BB */
  321. __u8 Protocol[4];
  322. __u8 Command;
  323. union {
  324. struct {
  325. __u8 ErrorClass;
  326. __u8 Reserved;
  327. __le16 Error;
  328. } __attribute__((packed)) DosError;
  329. __le32 CifsError;
  330. } __attribute__((packed)) Status;
  331. __u8 Flags;
  332. __le16 Flags2; /* note: le */
  333. __le16 PidHigh;
  334. union {
  335. struct {
  336. __le32 SequenceNumber; /* le */
  337. __u32 Reserved; /* zero */
  338. } __attribute__((packed)) Sequence;
  339. __u8 SecuritySignature[8]; /* le */
  340. } __attribute__((packed)) Signature;
  341. __u8 pad[2];
  342. __u16 Tid;
  343. __le16 Pid;
  344. __u16 Uid;
  345. __u16 Mid;
  346. __u8 WordCount;
  347. } __attribute__((packed));
  348. /* given a pointer to an smb_hdr retrieve the value of byte count */
  349. #define BCC(smb_var) ( *(__u16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount)))
  350. #define BCC_LE(smb_var) ( *(__le16 *)((char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount)))
  351. /* given a pointer to an smb_hdr retrieve the pointer to the byte area */
  352. #define pByteArea(smb_var) ((unsigned char *)smb_var + sizeof(struct smb_hdr) + (2 * smb_var->WordCount) + 2)
  353. /*
  354. * Computer Name Length (since Netbios name was length 16 with last byte 0x20)
  355. * No longer as important, now that TCP names are more commonly used to
  356. * resolve hosts.
  357. */
  358. #define CNLEN 15
  359. /*
  360. * Share Name Length (SNLEN)
  361. * Note: This length was limited by the SMB used to get
  362. * the Share info. NetShareEnum only returned 13
  363. * chars, including the null termination.
  364. * This was removed because it no longer is limiting.
  365. */
  366. /*
  367. * Comment Length
  368. */
  369. #define MAXCOMMENTLEN 40
  370. /*
  371. * The OS/2 maximum path name
  372. */
  373. #define MAX_PATHCONF 256
  374. /*
  375. * SMB frame definitions (following must be packed structs)
  376. * See the SNIA CIFS Specification for details.
  377. *
  378. * The Naming convention is the lower case version of the
  379. * smb command code name for the struct and this is typedef to the
  380. * uppercase version of the same name with the prefix SMB_ removed
  381. * for brevity. Although typedefs are not commonly used for
  382. * structure definitions in the Linux kernel, their use in the
  383. * CIFS standards document, which this code is based on, may
  384. * make this one of the cases where typedefs for structures make
  385. * sense to improve readability for readers of the standards doc.
  386. * Typedefs can always be removed later if they are too distracting
  387. * and they are only used for the CIFSs PDUs themselves, not
  388. * internal cifs vfs structures
  389. *
  390. */
  391. typedef struct negotiate_req {
  392. struct smb_hdr hdr; /* wct = 0 */
  393. __le16 ByteCount;
  394. unsigned char DialectsArray[1];
  395. } __attribute__((packed)) NEGOTIATE_REQ;
  396. /* Dialect index is 13 for LANMAN */
  397. #define MIN_TZ_ADJ (15 * 60) /* minimum grid for timezones in seconds */
  398. typedef struct lanman_neg_rsp {
  399. struct smb_hdr hdr; /* wct = 13 */
  400. __le16 DialectIndex;
  401. __le16 SecurityMode;
  402. __le16 MaxBufSize;
  403. __le16 MaxMpxCount;
  404. __le16 MaxNumberVcs;
  405. __le16 RawMode;
  406. __le32 SessionKey;
  407. struct {
  408. __le16 Time;
  409. __le16 Date;
  410. } __attribute__((packed)) SrvTime;
  411. __le16 ServerTimeZone;
  412. __le16 EncryptionKeyLength;
  413. __le16 Reserved;
  414. __u16 ByteCount;
  415. unsigned char EncryptionKey[1];
  416. } __attribute__((packed)) LANMAN_NEG_RSP;
  417. #define READ_RAW_ENABLE 1
  418. #define WRITE_RAW_ENABLE 2
  419. #define RAW_ENABLE (READ_RAW_ENABLE | WRITE_RAW_ENABLE)
  420. typedef struct negotiate_rsp {
  421. struct smb_hdr hdr; /* wct = 17 */
  422. __le16 DialectIndex;
  423. __u8 SecurityMode;
  424. __le16 MaxMpxCount;
  425. __le16 MaxNumberVcs;
  426. __le32 MaxBufferSize;
  427. __le32 MaxRawSize;
  428. __le32 SessionKey;
  429. __le32 Capabilities; /* see below */
  430. __le32 SystemTimeLow;
  431. __le32 SystemTimeHigh;
  432. __le16 ServerTimeZone;
  433. __u8 EncryptionKeyLength;
  434. __u16 ByteCount;
  435. union {
  436. unsigned char EncryptionKey[1]; /* cap extended security off */
  437. /* followed by Domain name - if extended security is off */
  438. /* followed by 16 bytes of server GUID */
  439. /* then security blob if cap_extended_security negotiated */
  440. struct {
  441. unsigned char GUID[16];
  442. unsigned char SecurityBlob[1];
  443. } __attribute__((packed)) extended_response;
  444. } __attribute__((packed)) u;
  445. } __attribute__((packed)) NEGOTIATE_RSP;
  446. /* SecurityMode bits */
  447. #define SECMODE_USER 0x01 /* off indicates share level security */
  448. #define SECMODE_PW_ENCRYPT 0x02
  449. #define SECMODE_SIGN_ENABLED 0x04 /* SMB security signatures enabled */
  450. #define SECMODE_SIGN_REQUIRED 0x08 /* SMB security signatures required */
  451. /* Negotiate response Capabilities */
  452. #define CAP_RAW_MODE 0x00000001
  453. #define CAP_MPX_MODE 0x00000002
  454. #define CAP_UNICODE 0x00000004
  455. #define CAP_LARGE_FILES 0x00000008
  456. #define CAP_NT_SMBS 0x00000010 /* implies CAP_NT_FIND */
  457. #define CAP_RPC_REMOTE_APIS 0x00000020
  458. #define CAP_STATUS32 0x00000040
  459. #define CAP_LEVEL_II_OPLOCKS 0x00000080
  460. #define CAP_LOCK_AND_READ 0x00000100
  461. #define CAP_NT_FIND 0x00000200
  462. #define CAP_DFS 0x00001000
  463. #define CAP_INFOLEVEL_PASSTHRU 0x00002000
  464. #define CAP_LARGE_READ_X 0x00004000
  465. #define CAP_LARGE_WRITE_X 0x00008000
  466. #define CAP_UNIX 0x00800000
  467. #define CAP_RESERVED 0x02000000
  468. #define CAP_BULK_TRANSFER 0x20000000
  469. #define CAP_COMPRESSED_DATA 0x40000000
  470. #define CAP_EXTENDED_SECURITY 0x80000000
  471. typedef union smb_com_session_setup_andx {
  472. struct { /* request format */
  473. struct smb_hdr hdr; /* wct = 12 */
  474. __u8 AndXCommand;
  475. __u8 AndXReserved;
  476. __le16 AndXOffset;
  477. __le16 MaxBufferSize;
  478. __le16 MaxMpxCount;
  479. __le16 VcNumber;
  480. __u32 SessionKey;
  481. __le16 SecurityBlobLength;
  482. __u32 Reserved;
  483. __le32 Capabilities; /* see below */
  484. __le16 ByteCount;
  485. unsigned char SecurityBlob[1]; /* followed by */
  486. /* STRING NativeOS */
  487. /* STRING NativeLanMan */
  488. } __attribute__((packed)) req; /* NTLM request format (with
  489. extended security */
  490. struct { /* request format */
  491. struct smb_hdr hdr; /* wct = 13 */
  492. __u8 AndXCommand;
  493. __u8 AndXReserved;
  494. __le16 AndXOffset;
  495. __le16 MaxBufferSize;
  496. __le16 MaxMpxCount;
  497. __le16 VcNumber;
  498. __u32 SessionKey;
  499. __le16 CaseInsensitivePasswordLength; /* ASCII password len */
  500. __le16 CaseSensitivePasswordLength; /* Unicode password length*/
  501. __u32 Reserved; /* see below */
  502. __le32 Capabilities;
  503. __le16 ByteCount;
  504. unsigned char CaseInsensitivePassword[1]; /* followed by: */
  505. /* unsigned char * CaseSensitivePassword; */
  506. /* STRING AccountName */
  507. /* STRING PrimaryDomain */
  508. /* STRING NativeOS */
  509. /* STRING NativeLanMan */
  510. } __attribute__((packed)) req_no_secext; /* NTLM request format (without
  511. extended security */
  512. struct { /* default (NTLM) response format */
  513. struct smb_hdr hdr; /* wct = 4 */
  514. __u8 AndXCommand;
  515. __u8 AndXReserved;
  516. __le16 AndXOffset;
  517. __le16 Action; /* see below */
  518. __le16 SecurityBlobLength;
  519. __u16 ByteCount;
  520. unsigned char SecurityBlob[1]; /* followed by */
  521. /* unsigned char * NativeOS; */
  522. /* unsigned char * NativeLanMan; */
  523. /* unsigned char * PrimaryDomain; */
  524. } __attribute__((packed)) resp; /* NTLM response
  525. (with or without extended sec) */
  526. struct { /* request format */
  527. struct smb_hdr hdr; /* wct = 10 */
  528. __u8 AndXCommand;
  529. __u8 AndXReserved;
  530. __le16 AndXOffset;
  531. __le16 MaxBufferSize;
  532. __le16 MaxMpxCount;
  533. __le16 VcNumber;
  534. __u32 SessionKey;
  535. __le16 PasswordLength;
  536. __u32 Reserved; /* encrypt key len and offset */
  537. __le16 ByteCount;
  538. unsigned char AccountPassword[1]; /* followed by */
  539. /* STRING AccountName */
  540. /* STRING PrimaryDomain */
  541. /* STRING NativeOS */
  542. /* STRING NativeLanMan */
  543. } __attribute__((packed)) old_req; /* pre-NTLM (LANMAN2.1) req format */
  544. struct { /* default (NTLM) response format */
  545. struct smb_hdr hdr; /* wct = 3 */
  546. __u8 AndXCommand;
  547. __u8 AndXReserved;
  548. __le16 AndXOffset;
  549. __le16 Action; /* see below */
  550. __u16 ByteCount;
  551. unsigned char NativeOS[1]; /* followed by */
  552. /* unsigned char * NativeLanMan; */
  553. /* unsigned char * PrimaryDomain; */
  554. } __attribute__((packed)) old_resp; /* pre-NTLM (LANMAN2.1) response */
  555. } __attribute__((packed)) SESSION_SETUP_ANDX;
  556. /* format of NLTMv2 Response ie "case sensitive password" hash when NTLMv2 */
  557. #define NTLMSSP_SERVER_TYPE 1
  558. #define NTLMSSP_DOMAIN_TYPE 2
  559. #define NTLMSSP_FQ_DOMAIN_TYPE 3
  560. #define NTLMSSP_DNS_DOMAIN_TYPE 4
  561. #define NTLMSSP_DNS_PARENT_TYPE 5
  562. struct ntlmssp2_name {
  563. __le16 type;
  564. __le16 length;
  565. /* char name[length]; */
  566. } __attribute__((packed));
  567. struct ntlmv2_resp {
  568. char ntlmv2_hash[CIFS_ENCPWD_SIZE];
  569. __le32 blob_signature;
  570. __u32 reserved;
  571. __le64 time;
  572. __u64 client_chal; /* random */
  573. __u32 reserved2;
  574. struct ntlmssp2_name names[2];
  575. /* array of name entries could follow ending in minimum 4 byte struct */
  576. } __attribute__((packed));
  577. #define CIFS_NETWORK_OPSYS "CIFS VFS Client for Linux"
  578. /* Capabilities bits (for NTLM SessSetup request) */
  579. #define CAP_UNICODE 0x00000004
  580. #define CAP_LARGE_FILES 0x00000008
  581. #define CAP_NT_SMBS 0x00000010
  582. #define CAP_STATUS32 0x00000040
  583. #define CAP_LEVEL_II_OPLOCKS 0x00000080
  584. #define CAP_NT_FIND 0x00000200 /* reserved should be zero
  585. (because NT_SMBs implies the same thing?) */
  586. #define CAP_BULK_TRANSFER 0x20000000
  587. #define CAP_EXTENDED_SECURITY 0x80000000
  588. /* Action bits */
  589. #define GUEST_LOGIN 1
  590. typedef struct smb_com_tconx_req {
  591. struct smb_hdr hdr; /* wct = 4 */
  592. __u8 AndXCommand;
  593. __u8 AndXReserved;
  594. __le16 AndXOffset;
  595. __le16 Flags; /* see below */
  596. __le16 PasswordLength;
  597. __le16 ByteCount;
  598. unsigned char Password[1]; /* followed by */
  599. /* STRING Path *//* \\server\share name */
  600. /* STRING Service */
  601. } __attribute__((packed)) TCONX_REQ;
  602. typedef struct smb_com_tconx_rsp {
  603. struct smb_hdr hdr; /* wct = 3 note that Win2000 has sent wct = 7
  604. in some cases on responses. Four unspecified
  605. words followed OptionalSupport */
  606. __u8 AndXCommand;
  607. __u8 AndXReserved;
  608. __le16 AndXOffset;
  609. __le16 OptionalSupport; /* see below */
  610. __u16 ByteCount;
  611. unsigned char Service[1]; /* always ASCII, not Unicode */
  612. /* STRING NativeFileSystem */
  613. } __attribute__((packed)) TCONX_RSP;
  614. /* tree connect Flags */
  615. #define DISCONNECT_TID 0x0001
  616. #define TCON_EXTENDED_SECINFO 0x0008
  617. /* OptionalSupport bits */
  618. #define SMB_SUPPORT_SEARCH_BITS 0x0001 /* "must have" directory search bits
  619. (exclusive searches supported) */
  620. #define SMB_SHARE_IS_IN_DFS 0x0002
  621. typedef struct smb_com_logoff_andx_req {
  622. struct smb_hdr hdr; /* wct = 2 */
  623. __u8 AndXCommand;
  624. __u8 AndXReserved;
  625. __u16 AndXOffset;
  626. __u16 ByteCount;
  627. } __attribute__((packed)) LOGOFF_ANDX_REQ;
  628. typedef struct smb_com_logoff_andx_rsp {
  629. struct smb_hdr hdr; /* wct = 2 */
  630. __u8 AndXCommand;
  631. __u8 AndXReserved;
  632. __u16 AndXOffset;
  633. __u16 ByteCount;
  634. } __attribute__((packed)) LOGOFF_ANDX_RSP;
  635. typedef union smb_com_tree_disconnect { /* as an altetnative can use flag on
  636. tree_connect PDU to effect disconnect */
  637. /* tdis is probably simplest SMB PDU */
  638. struct {
  639. struct smb_hdr hdr; /* wct = 0 */
  640. __u16 ByteCount; /* bcc = 0 */
  641. } __attribute__((packed)) req;
  642. struct {
  643. struct smb_hdr hdr; /* wct = 0 */
  644. __u16 ByteCount; /* bcc = 0 */
  645. } __attribute__((packed)) resp;
  646. } __attribute__((packed)) TREE_DISCONNECT;
  647. typedef struct smb_com_close_req {
  648. struct smb_hdr hdr; /* wct = 3 */
  649. __u16 FileID;
  650. __u32 LastWriteTime; /* should be zero or -1 */
  651. __u16 ByteCount; /* 0 */
  652. } __attribute__((packed)) CLOSE_REQ;
  653. typedef struct smb_com_close_rsp {
  654. struct smb_hdr hdr; /* wct = 0 */
  655. __u16 ByteCount; /* bct = 0 */
  656. } __attribute__((packed)) CLOSE_RSP;
  657. typedef struct smb_com_findclose_req {
  658. struct smb_hdr hdr; /* wct = 1 */
  659. __u16 FileID;
  660. __u16 ByteCount; /* 0 */
  661. } __attribute__((packed)) FINDCLOSE_REQ;
  662. /* OpenFlags */
  663. #define REQ_MORE_INFO 0x00000001 /* legacy (OPEN_AND_X) only */
  664. #define REQ_OPLOCK 0x00000002
  665. #define REQ_BATCHOPLOCK 0x00000004
  666. #define REQ_OPENDIRONLY 0x00000008
  667. #define REQ_EXTENDED_INFO 0x00000010
  668. /* File type */
  669. #define DISK_TYPE 0x0000
  670. #define BYTE_PIPE_TYPE 0x0001
  671. #define MESSAGE_PIPE_TYPE 0x0002
  672. #define PRINTER_TYPE 0x0003
  673. #define COMM_DEV_TYPE 0x0004
  674. #define UNKNOWN_TYPE 0xFFFF
  675. typedef struct smb_com_open_req { /* also handles create */
  676. struct smb_hdr hdr; /* wct = 24 */
  677. __u8 AndXCommand;
  678. __u8 AndXReserved;
  679. __le16 AndXOffset;
  680. __u8 Reserved; /* Must Be Zero */
  681. __le16 NameLength;
  682. __le32 OpenFlags;
  683. __le32 RootDirectoryFid;
  684. __le32 DesiredAccess;
  685. __le64 AllocationSize;
  686. __le32 FileAttributes;
  687. __le32 ShareAccess;
  688. __le32 CreateDisposition;
  689. __le32 CreateOptions;
  690. __le32 ImpersonationLevel;
  691. __u8 SecurityFlags;
  692. __le16 ByteCount;
  693. char fileName[1];
  694. } __attribute__((packed)) OPEN_REQ;
  695. /* open response: oplock levels */
  696. #define OPLOCK_NONE 0
  697. #define OPLOCK_EXCLUSIVE 1
  698. #define OPLOCK_BATCH 2
  699. #define OPLOCK_READ 3 /* level 2 oplock */
  700. /* open response for CreateAction shifted left */
  701. #define CIFS_CREATE_ACTION 0x20000 /* file created */
  702. typedef struct smb_com_open_rsp {
  703. struct smb_hdr hdr; /* wct = 34 BB */
  704. __u8 AndXCommand;
  705. __u8 AndXReserved;
  706. __le16 AndXOffset;
  707. __u8 OplockLevel;
  708. __u16 Fid;
  709. __le32 CreateAction;
  710. __le64 CreationTime;
  711. __le64 LastAccessTime;
  712. __le64 LastWriteTime;
  713. __le64 ChangeTime;
  714. __le32 FileAttributes;
  715. __le64 AllocationSize;
  716. __le64 EndOfFile;
  717. __le16 FileType;
  718. __le16 DeviceState;
  719. __u8 DirectoryFlag;
  720. __u16 ByteCount; /* bct = 0 */
  721. } __attribute__((packed)) OPEN_RSP;
  722. /* format of legacy open request */
  723. typedef struct smb_com_openx_req {
  724. struct smb_hdr hdr; /* wct = 15 */
  725. __u8 AndXCommand;
  726. __u8 AndXReserved;
  727. __le16 AndXOffset;
  728. __le16 OpenFlags;
  729. __le16 Mode;
  730. __le16 Sattr; /* search attributes */
  731. __le16 FileAttributes; /* dos attrs */
  732. __le32 CreateTime; /* os2 format */
  733. __le16 OpenFunction;
  734. __le32 EndOfFile;
  735. __le32 Timeout;
  736. __le32 Reserved;
  737. __le16 ByteCount; /* file name follows */
  738. char fileName[1];
  739. } __attribute__((packed)) OPENX_REQ;
  740. typedef struct smb_com_openx_rsp {
  741. struct smb_hdr hdr; /* wct = 15 */
  742. __u8 AndXCommand;
  743. __u8 AndXReserved;
  744. __le16 AndXOffset;
  745. __u16 Fid;
  746. __le16 FileAttributes;
  747. __le32 LastWriteTime; /* os2 format */
  748. __le32 EndOfFile;
  749. __le16 Access;
  750. __le16 FileType;
  751. __le16 IPCState;
  752. __le16 Action;
  753. __u32 FileId;
  754. __u16 Reserved;
  755. __u16 ByteCount;
  756. } __attribute__((packed)) OPENX_RSP;
  757. /* For encoding of POSIX Open Request - see trans2 function 0x209 data struct */
  758. /* Legacy write request for older servers */
  759. typedef struct smb_com_writex_req {
  760. struct smb_hdr hdr; /* wct = 12 */
  761. __u8 AndXCommand;
  762. __u8 AndXReserved;
  763. __le16 AndXOffset;
  764. __u16 Fid;
  765. __le32 OffsetLow;
  766. __u32 Reserved; /* Timeout */
  767. __le16 WriteMode; /* 1 = write through */
  768. __le16 Remaining;
  769. __le16 Reserved2;
  770. __le16 DataLengthLow;
  771. __le16 DataOffset;
  772. __le16 ByteCount;
  773. __u8 Pad; /* BB check for whether padded to DWORD
  774. boundary and optimum performance here */
  775. char Data[0];
  776. } __attribute__((packed)) WRITEX_REQ;
  777. typedef struct smb_com_write_req {
  778. struct smb_hdr hdr; /* wct = 14 */
  779. __u8 AndXCommand;
  780. __u8 AndXReserved;
  781. __le16 AndXOffset;
  782. __u16 Fid;
  783. __le32 OffsetLow;
  784. __u32 Reserved;
  785. __le16 WriteMode;
  786. __le16 Remaining;
  787. __le16 DataLengthHigh;
  788. __le16 DataLengthLow;
  789. __le16 DataOffset;
  790. __le32 OffsetHigh;
  791. __le16 ByteCount;
  792. __u8 Pad; /* BB check for whether padded to DWORD
  793. boundary and optimum performance here */
  794. char Data[0];
  795. } __attribute__((packed)) WRITE_REQ;
  796. typedef struct smb_com_write_rsp {
  797. struct smb_hdr hdr; /* wct = 6 */
  798. __u8 AndXCommand;
  799. __u8 AndXReserved;
  800. __le16 AndXOffset;
  801. __le16 Count;
  802. __le16 Remaining;
  803. __le16 CountHigh;
  804. __u16 Reserved;
  805. __u16 ByteCount;
  806. } __attribute__((packed)) WRITE_RSP;
  807. /* legacy read request for older servers */
  808. typedef struct smb_com_readx_req {
  809. struct smb_hdr hdr; /* wct = 10 */
  810. __u8 AndXCommand;
  811. __u8 AndXReserved;
  812. __le16 AndXOffset;
  813. __u16 Fid;
  814. __le32 OffsetLow;
  815. __le16 MaxCount;
  816. __le16 MinCount; /* obsolete */
  817. __le32 Reserved;
  818. __le16 Remaining;
  819. __le16 ByteCount;
  820. } __attribute__((packed)) READX_REQ;
  821. typedef struct smb_com_read_req {
  822. struct smb_hdr hdr; /* wct = 12 */
  823. __u8 AndXCommand;
  824. __u8 AndXReserved;
  825. __le16 AndXOffset;
  826. __u16 Fid;
  827. __le32 OffsetLow;
  828. __le16 MaxCount;
  829. __le16 MinCount; /* obsolete */
  830. __le32 MaxCountHigh;
  831. __le16 Remaining;
  832. __le32 OffsetHigh;
  833. __le16 ByteCount;
  834. } __attribute__((packed)) READ_REQ;
  835. typedef struct smb_com_read_rsp {
  836. struct smb_hdr hdr; /* wct = 12 */
  837. __u8 AndXCommand;
  838. __u8 AndXReserved;
  839. __le16 AndXOffset;
  840. __le16 Remaining;
  841. __le16 DataCompactionMode;
  842. __le16 Reserved;
  843. __le16 DataLength;
  844. __le16 DataOffset;
  845. __le16 DataLengthHigh;
  846. __u64 Reserved2;
  847. __u16 ByteCount;
  848. __u8 Pad; /* BB check for whether padded to DWORD
  849. boundary and optimum performance here */
  850. char Data[1];
  851. } __attribute__((packed)) READ_RSP;
  852. typedef struct locking_andx_range {
  853. __le16 Pid;
  854. __le16 Pad;
  855. __le32 OffsetHigh;
  856. __le32 OffsetLow;
  857. __le32 LengthHigh;
  858. __le32 LengthLow;
  859. } __attribute__((packed)) LOCKING_ANDX_RANGE;
  860. #define LOCKING_ANDX_SHARED_LOCK 0x01
  861. #define LOCKING_ANDX_OPLOCK_RELEASE 0x02
  862. #define LOCKING_ANDX_CHANGE_LOCKTYPE 0x04
  863. #define LOCKING_ANDX_CANCEL_LOCK 0x08
  864. #define LOCKING_ANDX_LARGE_FILES 0x10 /* always on for us */
  865. typedef struct smb_com_lock_req {
  866. struct smb_hdr hdr; /* wct = 8 */
  867. __u8 AndXCommand;
  868. __u8 AndXReserved;
  869. __le16 AndXOffset;
  870. __u16 Fid;
  871. __u8 LockType;
  872. __u8 OplockLevel;
  873. __le32 Timeout;
  874. __le16 NumberOfUnlocks;
  875. __le16 NumberOfLocks;
  876. __le16 ByteCount;
  877. LOCKING_ANDX_RANGE Locks[1];
  878. } __attribute__((packed)) LOCK_REQ;
  879. /* lock type */
  880. #define CIFS_RDLCK 0
  881. #define CIFS_WRLCK 1
  882. #define CIFS_UNLCK 2
  883. typedef struct cifs_posix_lock {
  884. __le16 lock_type; /* 0 = Read, 1 = Write, 2 = Unlock */
  885. __le16 lock_flags; /* 1 = Wait (only valid for setlock) */
  886. __le32 pid;
  887. __le64 start;
  888. __le64 length;
  889. /* BB what about additional owner info to identify network client */
  890. } __attribute__((packed)) CIFS_POSIX_LOCK;
  891. typedef struct smb_com_lock_rsp {
  892. struct smb_hdr hdr; /* wct = 2 */
  893. __u8 AndXCommand;
  894. __u8 AndXReserved;
  895. __le16 AndXOffset;
  896. __u16 ByteCount;
  897. } __attribute__((packed)) LOCK_RSP;
  898. typedef struct smb_com_rename_req {
  899. struct smb_hdr hdr; /* wct = 1 */
  900. __le16 SearchAttributes; /* target file attributes */
  901. __le16 ByteCount;
  902. __u8 BufferFormat; /* 4 = ASCII or Unicode */
  903. unsigned char OldFileName[1];
  904. /* followed by __u8 BufferFormat2 */
  905. /* followed by NewFileName */
  906. } __attribute__((packed)) RENAME_REQ;
  907. /* copy request flags */
  908. #define COPY_MUST_BE_FILE 0x0001
  909. #define COPY_MUST_BE_DIR 0x0002
  910. #define COPY_TARGET_MODE_ASCII 0x0004 /* if not set, binary */
  911. #define COPY_SOURCE_MODE_ASCII 0x0008 /* if not set, binary */
  912. #define COPY_VERIFY_WRITES 0x0010
  913. #define COPY_TREE 0x0020
  914. typedef struct smb_com_copy_req {
  915. struct smb_hdr hdr; /* wct = 3 */
  916. __u16 Tid2;
  917. __le16 OpenFunction;
  918. __le16 Flags;
  919. __le16 ByteCount;
  920. __u8 BufferFormat; /* 4 = ASCII or Unicode */
  921. unsigned char OldFileName[1];
  922. /* followed by __u8 BufferFormat2 */
  923. /* followed by NewFileName string */
  924. } __attribute__((packed)) COPY_REQ;
  925. typedef struct smb_com_copy_rsp {
  926. struct smb_hdr hdr; /* wct = 1 */
  927. __le16 CopyCount; /* number of files copied */
  928. __u16 ByteCount; /* may be zero */
  929. __u8 BufferFormat; /* 0x04 - only present if errored file follows */
  930. unsigned char ErrorFileName[1]; /* only present if error in copy */
  931. } __attribute__((packed)) COPY_RSP;
  932. #define CREATE_HARD_LINK 0x103
  933. #define MOVEFILE_COPY_ALLOWED 0x0002
  934. #define MOVEFILE_REPLACE_EXISTING 0x0001
  935. typedef struct smb_com_nt_rename_req { /* A5 - also used for create hardlink */
  936. struct smb_hdr hdr; /* wct = 4 */
  937. __le16 SearchAttributes; /* target file attributes */
  938. __le16 Flags; /* spec says Information Level */
  939. __le32 ClusterCount;
  940. __le16 ByteCount;
  941. __u8 BufferFormat; /* 4 = ASCII or Unicode */
  942. unsigned char OldFileName[1];
  943. /* followed by __u8 BufferFormat2 */
  944. /* followed by NewFileName */
  945. } __attribute__((packed)) NT_RENAME_REQ;
  946. typedef struct smb_com_rename_rsp {
  947. struct smb_hdr hdr; /* wct = 0 */
  948. __u16 ByteCount; /* bct = 0 */
  949. } __attribute__((packed)) RENAME_RSP;
  950. typedef struct smb_com_delete_file_req {
  951. struct smb_hdr hdr; /* wct = 1 */
  952. __le16 SearchAttributes;
  953. __le16 ByteCount;
  954. __u8 BufferFormat; /* 4 = ASCII */
  955. unsigned char fileName[1];
  956. } __attribute__((packed)) DELETE_FILE_REQ;
  957. typedef struct smb_com_delete_file_rsp {
  958. struct smb_hdr hdr; /* wct = 0 */
  959. __u16 ByteCount; /* bct = 0 */
  960. } __attribute__((packed)) DELETE_FILE_RSP;
  961. typedef struct smb_com_delete_directory_req {
  962. struct smb_hdr hdr; /* wct = 0 */
  963. __le16 ByteCount;
  964. __u8 BufferFormat; /* 4 = ASCII */
  965. unsigned char DirName[1];
  966. } __attribute__((packed)) DELETE_DIRECTORY_REQ;
  967. typedef struct smb_com_delete_directory_rsp {
  968. struct smb_hdr hdr; /* wct = 0 */
  969. __u16 ByteCount; /* bct = 0 */
  970. } __attribute__((packed)) DELETE_DIRECTORY_RSP;
  971. typedef struct smb_com_create_directory_req {
  972. struct smb_hdr hdr; /* wct = 0 */
  973. __le16 ByteCount;
  974. __u8 BufferFormat; /* 4 = ASCII */
  975. unsigned char DirName[1];
  976. } __attribute__((packed)) CREATE_DIRECTORY_REQ;
  977. typedef struct smb_com_create_directory_rsp {
  978. struct smb_hdr hdr; /* wct = 0 */
  979. __u16 ByteCount; /* bct = 0 */
  980. } __attribute__((packed)) CREATE_DIRECTORY_RSP;
  981. typedef struct smb_com_query_information_req {
  982. struct smb_hdr hdr; /* wct = 0 */
  983. __le16 ByteCount; /* 1 + namelen + 1 */
  984. __u8 BufferFormat; /* 4 = ASCII */
  985. unsigned char FileName[1];
  986. } __attribute__((packed)) QUERY_INFORMATION_REQ;
  987. typedef struct smb_com_query_information_rsp {
  988. struct smb_hdr hdr; /* wct = 10 */
  989. __le16 attr;
  990. __le32 last_write_time;
  991. __le32 size;
  992. __u16 reserved[5];
  993. __le16 ByteCount; /* bcc = 0 */
  994. } __attribute__((packed)) QUERY_INFORMATION_RSP;
  995. typedef struct smb_com_setattr_req {
  996. struct smb_hdr hdr; /* wct = 8 */
  997. __le16 attr;
  998. __le16 time_low;
  999. __le16 time_high;
  1000. __le16 reserved[5]; /* must be zero */
  1001. __u16 ByteCount;
  1002. __u8 BufferFormat; /* 4 = ASCII */
  1003. unsigned char fileName[1];
  1004. } __attribute__((packed)) SETATTR_REQ;
  1005. typedef struct smb_com_setattr_rsp {
  1006. struct smb_hdr hdr; /* wct = 0 */
  1007. __u16 ByteCount; /* bct = 0 */
  1008. } __attribute__((packed)) SETATTR_RSP;
  1009. /* empty wct response to setattr */
  1010. /*******************************************************/
  1011. /* NT Transact structure defintions follow */
  1012. /* Currently only ioctl, acl (get security descriptor) */
  1013. /* and notify are implemented */
  1014. /*******************************************************/
  1015. typedef struct smb_com_ntransact_req {
  1016. struct smb_hdr hdr; /* wct >= 19 */
  1017. __u8 MaxSetupCount;
  1018. __u16 Reserved;
  1019. __le32 TotalParameterCount;
  1020. __le32 TotalDataCount;
  1021. __le32 MaxParameterCount;
  1022. __le32 MaxDataCount;
  1023. __le32 ParameterCount;
  1024. __le32 ParameterOffset;
  1025. __le32 DataCount;
  1026. __le32 DataOffset;
  1027. __u8 SetupCount; /* four setup words follow subcommand */
  1028. /* SNIA spec incorrectly included spurious pad here */
  1029. __le16 SubCommand; /* 2 = IOCTL/FSCTL */
  1030. /* SetupCount words follow then */
  1031. __le16 ByteCount;
  1032. __u8 Pad[3];
  1033. __u8 Parms[0];
  1034. } __attribute__((packed)) NTRANSACT_REQ;
  1035. typedef struct smb_com_ntransact_rsp {
  1036. struct smb_hdr hdr; /* wct = 18 */
  1037. __u8 Reserved[3];
  1038. __le32 TotalParameterCount;
  1039. __le32 TotalDataCount;
  1040. __le32 ParameterCount;
  1041. __le32 ParameterOffset;
  1042. __le32 ParameterDisplacement;
  1043. __le32 DataCount;
  1044. __le32 DataOffset;
  1045. __le32 DataDisplacement;
  1046. __u8 SetupCount; /* 0 */
  1047. __u16 ByteCount;
  1048. /* __u8 Pad[3]; */
  1049. /* parms and data follow */
  1050. } __attribute__((packed)) NTRANSACT_RSP;
  1051. typedef struct smb_com_transaction_ioctl_req {
  1052. struct smb_hdr hdr; /* wct = 23 */
  1053. __u8 MaxSetupCount;
  1054. __u16 Reserved;
  1055. __le32 TotalParameterCount;
  1056. __le32 TotalDataCount;
  1057. __le32 MaxParameterCount;
  1058. __le32 MaxDataCount;
  1059. __le32 ParameterCount;
  1060. __le32 ParameterOffset;
  1061. __le32 DataCount;
  1062. __le32 DataOffset;
  1063. __u8 SetupCount; /* four setup words follow subcommand */
  1064. /* SNIA spec incorrectly included spurious pad here */
  1065. __le16 SubCommand; /* 2 = IOCTL/FSCTL */
  1066. __le32 FunctionCode;
  1067. __u16 Fid;
  1068. __u8 IsFsctl; /* 1 = File System Control 0 = device control (IOCTL) */
  1069. __u8 IsRootFlag; /* 1 = apply command to root of share (must be DFS) */
  1070. __le16 ByteCount;
  1071. __u8 Pad[3];
  1072. __u8 Data[1];
  1073. } __attribute__((packed)) TRANSACT_IOCTL_REQ;
  1074. typedef struct smb_com_transaction_ioctl_rsp {
  1075. struct smb_hdr hdr; /* wct = 19 */
  1076. __u8 Reserved[3];
  1077. __le32 TotalParameterCount;
  1078. __le32 TotalDataCount;
  1079. __le32 ParameterCount;
  1080. __le32 ParameterOffset;
  1081. __le32 ParameterDisplacement;
  1082. __le32 DataCount;
  1083. __le32 DataOffset;
  1084. __le32 DataDisplacement;
  1085. __u8 SetupCount; /* 1 */
  1086. __le16 ReturnedDataLen;
  1087. __u16 ByteCount;
  1088. } __attribute__((packed)) TRANSACT_IOCTL_RSP;
  1089. #define CIFS_ACL_OWNER 1
  1090. #define CIFS_ACL_GROUP 2
  1091. #define CIFS_ACL_DACL 4
  1092. #define CIFS_ACL_SACL 8
  1093. typedef struct smb_com_transaction_qsec_req {
  1094. struct smb_hdr hdr; /* wct = 19 */
  1095. __u8 MaxSetupCount;
  1096. __u16 Reserved;
  1097. __le32 TotalParameterCount;
  1098. __le32 TotalDataCount;
  1099. __le32 MaxParameterCount;
  1100. __le32 MaxDataCount;
  1101. __le32 ParameterCount;
  1102. __le32 ParameterOffset;
  1103. __le32 DataCount;
  1104. __le32 DataOffset;
  1105. __u8 SetupCount; /* no setup words follow subcommand */
  1106. /* SNIA spec incorrectly included spurious pad here */
  1107. __le16 SubCommand; /* 6 = QUERY_SECURITY_DESC */
  1108. __le16 ByteCount; /* bcc = 3 + 8 */
  1109. __u8 Pad[3];
  1110. __u16 Fid;
  1111. __u16 Reserved2;
  1112. __le32 AclFlags;
  1113. } __attribute__((packed)) QUERY_SEC_DESC_REQ;
  1114. typedef struct smb_com_transaction_ssec_req {
  1115. struct smb_hdr hdr; /* wct = 19 */
  1116. __u8 MaxSetupCount;
  1117. __u16 Reserved;
  1118. __le32 TotalParameterCount;
  1119. __le32 TotalDataCount;
  1120. __le32 MaxParameterCount;
  1121. __le32 MaxDataCount;
  1122. __le32 ParameterCount;
  1123. __le32 ParameterOffset;
  1124. __le32 DataCount;
  1125. __le32 DataOffset;
  1126. __u8 SetupCount; /* no setup words follow subcommand */
  1127. /* SNIA spec incorrectly included spurious pad here */
  1128. __le16 SubCommand; /* 3 = SET_SECURITY_DESC */
  1129. __le16 ByteCount; /* bcc = 3 + 8 */
  1130. __u8 Pad[3];
  1131. __u16 Fid;
  1132. __u16 Reserved2;
  1133. __le32 AclFlags;
  1134. } __attribute__((packed)) SET_SEC_DESC_REQ;
  1135. typedef struct smb_com_transaction_change_notify_req {
  1136. struct smb_hdr hdr; /* wct = 23 */
  1137. __u8 MaxSetupCount;
  1138. __u16 Reserved;
  1139. __le32 TotalParameterCount;
  1140. __le32 TotalDataCount;
  1141. __le32 MaxParameterCount;
  1142. __le32 MaxDataCount;
  1143. __le32 ParameterCount;
  1144. __le32 ParameterOffset;
  1145. __le32 DataCount;
  1146. __le32 DataOffset;
  1147. __u8 SetupCount; /* four setup words follow subcommand */
  1148. /* SNIA spec incorrectly included spurious pad here */
  1149. __le16 SubCommand;/* 4 = Change Notify */
  1150. __le32 CompletionFilter; /* operation to monitor */
  1151. __u16 Fid;
  1152. __u8 WatchTree; /* 1 = Monitor subdirectories */
  1153. __u8 Reserved2;
  1154. __le16 ByteCount;
  1155. /* __u8 Pad[3];*/
  1156. /* __u8 Data[1];*/
  1157. } __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_REQ;
  1158. /* BB eventually change to use generic ntransact rsp struct
  1159. and validation routine */
  1160. typedef struct smb_com_transaction_change_notify_rsp {
  1161. struct smb_hdr hdr; /* wct = 18 */
  1162. __u8 Reserved[3];
  1163. __le32 TotalParameterCount;
  1164. __le32 TotalDataCount;
  1165. __le32 ParameterCount;
  1166. __le32 ParameterOffset;
  1167. __le32 ParameterDisplacement;
  1168. __le32 DataCount;
  1169. __le32 DataOffset;
  1170. __le32 DataDisplacement;
  1171. __u8 SetupCount; /* 0 */
  1172. __u16 ByteCount;
  1173. /* __u8 Pad[3]; */
  1174. } __attribute__((packed)) TRANSACT_CHANGE_NOTIFY_RSP;
  1175. /* Completion Filter flags for Notify */
  1176. #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
  1177. #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
  1178. #define FILE_NOTIFY_CHANGE_NAME 0x00000003
  1179. #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
  1180. #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
  1181. #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
  1182. #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
  1183. #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
  1184. #define FILE_NOTIFY_CHANGE_EA 0x00000080
  1185. #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
  1186. #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
  1187. #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
  1188. #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
  1189. #define FILE_ACTION_ADDED 0x00000001
  1190. #define FILE_ACTION_REMOVED 0x00000002
  1191. #define FILE_ACTION_MODIFIED 0x00000003
  1192. #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
  1193. #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
  1194. #define FILE_ACTION_ADDED_STREAM 0x00000006
  1195. #define FILE_ACTION_REMOVED_STREAM 0x00000007
  1196. #define FILE_ACTION_MODIFIED_STREAM 0x00000008
  1197. /* response contains array of the following structures */
  1198. struct file_notify_information {
  1199. __le32 NextEntryOffset;
  1200. __le32 Action;
  1201. __le32 FileNameLength;
  1202. __u8 FileName[0];
  1203. } __attribute__((packed));
  1204. struct reparse_data {
  1205. __u32 ReparseTag;
  1206. __u16 ReparseDataLength;
  1207. __u16 Reserved;
  1208. __u16 AltNameOffset;
  1209. __u16 AltNameLen;
  1210. __u16 TargetNameOffset;
  1211. __u16 TargetNameLen;
  1212. char LinkNamesBuf[1];
  1213. } __attribute__((packed));
  1214. struct cifs_quota_data {
  1215. __u32 rsrvd1; /* 0 */
  1216. __u32 sid_size;
  1217. __u64 rsrvd2; /* 0 */
  1218. __u64 space_used;
  1219. __u64 soft_limit;
  1220. __u64 hard_limit;
  1221. char sid[1]; /* variable size? */
  1222. } __attribute__((packed));
  1223. /* quota sub commands */
  1224. #define QUOTA_LIST_CONTINUE 0
  1225. #define QUOTA_LIST_START 0x100
  1226. #define QUOTA_FOR_SID 0x101
  1227. struct trans2_req {
  1228. /* struct smb_hdr hdr precedes. Set wct = 14+ */
  1229. __le16 TotalParameterCount;
  1230. __le16 TotalDataCount;
  1231. __le16 MaxParameterCount;
  1232. __le16 MaxDataCount;
  1233. __u8 MaxSetupCount;
  1234. __u8 Reserved;
  1235. __le16 Flags;
  1236. __le32 Timeout;
  1237. __u16 Reserved2;
  1238. __le16 ParameterCount;
  1239. __le16 ParameterOffset;
  1240. __le16 DataCount;
  1241. __le16 DataOffset;
  1242. __u8 SetupCount;
  1243. __u8 Reserved3;
  1244. __le16 SubCommand; /* 1st setup word - SetupCount words follow */
  1245. __le16 ByteCount;
  1246. } __attribute__((packed));
  1247. struct smb_t2_req {
  1248. struct smb_hdr hdr;
  1249. struct trans2_req t2_req;
  1250. } __attribute__((packed));
  1251. struct trans2_resp {
  1252. /* struct smb_hdr hdr precedes. Note wct = 10 + setup count */
  1253. __le16 TotalParameterCount;
  1254. __le16 TotalDataCount;
  1255. __u16 Reserved;
  1256. __le16 ParameterCount;
  1257. __le16 ParameterOffset;
  1258. __le16 ParameterDisplacement;
  1259. __le16 DataCount;
  1260. __le16 DataOffset;
  1261. __le16 DataDisplacement;
  1262. __u8 SetupCount;
  1263. __u8 Reserved1;
  1264. /* SetupWords[SetupCount];
  1265. __u16 ByteCount;
  1266. __u16 Reserved2;*/
  1267. /* data area follows */
  1268. } __attribute__((packed));
  1269. struct smb_t2_rsp {
  1270. struct smb_hdr hdr;
  1271. struct trans2_resp t2_rsp;
  1272. } __attribute__((packed));
  1273. /* PathInfo/FileInfo infolevels */
  1274. #define SMB_INFO_STANDARD 1
  1275. #define SMB_SET_FILE_EA 2
  1276. #define SMB_QUERY_FILE_EA_SIZE 2
  1277. #define SMB_INFO_QUERY_EAS_FROM_LIST 3
  1278. #define SMB_INFO_QUERY_ALL_EAS 4
  1279. #define SMB_INFO_IS_NAME_VALID 6
  1280. #define SMB_QUERY_FILE_BASIC_INFO 0x101
  1281. #define SMB_QUERY_FILE_STANDARD_INFO 0x102
  1282. #define SMB_QUERY_FILE_EA_INFO 0x103
  1283. #define SMB_QUERY_FILE_NAME_INFO 0x104
  1284. #define SMB_QUERY_FILE_ALLOCATION_INFO 0x105
  1285. #define SMB_QUERY_FILE_END_OF_FILEINFO 0x106
  1286. #define SMB_QUERY_FILE_ALL_INFO 0x107
  1287. #define SMB_QUERY_ALT_NAME_INFO 0x108
  1288. #define SMB_QUERY_FILE_STREAM_INFO 0x109
  1289. #define SMB_QUERY_FILE_COMPRESSION_INFO 0x10B
  1290. #define SMB_QUERY_FILE_UNIX_BASIC 0x200
  1291. #define SMB_QUERY_FILE_UNIX_LINK 0x201
  1292. #define SMB_QUERY_POSIX_ACL 0x204
  1293. #define SMB_QUERY_XATTR 0x205 /* e.g. system EA name space */
  1294. #define SMB_QUERY_ATTR_FLAGS 0x206 /* append,immutable etc. */
  1295. #define SMB_QUERY_POSIX_PERMISSION 0x207
  1296. #define SMB_QUERY_POSIX_LOCK 0x208
  1297. /* #define SMB_POSIX_OPEN 0x209 */
  1298. /* #define SMB_POSIX_UNLINK 0x20a */
  1299. #define SMB_QUERY_FILE__UNIX_INFO2 0x20b
  1300. #define SMB_QUERY_FILE_INTERNAL_INFO 0x3ee
  1301. #define SMB_QUERY_FILE_ACCESS_INFO 0x3f0
  1302. #define SMB_QUERY_FILE_NAME_INFO2 0x3f1 /* 0x30 bytes */
  1303. #define SMB_QUERY_FILE_POSITION_INFO 0x3f6
  1304. #define SMB_QUERY_FILE_MODE_INFO 0x3f8
  1305. #define SMB_QUERY_FILE_ALGN_INFO 0x3f9
  1306. #define SMB_SET_FILE_BASIC_INFO 0x101
  1307. #define SMB_SET_FILE_DISPOSITION_INFO 0x102
  1308. #define SMB_SET_FILE_ALLOCATION_INFO 0x103
  1309. #define SMB_SET_FILE_END_OF_FILE_INFO 0x104
  1310. #define SMB_SET_FILE_UNIX_BASIC 0x200
  1311. #define SMB_SET_FILE_UNIX_LINK 0x201
  1312. #define SMB_SET_FILE_UNIX_HLINK 0x203
  1313. #define SMB_SET_POSIX_ACL 0x204
  1314. #define SMB_SET_XATTR 0x205
  1315. #define SMB_SET_ATTR_FLAGS 0x206 /* append, immutable etc. */
  1316. #define SMB_SET_POSIX_LOCK 0x208
  1317. #define SMB_POSIX_OPEN 0x209
  1318. #define SMB_POSIX_UNLINK 0x20a
  1319. #define SMB_SET_FILE_UNIX_INFO2 0x20b
  1320. #define SMB_SET_FILE_BASIC_INFO2 0x3ec
  1321. #define SMB_SET_FILE_RENAME_INFORMATION 0x3f2 /* BB check if qpathinfo too */
  1322. #define SMB_FILE_ALL_INFO2 0x3fa
  1323. #define SMB_SET_FILE_ALLOCATION_INFO2 0x3fb
  1324. #define SMB_SET_FILE_END_OF_FILE_INFO2 0x3fc
  1325. #define SMB_FILE_MOVE_CLUSTER_INFO 0x407
  1326. #define SMB_FILE_QUOTA_INFO 0x408
  1327. #define SMB_FILE_REPARSEPOINT_INFO 0x409
  1328. #define SMB_FILE_MAXIMUM_INFO 0x40d
  1329. /* Find File infolevels */
  1330. #define SMB_FIND_FILE_INFO_STANDARD 0x001
  1331. #define SMB_FIND_FILE_QUERY_EA_SIZE 0x002
  1332. #define SMB_FIND_FILE_QUERY_EAS_FROM_LIST 0x003
  1333. #define SMB_FIND_FILE_DIRECTORY_INFO 0x101
  1334. #define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
  1335. #define SMB_FIND_FILE_NAMES_INFO 0x103
  1336. #define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104
  1337. #define SMB_FIND_FILE_ID_FULL_DIR_INFO 0x105
  1338. #define SMB_FIND_FILE_ID_BOTH_DIR_INFO 0x106
  1339. #define SMB_FIND_FILE_UNIX 0x202
  1340. typedef struct smb_com_transaction2_qpi_req {
  1341. struct smb_hdr hdr; /* wct = 14+ */
  1342. __le16 TotalParameterCount;
  1343. __le16 TotalDataCount;
  1344. __le16 MaxParameterCount;
  1345. __le16 MaxDataCount;
  1346. __u8 MaxSetupCount;
  1347. __u8 Reserved;
  1348. __le16 Flags;
  1349. __le32 Timeout;
  1350. __u16 Reserved2;
  1351. __le16 ParameterCount;
  1352. __le16 ParameterOffset;
  1353. __le16 DataCount;
  1354. __le16 DataOffset;
  1355. __u8 SetupCount;
  1356. __u8 Reserved3;
  1357. __le16 SubCommand; /* one setup word */
  1358. __le16 ByteCount;
  1359. __u8 Pad;
  1360. __le16 InformationLevel;
  1361. __u32 Reserved4;
  1362. char FileName[1];
  1363. } __attribute__((packed)) TRANSACTION2_QPI_REQ;
  1364. typedef struct smb_com_transaction2_qpi_rsp {
  1365. struct smb_hdr hdr; /* wct = 10 + SetupCount */
  1366. struct trans2_resp t2;
  1367. __u16 ByteCount;
  1368. __u16 Reserved2; /* parameter word is present for infolevels > 100 */
  1369. } __attribute__((packed)) TRANSACTION2_QPI_RSP;
  1370. typedef struct smb_com_transaction2_spi_req {
  1371. struct smb_hdr hdr; /* wct = 15 */
  1372. __le16 TotalParameterCount;
  1373. __le16 TotalDataCount;
  1374. __le16 MaxParameterCount;
  1375. __le16 MaxDataCount;
  1376. __u8 MaxSetupCount;
  1377. __u8 Reserved;
  1378. __le16 Flags;
  1379. __le32 Timeout;
  1380. __u16 Reserved2;
  1381. __le16 ParameterCount;
  1382. __le16 ParameterOffset;
  1383. __le16 DataCount;
  1384. __le16 DataOffset;
  1385. __u8 SetupCount;
  1386. __u8 Reserved3;
  1387. __le16 SubCommand; /* one setup word */
  1388. __le16 ByteCount;
  1389. __u8 Pad;
  1390. __u16 Pad1;
  1391. __le16 InformationLevel;
  1392. __u32 Reserved4;
  1393. char FileName[1];
  1394. } __attribute__((packed)) TRANSACTION2_SPI_REQ;
  1395. typedef struct smb_com_transaction2_spi_rsp {
  1396. struct smb_hdr hdr; /* wct = 10 + SetupCount */
  1397. struct trans2_resp t2;
  1398. __u16 ByteCount;
  1399. __u16 Reserved2; /* parameter word is present for infolevels > 100 */
  1400. } __attribute__((packed)) TRANSACTION2_SPI_RSP;
  1401. struct set_file_rename {
  1402. __le32 overwrite; /* 1 = overwrite dest */
  1403. __u32 root_fid; /* zero */
  1404. __le32 target_name_len;
  1405. char target_name[0]; /* Must be unicode */
  1406. } __attribute__((packed));
  1407. struct smb_com_transaction2_sfi_req {
  1408. struct smb_hdr hdr; /* wct = 15 */
  1409. __le16 TotalParameterCount;
  1410. __le16 TotalDataCount;
  1411. __le16 MaxParameterCount;
  1412. __le16 MaxDataCount;
  1413. __u8 MaxSetupCount;
  1414. __u8 Reserved;
  1415. __le16 Flags;
  1416. __le32 Timeout;
  1417. __u16 Reserved2;
  1418. __le16 ParameterCount;
  1419. __le16 ParameterOffset;
  1420. __le16 DataCount;
  1421. __le16 DataOffset;
  1422. __u8 SetupCount;
  1423. __u8 Reserved3;
  1424. __le16 SubCommand; /* one setup word */
  1425. __le16 ByteCount;
  1426. __u8 Pad;
  1427. __u16 Pad1;
  1428. __u16 Fid;
  1429. __le16 InformationLevel;
  1430. __u16 Reserved4;
  1431. } __attribute__((packed));
  1432. struct smb_com_transaction2_sfi_rsp {
  1433. struct smb_hdr hdr; /* wct = 10 + SetupCount */
  1434. struct trans2_resp t2;
  1435. __u16 ByteCount;
  1436. __u16 Reserved2; /* parameter word reserved -
  1437. present for infolevels > 100 */
  1438. } __attribute__((packed));
  1439. struct smb_t2_qfi_req {
  1440. struct smb_hdr hdr;
  1441. struct trans2_req t2;
  1442. __u8 Pad;
  1443. __u16 Fid;
  1444. __le16 InformationLevel;
  1445. } __attribute__((packed));
  1446. struct smb_t2_qfi_rsp {
  1447. struct smb_hdr hdr; /* wct = 10 + SetupCount */
  1448. struct trans2_resp t2;
  1449. __u16 ByteCount;
  1450. __u16 Reserved2; /* parameter word reserved -
  1451. present for infolevels > 100 */
  1452. } __attribute__((packed));
  1453. /*
  1454. * Flags on T2 FINDFIRST and FINDNEXT
  1455. */
  1456. #define CIFS_SEARCH_CLOSE_ALWAYS 0x0001
  1457. #define CIFS_SEARCH_CLOSE_AT_END 0x0002
  1458. #define CIFS_SEARCH_RETURN_RESUME 0x0004
  1459. #define CIFS_SEARCH_CONTINUE_FROM_LAST 0x0008
  1460. #define CIFS_SEARCH_BACKUP_SEARCH 0x0010
  1461. /*
  1462. * Size of the resume key on FINDFIRST and FINDNEXT calls
  1463. */
  1464. #define CIFS_SMB_RESUME_KEY_SIZE 4
  1465. typedef struct smb_com_transaction2_ffirst_req {
  1466. struct smb_hdr hdr; /* wct = 15 */
  1467. __le16 TotalParameterCount;
  1468. __le16 TotalDataCount;
  1469. __le16 MaxParameterCount;
  1470. __le16 MaxDataCount;
  1471. __u8 MaxSetupCount;
  1472. __u8 Reserved;
  1473. __le16 Flags;
  1474. __le32 Timeout;
  1475. __u16 Reserved2;
  1476. __le16 ParameterCount;
  1477. __le16 ParameterOffset;
  1478. __le16 DataCount;
  1479. __le16 DataOffset;
  1480. __u8 SetupCount; /* one */
  1481. __u8 Reserved3;
  1482. __le16 SubCommand; /* TRANS2_FIND_FIRST */
  1483. __le16 ByteCount;
  1484. __u8 Pad;
  1485. __le16 SearchAttributes;
  1486. __le16 SearchCount;
  1487. __le16 SearchFlags;
  1488. __le16 InformationLevel;
  1489. __le32 SearchStorageType;
  1490. char FileName[1];
  1491. } __attribute__((packed)) TRANSACTION2_FFIRST_REQ;
  1492. typedef struct smb_com_transaction2_ffirst_rsp {
  1493. struct smb_hdr hdr; /* wct = 10 */
  1494. struct trans2_resp t2;
  1495. __u16 ByteCount;
  1496. } __attribute__((packed)) TRANSACTION2_FFIRST_RSP;
  1497. typedef struct smb_com_transaction2_ffirst_rsp_parms {
  1498. __u16 SearchHandle;
  1499. __le16 SearchCount;
  1500. __le16 EndofSearch;
  1501. __le16 EAErrorOffset;
  1502. __le16 LastNameOffset;
  1503. } __attribute__((packed)) T2_FFIRST_RSP_PARMS;
  1504. typedef struct smb_com_transaction2_fnext_req {
  1505. struct smb_hdr hdr; /* wct = 15 */
  1506. __le16 TotalParameterCount;
  1507. __le16 TotalDataCount;
  1508. __le16 MaxParameterCount;
  1509. __le16 MaxDataCount;
  1510. __u8 MaxSetupCount;
  1511. __u8 Reserved;
  1512. __le16 Flags;
  1513. __le32 Timeout;
  1514. __u16 Reserved2;
  1515. __le16 ParameterCount;
  1516. __le16 ParameterOffset;
  1517. __le16 DataCount;
  1518. __le16 DataOffset;
  1519. __u8 SetupCount; /* one */
  1520. __u8 Reserved3;
  1521. __le16 SubCommand; /* TRANS2_FIND_NEXT */
  1522. __le16 ByteCount;
  1523. __u8 Pad;
  1524. __u16 SearchHandle;
  1525. __le16 SearchCount;
  1526. __le16 InformationLevel;
  1527. __u32 ResumeKey;
  1528. __le16 SearchFlags;
  1529. char ResumeFileName[1];
  1530. } __attribute__((packed)) TRANSACTION2_FNEXT_REQ;
  1531. typedef struct smb_com_transaction2_fnext_rsp {
  1532. struct smb_hdr hdr; /* wct = 10 */
  1533. struct trans2_resp t2;
  1534. __u16 ByteCount;
  1535. } __attribute__((packed)) TRANSACTION2_FNEXT_RSP;
  1536. typedef struct smb_com_transaction2_fnext_rsp_parms {
  1537. __le16 SearchCount;
  1538. __le16 EndofSearch;
  1539. __le16 EAErrorOffset;
  1540. __le16 LastNameOffset;
  1541. } __attribute__((packed)) T2_FNEXT_RSP_PARMS;
  1542. /* QFSInfo Levels */
  1543. #define SMB_INFO_ALLOCATION 1
  1544. #define SMB_INFO_VOLUME 2
  1545. #define SMB_QUERY_FS_VOLUME_INFO 0x102
  1546. #define SMB_QUERY_FS_SIZE_INFO 0x103
  1547. #define SMB_QUERY_FS_DEVICE_INFO 0x104
  1548. #define SMB_QUERY_FS_ATTRIBUTE_INFO 0x105
  1549. #define SMB_QUERY_CIFS_UNIX_INFO 0x200
  1550. #define SMB_QUERY_POSIX_FS_INFO 0x201
  1551. #define SMB_QUERY_POSIX_WHO_AM_I 0x202
  1552. #define SMB_QUERY_LABEL_INFO 0x3ea
  1553. #define SMB_QUERY_FS_QUOTA_INFO 0x3ee
  1554. #define SMB_QUERY_FS_FULL_SIZE_INFO 0x3ef
  1555. #define SMB_QUERY_OBJECTID_INFO 0x3f0
  1556. typedef struct smb_com_transaction2_qfsi_req {
  1557. struct smb_hdr hdr; /* wct = 14+ */
  1558. __le16 TotalParameterCount;
  1559. __le16 TotalDataCount;
  1560. __le16 MaxParameterCount;
  1561. __le16 MaxDataCount;
  1562. __u8 MaxSetupCount;
  1563. __u8 Reserved;
  1564. __le16 Flags;
  1565. __le32 Timeout;
  1566. __u16 Reserved2;
  1567. __le16 ParameterCount;
  1568. __le16 ParameterOffset;
  1569. __le16 DataCount;
  1570. __le16 DataOffset;
  1571. __u8 SetupCount;
  1572. __u8 Reserved3;
  1573. __le16 SubCommand; /* one setup word */
  1574. __le16 ByteCount;
  1575. __u8 Pad;
  1576. __le16 InformationLevel;
  1577. } __attribute__((packed)) TRANSACTION2_QFSI_REQ;
  1578. typedef struct smb_com_transaction_qfsi_rsp {
  1579. struct smb_hdr hdr; /* wct = 10 + SetupCount */
  1580. struct trans2_resp t2;
  1581. __u16 ByteCount;
  1582. __u8 Pad; /* may be three bytes? *//* followed by data area */
  1583. } __attribute__((packed)) TRANSACTION2_QFSI_RSP;
  1584. typedef struct whoami_rsp_data { /* Query level 0x202 */
  1585. __u32 flags; /* 0 = Authenticated user 1 = GUEST */
  1586. __u32 mask; /* which flags bits server understands ie 0x0001 */
  1587. __u64 unix_user_id;
  1588. __u64 unix_user_gid;
  1589. __u32 number_of_supplementary_gids; /* may be zero */
  1590. __u32 number_of_sids; /* may be zero */
  1591. __u32 length_of_sid_array; /* in bytes - may be zero */
  1592. __u32 pad; /* reserved - MBZ */
  1593. /* __u64 gid_array[0]; */ /* may be empty */
  1594. /* __u8 * psid_list */ /* may be empty */
  1595. } __attribute__((packed)) WHOAMI_RSP_DATA;
  1596. /* SETFSInfo Levels */
  1597. #define SMB_SET_CIFS_UNIX_INFO 0x200
  1598. typedef struct smb_com_transaction2_setfsi_req {
  1599. struct smb_hdr hdr; /* wct = 15 */
  1600. __le16 TotalParameterCount;
  1601. __le16 TotalDataCount;
  1602. __le16 MaxParameterCount;
  1603. __le16 MaxDataCount;
  1604. __u8 MaxSetupCount;
  1605. __u8 Reserved;
  1606. __le16 Flags;
  1607. __le32 Timeout;
  1608. __u16 Reserved2;
  1609. __le16 ParameterCount; /* 4 */
  1610. __le16 ParameterOffset;
  1611. __le16 DataCount; /* 12 */
  1612. __le16 DataOffset;
  1613. __u8 SetupCount; /* one */
  1614. __u8 Reserved3;
  1615. __le16 SubCommand; /* TRANS2_SET_FS_INFORMATION */
  1616. __le16 ByteCount;
  1617. __u8 Pad;
  1618. __u16 FileNum; /* Parameters start. */
  1619. __le16 InformationLevel;/* Parameters end. */
  1620. __le16 ClientUnixMajor; /* Data start. */
  1621. __le16 ClientUnixMinor;
  1622. __le64 ClientUnixCap; /* Data end */
  1623. } __attribute__((packed)) TRANSACTION2_SETFSI_REQ;
  1624. typedef struct smb_com_transaction2_setfsi_rsp {
  1625. struct smb_hdr hdr; /* wct = 10 */
  1626. struct trans2_resp t2;
  1627. __u16 ByteCount;
  1628. } __attribute__((packed)) TRANSACTION2_SETFSI_RSP;
  1629. typedef struct smb_com_transaction2_get_dfs_refer_req {
  1630. struct smb_hdr hdr; /* wct = 15 */
  1631. __le16 TotalParameterCount;
  1632. __le16 TotalDataCount;
  1633. __le16 MaxParameterCount;
  1634. __le16 MaxDataCount;
  1635. __u8 MaxSetupCount;
  1636. __u8 Reserved;
  1637. __le16 Flags;
  1638. __le32 Timeout;
  1639. __u16 Reserved2;
  1640. __le16 ParameterCount;
  1641. __le16 ParameterOffset;
  1642. __le16 DataCount;
  1643. __le16 DataOffset;
  1644. __u8 SetupCount;
  1645. __u8 Reserved3;
  1646. __le16 SubCommand; /* one setup word */
  1647. __le16 ByteCount;
  1648. __u8 Pad[3]; /* Win2K has sent 0x0F01 (max response length
  1649. perhaps?) followed by one byte pad - doesn't
  1650. seem to matter though */
  1651. __le16 MaxReferralLevel;
  1652. char RequestFileName[1];
  1653. } __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_REQ;
  1654. typedef struct dfs_referral_level_3 {
  1655. __le16 VersionNumber;
  1656. __le16 ReferralSize;
  1657. __le16 ServerType; /* 0x0001 = CIFS server */
  1658. __le16 ReferralFlags; /* or proximity - not clear which since it is
  1659. always set to zero - SNIA spec says 0x01
  1660. means strip off PathConsumed chars before
  1661. submitting RequestFileName to remote node */
  1662. __le16 TimeToLive;
  1663. __le16 Proximity;
  1664. __le16 DfsPathOffset;
  1665. __le16 DfsAlternatePathOffset;
  1666. __le16 NetworkAddressOffset;
  1667. } __attribute__((packed)) REFERRAL3;
  1668. typedef struct smb_com_transaction_get_dfs_refer_rsp {
  1669. struct smb_hdr hdr; /* wct = 10 */
  1670. struct trans2_resp t2;
  1671. __u16 ByteCount;
  1672. __u8 Pad;
  1673. __le16 PathConsumed;
  1674. __le16 NumberOfReferrals;
  1675. __le16 DFSFlags;
  1676. __u16 Pad2;
  1677. REFERRAL3 referrals[1]; /* array of level 3 dfs_referral structures */
  1678. /* followed by the strings pointed to by the referral structures */
  1679. } __attribute__((packed)) TRANSACTION2_GET_DFS_REFER_RSP;
  1680. /* DFS Flags */
  1681. #define DFSREF_REFERRAL_SERVER 0x0001
  1682. #define DFSREF_STORAGE_SERVER 0x0002
  1683. /* IOCTL information */
  1684. /*
  1685. * List of ioctl function codes that look to be of interest to remote clients
  1686. * like this one. Need to do some experimentation to make sure they all work
  1687. * remotely. Some of the following, such as the encryption/compression ones
  1688. * would be invoked from tools via a specialized hook into the VFS rather
  1689. * than via the standard vfs entry points
  1690. */
  1691. #define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
  1692. #define FSCTL_REQUEST_OPLOCK_LEVEL_2 0x00090004
  1693. #define FSCTL_REQUEST_BATCH_OPLOCK 0x00090008
  1694. #define FSCTL_LOCK_VOLUME 0x00090018
  1695. #define FSCTL_UNLOCK_VOLUME 0x0009001C
  1696. #define FSCTL_GET_COMPRESSION 0x0009003C
  1697. #define FSCTL_SET_COMPRESSION 0x0009C040
  1698. #define FSCTL_REQUEST_FILTER_OPLOCK 0x0009008C
  1699. #define FSCTL_FILESYS_GET_STATISTICS 0x00090090
  1700. #define FSCTL_SET_REPARSE_POINT 0x000900A4
  1701. #define FSCTL_GET_REPARSE_POINT 0x000900A8
  1702. #define FSCTL_DELETE_REPARSE_POINT 0x000900AC
  1703. #define FSCTL_SET_SPARSE 0x000900C4
  1704. #define FSCTL_SET_ZERO_DATA 0x000900C8
  1705. #define FSCTL_SET_ENCRYPTION 0x000900D7
  1706. #define FSCTL_ENCRYPTION_FSCTL_IO 0x000900DB
  1707. #define FSCTL_WRITE_RAW_ENCRYPTED 0x000900DF
  1708. #define FSCTL_READ_RAW_ENCRYPTED 0x000900E3
  1709. #define FSCTL_SIS_COPYFILE 0x00090100
  1710. #define FSCTL_SIS_LINK_FILES 0x0009C104
  1711. #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
  1712. #define IO_REPARSE_TAG_HSM 0xC0000004
  1713. #define IO_REPARSE_TAG_SIS 0x80000007
  1714. /*
  1715. ************************************************************************
  1716. * All structs for everything above the SMB PDUs themselves
  1717. * (such as the T2 level specific data) go here
  1718. ************************************************************************
  1719. */
  1720. /*
  1721. * Information on a server
  1722. */
  1723. struct serverInfo {
  1724. char name[16];
  1725. unsigned char versionMajor;
  1726. unsigned char versionMinor;
  1727. unsigned long type;
  1728. unsigned int commentOffset;
  1729. } __attribute__((packed));
  1730. /*
  1731. * The following structure is the format of the data returned on a NetShareEnum
  1732. * with level "90" (x5A)
  1733. */
  1734. struct shareInfo {
  1735. char shareName[13];
  1736. char pad;
  1737. unsigned short type;
  1738. unsigned int commentOffset;
  1739. } __attribute__((packed));
  1740. struct aliasInfo {
  1741. char aliasName[9];
  1742. char pad;
  1743. unsigned int commentOffset;
  1744. unsigned char type[2];
  1745. } __attribute__((packed));
  1746. struct aliasInfo92 {
  1747. int aliasNameOffset;
  1748. int serverNameOffset;
  1749. int shareNameOffset;
  1750. } __attribute__((packed));
  1751. typedef struct {
  1752. __le64 TotalAllocationUnits;
  1753. __le64 FreeAllocationUnits;
  1754. __le32 SectorsPerAllocationUnit;
  1755. __le32 BytesPerSector;
  1756. } __attribute__((packed)) FILE_SYSTEM_INFO; /* size info, level 0x103 */
  1757. typedef struct {
  1758. __le32 fsid;
  1759. __le32 SectorsPerAllocationUnit;
  1760. __le32 TotalAllocationUnits;
  1761. __le32 FreeAllocationUnits;
  1762. __le16 BytesPerSector;
  1763. } __attribute__((packed)) FILE_SYSTEM_ALLOC_INFO;
  1764. typedef struct {
  1765. __le16 MajorVersionNumber;
  1766. __le16 MinorVersionNumber;
  1767. __le64 Capability;
  1768. } __attribute__((packed)) FILE_SYSTEM_UNIX_INFO; /* Unix extension level 0x200*/
  1769. /* Version numbers for CIFS UNIX major and minor. */
  1770. #define CIFS_UNIX_MAJOR_VERSION 1
  1771. #define CIFS_UNIX_MINOR_VERSION 0
  1772. /* Linux/Unix extensions capability flags */
  1773. #define CIFS_UNIX_FCNTL_CAP 0x00000001 /* support for fcntl locks */
  1774. #define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */
  1775. #define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */
  1776. #define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */
  1777. #define CIFS_UNIX_POSIX_PATHNAMES_CAP 0x00000010 /* Allow POSIX path chars */
  1778. #define CIFS_UNIX_POSIX_PATH_OPS_CAP 0x00000020 /* Allow new POSIX path based
  1779. calls including posix open
  1780. and posix unlink */
  1781. #define CIFS_UNIX_LARGE_READ_CAP 0x00000040 /* support reads >128K (up
  1782. to 0xFFFF00 */
  1783. #define CIFS_UNIX_LARGE_WRITE_CAP 0x00000080
  1784. #ifdef CONFIG_CIFS_POSIX
  1785. /* Can not set pathnames cap yet until we send new posix create SMB since
  1786. otherwise server can treat such handles opened with older ntcreatex
  1787. (by a new client which knows how to send posix path ops)
  1788. as non-posix handles (can affect write behavior with byte range locks.
  1789. We can add back in POSIX_PATH_OPS cap when Posix Create/Mkdir finished */
  1790. /* #define CIFS_UNIX_CAP_MASK 0x000000fb */
  1791. #define CIFS_UNIX_CAP_MASK 0x000000db
  1792. #else
  1793. #define CIFS_UNIX_CAP_MASK 0x00000013
  1794. #endif /* CONFIG_CIFS_POSIX */
  1795. #define CIFS_POSIX_EXTENSIONS 0x00000010 /* support for new QFSInfo */
  1796. typedef struct {
  1797. /* For undefined recommended transfer size return -1 in that field */
  1798. __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */
  1799. __le32 BlockSize;
  1800. /* The next three fields are in terms of the block size.
  1801. (above). If block size is unknown, 4096 would be a
  1802. reasonable block size for a server to report.
  1803. Note that returning the blocks/blocksavail removes need
  1804. to make a second call (to QFSInfo level 0x103 to get this info.
  1805. UserBlockAvail is typically less than or equal to BlocksAvail,
  1806. if no distinction is made return the same value in each */
  1807. __le64 TotalBlocks;
  1808. __le64 BlocksAvail; /* bfree */
  1809. __le64 UserBlocksAvail; /* bavail */
  1810. /* For undefined Node fields or FSID return -1 */
  1811. __le64 TotalFileNodes;
  1812. __le64 FreeFileNodes;
  1813. __le64 FileSysIdentifier; /* fsid */
  1814. /* NB Namelen comes from FILE_SYSTEM_ATTRIBUTE_INFO call */
  1815. /* NB flags can come from FILE_SYSTEM_DEVICE_INFO call */
  1816. } __attribute__((packed)) FILE_SYSTEM_POSIX_INFO;
  1817. /* DeviceType Flags */
  1818. #define FILE_DEVICE_CD_ROM 0x00000002
  1819. #define FILE_DEVICE_CD_ROM_FILE_SYSTEM 0x00000003
  1820. #define FILE_DEVICE_DFS 0x00000006
  1821. #define FILE_DEVICE_DISK 0x00000007
  1822. #define FILE_DEVICE_DISK_FILE_SYSTEM 0x00000008
  1823. #define FILE_DEVICE_FILE_SYSTEM 0x00000009
  1824. #define FILE_DEVICE_NAMED_PIPE 0x00000011
  1825. #define FILE_DEVICE_NETWORK 0x00000012
  1826. #define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
  1827. #define FILE_DEVICE_NULL 0x00000015
  1828. #define FILE_DEVICE_PARALLEL_PORT 0x00000016
  1829. #define FILE_DEVICE_PRINTER 0x00000018
  1830. #define FILE_DEVICE_SERIAL_PORT 0x0000001b
  1831. #define FILE_DEVICE_STREAMS 0x0000001e
  1832. #define FILE_DEVICE_TAPE 0x0000001f
  1833. #define FILE_DEVICE_TAPE_FILE_SYSTEM 0x00000020
  1834. #define FILE_DEVICE_VIRTUAL_DISK 0x00000024
  1835. #define FILE_DEVICE_NETWORK_REDIRECTOR 0x00000028
  1836. typedef struct {
  1837. __le32 DeviceType;
  1838. __le32 DeviceCharacteristics;
  1839. } __attribute__((packed)) FILE_SYSTEM_DEVICE_INFO; /* device info level 0x104 */
  1840. typedef struct {
  1841. __le32 Attributes;
  1842. __le32 MaxPathNameComponentLength;
  1843. __le32 FileSystemNameLen;
  1844. char FileSystemName[52]; /* do not have to save this - get subset? */
  1845. } __attribute__((packed)) FILE_SYSTEM_ATTRIBUTE_INFO;
  1846. /******************************************************************************/
  1847. /* QueryFileInfo/QueryPathinfo (also for SetPath/SetFile) data buffer formats */
  1848. /******************************************************************************/
  1849. typedef struct { /* data block encoding of response to level 263 QPathInfo */
  1850. __le64 CreationTime;
  1851. __le64 LastAccessTime;
  1852. __le64 LastWriteTime;
  1853. __le64 ChangeTime;
  1854. __le32 Attributes;
  1855. __u32 Pad1;
  1856. __le64 AllocationSize;
  1857. __le64 EndOfFile; /* size ie offset to first free byte in file */
  1858. __le32 NumberOfLinks; /* hard links */
  1859. __u8 DeletePending;
  1860. __u8 Directory;
  1861. __u16 Pad2;
  1862. __u64 IndexNumber;
  1863. __le32 EASize;
  1864. __le32 AccessFlags;
  1865. __u64 IndexNumber1;
  1866. __le64 CurrentByteOffset;
  1867. __le32 Mode;
  1868. __le32 AlignmentRequirement;
  1869. __le32 FileNameLength;
  1870. char FileName[1];
  1871. } __attribute__((packed)) FILE_ALL_INFO; /* level 0x107 QPathInfo */
  1872. /* defines for enumerating possible values of the Unix type field below */
  1873. #define UNIX_FILE 0
  1874. #define UNIX_DIR 1
  1875. #define UNIX_SYMLINK 2
  1876. #define UNIX_CHARDEV 3
  1877. #define UNIX_BLOCKDEV 4
  1878. #define UNIX_FIFO 5
  1879. #define UNIX_SOCKET 6
  1880. typedef struct {
  1881. __le64 EndOfFile;
  1882. __le64 NumOfBytes;
  1883. __le64 LastStatusChange; /*SNIA specs DCE time for the 3 time fields */
  1884. __le64 LastAccessTime;
  1885. __le64 LastModificationTime;
  1886. __le64 Uid;
  1887. __le64 Gid;
  1888. __le32 Type;
  1889. __le64 DevMajor;
  1890. __le64 DevMinor;
  1891. __u64 UniqueId;
  1892. __le64 Permissions;
  1893. __le64 Nlinks;
  1894. } __attribute__((packed)) FILE_UNIX_BASIC_INFO; /* level 0x200 QPathInfo */
  1895. typedef struct {
  1896. char LinkDest[1];
  1897. } __attribute__((packed)) FILE_UNIX_LINK_INFO; /* level 0x201 QPathInfo */
  1898. /* The following three structures are needed only for
  1899. setting time to NT4 and some older servers via
  1900. the primitive DOS time format */
  1901. typedef struct {
  1902. __u16 Day:5;
  1903. __u16 Month:4;
  1904. __u16 Year:7;
  1905. } __attribute__((packed)) SMB_DATE;
  1906. typedef struct {
  1907. __u16 TwoSeconds:5;
  1908. __u16 Minutes:6;
  1909. __u16 Hours:5;
  1910. } __attribute__((packed)) SMB_TIME;
  1911. typedef struct {
  1912. __le16 CreationDate; /* SMB Date see above */
  1913. __le16 CreationTime; /* SMB Time */
  1914. __le16 LastAccessDate;
  1915. __le16 LastAccessTime;
  1916. __le16 LastWriteDate;
  1917. __le16 LastWriteTime;
  1918. __le32 DataSize; /* File Size (EOF) */
  1919. __le32 AllocationSize;
  1920. __le16 Attributes; /* verify not u32 */
  1921. __le32 EASize;
  1922. } __attribute__((packed)) FILE_INFO_STANDARD; /* level 1 SetPath/FileInfo */
  1923. typedef struct {
  1924. __le64 CreationTime;
  1925. __le64 LastAccessTime;
  1926. __le64 LastWriteTime;
  1927. __le64 ChangeTime;
  1928. __le32 Attributes;
  1929. __u32 Pad;
  1930. } __attribute__((packed)) FILE_BASIC_INFO; /* size info, level 0x101 */
  1931. struct file_allocation_info {
  1932. __le64 AllocationSize; /* Note old Samba srvr rounds this up too much */
  1933. } __attribute__((packed)); /* size used on disk, for level 0x103 for set,
  1934. 0x105 for query */
  1935. struct file_end_of_file_info {
  1936. __le64 FileSize; /* offset to end of file */
  1937. } __attribute__((packed)); /* size info, level 0x104 for set, 0x106 for query */
  1938. struct file_alt_name_info {
  1939. __u8 alt_name[1];
  1940. } __attribute__((packed)); /* level 0x0108 */
  1941. struct file_stream_info {
  1942. __le32 number_of_streams; /* BB check sizes and verify location */
  1943. /* followed by info on streams themselves
  1944. u64 size;
  1945. u64 allocation_size
  1946. stream info */
  1947. }; /* level 0x109 */
  1948. struct file_compression_info {
  1949. __le64 compressed_size;
  1950. __le16 format;
  1951. __u8 unit_shift;
  1952. __u8 ch_shift;
  1953. __u8 cl_shift;
  1954. __u8 pad[3];
  1955. } __attribute__((packed)); /* level 0x10b */
  1956. /* POSIX ACL set/query path info structures */
  1957. #define CIFS_ACL_VERSION 1
  1958. struct cifs_posix_ace { /* access control entry (ACE) */
  1959. __u8 cifs_e_tag;
  1960. __u8 cifs_e_perm;
  1961. __le64 cifs_uid; /* or gid */
  1962. } __attribute__((packed));
  1963. struct cifs_posix_acl { /* access conrol list (ACL) */
  1964. __le16 version;
  1965. __le16 access_entry_count; /* access ACL - count of entries */
  1966. __le16 default_entry_count; /* default ACL - count of entries */
  1967. struct cifs_posix_ace ace_array[0];
  1968. /* followed by
  1969. struct cifs_posix_ace default_ace_arraay[] */
  1970. } __attribute__((packed)); /* level 0x204 */
  1971. /* types of access control entries already defined in posix_acl.h */
  1972. /* #define CIFS_POSIX_ACL_USER_OBJ 0x01
  1973. #define CIFS_POSIX_ACL_USER 0x02
  1974. #define CIFS_POSIX_ACL_GROUP_OBJ 0x04
  1975. #define CIFS_POSIX_ACL_GROUP 0x08
  1976. #define CIFS_POSIX_ACL_MASK 0x10
  1977. #define CIFS_POSIX_ACL_OTHER 0x20 */
  1978. /* types of perms */
  1979. /* #define CIFS_POSIX_ACL_EXECUTE 0x01
  1980. #define CIFS_POSIX_ACL_WRITE 0x02
  1981. #define CIFS_POSIX_ACL_READ 0x04 */
  1982. /* end of POSIX ACL definitions */
  1983. /* POSIX Open Flags */
  1984. #define SMB_O_RDONLY 0x1
  1985. #define SMB_O_WRONLY 0x2
  1986. #define SMB_O_RDWR 0x4
  1987. #define SMB_O_CREAT 0x10
  1988. #define SMB_O_EXCL 0x20
  1989. #define SMB_O_TRUNC 0x40
  1990. #define SMB_O_APPEND 0x80
  1991. #define SMB_O_SYNC 0x100
  1992. #define SMB_O_DIRECTORY 0x200
  1993. #define SMB_O_NOFOLLOW 0x400
  1994. #define SMB_O_DIRECT 0x800
  1995. typedef struct {
  1996. __le32 OpenFlags; /* same as NT CreateX */
  1997. __le32 PosixOpenFlags;
  1998. __le64 Permissions;
  1999. __le16 Level; /* reply level requested (see QPathInfo levels) */
  2000. } __attribute__((packed)) OPEN_PSX_REQ; /* level 0x209 SetPathInfo data */
  2001. typedef struct {
  2002. __le16 OplockFlags;
  2003. __u16 Fid;
  2004. __le32 CreateAction;
  2005. __le16 ReturnedLevel;
  2006. __le16 Pad;
  2007. /* struct following varies based on requested level */
  2008. } __attribute__((packed)) OPEN_PSX_RSP; /* level 0x209 SetPathInfo data */
  2009. #define SMB_POSIX_UNLINK_FILE_TARGET 0
  2010. #define SMB_POSIX_UNLINK_DIRECTORY_TARGET 1
  2011. struct unlink_psx_rq { /* level 0x20a SetPathInfo */
  2012. __le16 type;
  2013. } __attribute__((packed));
  2014. struct file_internal_info {
  2015. __u64 UniqueId; /* inode number */
  2016. } __attribute__((packed)); /* level 0x3ee */
  2017. struct file_mode_info {
  2018. __le32 Mode;
  2019. } __attribute__((packed)); /* level 0x3f8 */
  2020. struct file_attrib_tag {
  2021. __le32 Attribute;
  2022. __le32 ReparseTag;
  2023. } __attribute__((packed)); /* level 0x40b */
  2024. /********************************************************/
  2025. /* FindFirst/FindNext transact2 data buffer formats */
  2026. /********************************************************/
  2027. typedef struct {
  2028. __le32 NextEntryOffset;
  2029. __u32 ResumeKey; /* as with FileIndex - no need to convert */
  2030. __le64 EndOfFile;
  2031. __le64 NumOfBytes;
  2032. __le64 LastStatusChange; /*SNIA specs DCE time for the 3 time fields */
  2033. __le64 LastAccessTime;
  2034. __le64 LastModificationTime;
  2035. __le64 Uid;
  2036. __le64 Gid;
  2037. __le32 Type;
  2038. __le64 DevMajor;
  2039. __le64 DevMinor;
  2040. __u64 UniqueId;
  2041. __le64 Permissions;
  2042. __le64 Nlinks;
  2043. char FileName[1];
  2044. } __attribute__((packed)) FILE_UNIX_INFO; /* level 0x202 */
  2045. typedef struct {
  2046. __le32 NextEntryOffset;
  2047. __u32 FileIndex;
  2048. __le64 CreationTime;
  2049. __le64 LastAccessTime;
  2050. __le64 LastWriteTime;
  2051. __le64 ChangeTime;
  2052. __le64 EndOfFile;
  2053. __le64 AllocationSize;
  2054. __le32 ExtFileAttributes;
  2055. __le32 FileNameLength;
  2056. char FileName[1];
  2057. } __attribute__((packed)) FILE_DIRECTORY_INFO; /* level 0x101 FF resp data */
  2058. typedef struct {
  2059. __le32 NextEntryOffset;
  2060. __u32 FileIndex;
  2061. __le64 CreationTime;
  2062. __le64 LastAccessTime;
  2063. __le64 LastWriteTime;
  2064. __le64 ChangeTime;
  2065. __le64 EndOfFile;
  2066. __le64 AllocationSize;
  2067. __le32 ExtFileAttributes;
  2068. __le32 FileNameLength;
  2069. __le32 EaSize; /* length of the xattrs */
  2070. char FileName[1];
  2071. } __attribute__((packed)) FILE_FULL_DIRECTORY_INFO; /* level 0x102 rsp data */
  2072. typedef struct {
  2073. __le32 NextEntryOffset;
  2074. __u32 FileIndex;
  2075. __le64 CreationTime;
  2076. __le64 LastAccessTime;
  2077. __le64 LastWriteTime;
  2078. __le64 ChangeTime;
  2079. __le64 EndOfFile;
  2080. __le64 AllocationSize;
  2081. __le32 ExtFileAttributes;
  2082. __le32 FileNameLength;
  2083. __le32 EaSize; /* EA size */
  2084. __le32 Reserved;
  2085. __u64 UniqueId; /* inode num - le since Samba puts ino in low 32 bit*/
  2086. char FileName[1];
  2087. } __attribute__((packed)) SEARCH_ID_FULL_DIR_INFO; /* level 0x105 FF rsp data */
  2088. typedef struct {
  2089. __le32 NextEntryOffset;
  2090. __u32 FileIndex;
  2091. __le64 CreationTime;
  2092. __le64 LastAccessTime;
  2093. __le64 LastWriteTime;
  2094. __le64 ChangeTime;
  2095. __le64 EndOfFile;
  2096. __le64 AllocationSize;
  2097. __le32 ExtFileAttributes;
  2098. __le32 FileNameLength;
  2099. __le32 EaSize; /* length of the xattrs */
  2100. __u8 ShortNameLength;
  2101. __u8 Reserved;
  2102. __u8 ShortName[12];
  2103. char FileName[1];
  2104. } __attribute__((packed)) FILE_BOTH_DIRECTORY_INFO; /* level 0x104 FFrsp data */
  2105. typedef struct {
  2106. __u32 ResumeKey;
  2107. __le16 CreationDate; /* SMB Date */
  2108. __le16 CreationTime; /* SMB Time */
  2109. __le16 LastAccessDate;
  2110. __le16 LastAccessTime;
  2111. __le16 LastWriteDate;
  2112. __le16 LastWriteTime;
  2113. __le32 DataSize; /* File Size (EOF) */
  2114. __le32 AllocationSize;
  2115. __le16 Attributes; /* verify not u32 */
  2116. __u8 FileNameLength;
  2117. char FileName[1];
  2118. } __attribute__((packed)) FIND_FILE_STANDARD_INFO; /* level 0x1 FF resp data */
  2119. struct win_dev {
  2120. unsigned char type[8]; /* IntxCHR or IntxBLK */
  2121. __le64 major;
  2122. __le64 minor;
  2123. } __attribute__((packed));
  2124. struct gea {
  2125. unsigned char name_len;
  2126. char name[1];
  2127. } __attribute__((packed));
  2128. struct gealist {
  2129. unsigned long list_len;
  2130. struct gea list[1];
  2131. } __attribute__((packed));
  2132. struct fea {
  2133. unsigned char EA_flags;
  2134. __u8 name_len;
  2135. __le16 value_len;
  2136. char name[1];
  2137. /* optionally followed by value */
  2138. } __attribute__((packed));
  2139. /* flags for _FEA.fEA */
  2140. #define FEA_NEEDEA 0x80 /* need EA bit */
  2141. struct fealist {
  2142. __le32 list_len;
  2143. struct fea list[1];
  2144. } __attribute__((packed));
  2145. /* used to hold an arbitrary blob of data */
  2146. struct data_blob {
  2147. __u8 *data;
  2148. size_t length;
  2149. void (*free) (struct data_blob *data_blob);
  2150. } __attribute__((packed));
  2151. #ifdef CONFIG_CIFS_POSIX
  2152. /*
  2153. For better POSIX semantics from Linux client, (even better
  2154. than the existing CIFS Unix Extensions) we need updated PDUs for:
  2155. 1) PosixCreateX - to set and return the mode, inode#, device info and
  2156. perhaps add a CreateDevice - to create Pipes and other special .inodes
  2157. Also note POSIX open flags
  2158. 2) Close - to return the last write time to do cache across close
  2159. more safely
  2160. 3) FindFirst return unique inode number - what about resume key, two
  2161. forms short (matches readdir) and full (enough info to cache inodes)
  2162. 4) Mkdir - set mode
  2163. And under consideration:
  2164. 5) FindClose2 (return nanosecond timestamp ??)
  2165. 6) Use nanosecond timestamps throughout all time fields if
  2166. corresponding attribute flag is set
  2167. 7) sendfile - handle based copy
  2168. 8) Direct i/o
  2169. 9) Misc fcntls?
  2170. what about fixing 64 bit alignment
  2171. There are also various legacy SMB/CIFS requests used as is
  2172. From existing Lanman and NTLM dialects:
  2173. --------------------------------------
  2174. NEGOTIATE
  2175. SESSION_SETUP_ANDX (BB which?)
  2176. TREE_CONNECT_ANDX (BB which wct?)
  2177. TREE_DISCONNECT (BB add volume timestamp on response)
  2178. LOGOFF_ANDX
  2179. DELETE (note delete open file behavior)
  2180. DELETE_DIRECTORY
  2181. READ_AND_X
  2182. WRITE_AND_X
  2183. LOCKING_AND_X (note posix lock semantics)
  2184. RENAME (note rename across dirs and open file rename posix behaviors)
  2185. NT_RENAME (for hardlinks) Is this good enough for all features?
  2186. FIND_CLOSE2
  2187. TRANSACTION2 (18 cases)
  2188. SMB_SET_FILE_END_OF_FILE_INFO2 SMB_SET_PATH_END_OF_FILE_INFO2
  2189. (BB verify that never need to set allocation size)
  2190. SMB_SET_FILE_BASIC_INFO2 (setting times - BB can it be done via
  2191. Unix ext?)
  2192. COPY (note support for copy across directories) - FUTURE, OPTIONAL
  2193. setting/getting OS/2 EAs - FUTURE (BB can this handle
  2194. setting Linux xattrs perfectly) - OPTIONAL
  2195. dnotify - FUTURE, OPTIONAL
  2196. quota - FUTURE, OPTIONAL
  2197. Note that various requests implemented for NT interop such as
  2198. NT_TRANSACT (IOCTL) QueryReparseInfo
  2199. are unneeded to servers compliant with the CIFS POSIX extensions
  2200. From CIFS Unix Extensions:
  2201. -------------------------
  2202. T2 SET_PATH_INFO (SMB_SET_FILE_UNIX_LINK) for symlinks
  2203. T2 SET_PATH_INFO (SMB_SET_FILE_BASIC_INFO2)
  2204. T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_LINK)
  2205. T2 QUERY_PATH_INFO (SMB_QUERY_FILE_UNIX_BASIC) BB check for missing
  2206. inode fields
  2207. Actually a need QUERY_FILE_UNIX_INFO
  2208. since has inode num
  2209. BB what about a) blksize/blkbits/blocks
  2210. b) i_version
  2211. c) i_rdev
  2212. d) notify mask?
  2213. e) generation
  2214. f) size_seqcount
  2215. T2 FIND_FIRST/FIND_NEXT FIND_FILE_UNIX
  2216. TRANS2_GET_DFS_REFERRAL - OPTIONAL but recommended
  2217. T2_QFS_INFO QueryDevice/AttributeInfo - OPTIONAL
  2218. */
  2219. /* xsymlink is a symlink format (used by MacOS) that can be used
  2220. to save symlink info in a regular file when
  2221. mounted to operating systems that do not
  2222. support the cifs Unix extensions or EAs (for xattr
  2223. based symlinks). For such a file to be recognized
  2224. as containing symlink data:
  2225. 1) file size must be 1067,
  2226. 2) signature must begin file data,
  2227. 3) length field must be set to ASCII representation
  2228. of a number which is less than or equal to 1024,
  2229. 4) md5 must match that of the path data */
  2230. struct xsymlink {
  2231. /* 1067 bytes */
  2232. char signature[4]; /* XSym */ /* not null terminated */
  2233. char cr0; /* \n */
  2234. /* ASCII representation of length (4 bytes decimal) terminated by \n not null */
  2235. char length[4];
  2236. char cr1; /* \n */
  2237. /* md5 of valid subset of path ie path[0] through path[length-1] */
  2238. __u8 md5[32];
  2239. char cr2; /* \n */
  2240. /* if room left, then end with \n then 0x20s by convention but not required */
  2241. char path[1024];
  2242. } __attribute__((packed));
  2243. typedef struct file_xattr_info {
  2244. /* BB do we need another field for flags? BB */
  2245. __u32 xattr_name_len;
  2246. __u32 xattr_value_len;
  2247. char xattr_name[0];
  2248. /* followed by xattr_value[xattr_value_len], no pad */
  2249. } __attribute__((packed)) FILE_XATTR_INFO; /* extended attribute info
  2250. level 0x205 */
  2251. /* flags for chattr command */
  2252. #define EXT_SECURE_DELETE 0x00000001 /* EXT3_SECRM_FL */
  2253. #define EXT_ENABLE_UNDELETE 0x00000002 /* EXT3_UNRM_FL */
  2254. /* Reserved for compress file 0x4 */
  2255. #define EXT_SYNCHRONOUS 0x00000008 /* EXT3_SYNC_FL */
  2256. #define EXT_IMMUTABLE_FL 0x00000010 /* EXT3_IMMUTABLE_FL */
  2257. #define EXT_OPEN_APPEND_ONLY 0x00000020 /* EXT3_APPEND_FL */
  2258. #define EXT_DO_NOT_BACKUP 0x00000040 /* EXT3_NODUMP_FL */
  2259. #define EXT_NO_UPDATE_ATIME 0x00000080 /* EXT3_NOATIME_FL */
  2260. /* 0x100 through 0x800 reserved for compression flags and are GET-ONLY */
  2261. #define EXT_HASH_TREE_INDEXED_DIR 0x00001000 /* GET-ONLY EXT3_INDEX_FL */
  2262. /* 0x2000 reserved for IMAGIC_FL */
  2263. #define EXT_JOURNAL_THIS_FILE 0x00004000 /* GET-ONLY EXT3_JOURNAL_DATA_FL */
  2264. /* 0x8000 reserved for EXT3_NOTAIL_FL */
  2265. #define EXT_SYNCHRONOUS_DIR 0x00010000 /* EXT3_DIRSYNC_FL */
  2266. #define EXT_TOPDIR 0x00020000 /* EXT3_TOPDIR_FL */
  2267. #define EXT_SET_MASK 0x000300FF
  2268. #define EXT_GET_MASK 0x0003DFFF
  2269. typedef struct file_chattr_info {
  2270. __le64 mask; /* list of all possible attribute bits */
  2271. __le64 mode; /* list of actual attribute bits on this inode */
  2272. } __attribute__((packed)) FILE_CHATTR_INFO; /* ext attributes
  2273. (chattr, chflags) level 0x206 */
  2274. #endif
  2275. #endif /* _CIFSPDU_H */