shfl_hostintf.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901
  1. /* SPDX-License-Identifier: MIT */
  2. /*
  3. * VirtualBox Shared Folders: host interface definition.
  4. *
  5. * Copyright (C) 2006-2018 Oracle Corporation
  6. */
  7. #ifndef SHFL_HOSTINTF_H
  8. #define SHFL_HOSTINTF_H
  9. #include <linux/vbox_vmmdev_types.h>
  10. /* The max in/out buffer size for a FN_READ or FN_WRITE call */
  11. #define SHFL_MAX_RW_COUNT (16 * SZ_1M)
  12. /*
  13. * Structures shared between guest and the service
  14. * can be relocated and use offsets to point to variable
  15. * length parts.
  16. *
  17. * Shared folders protocol works with handles.
  18. * Before doing any action on a file system object,
  19. * one have to obtain the object handle via a SHFL_FN_CREATE
  20. * request. A handle must be closed with SHFL_FN_CLOSE.
  21. */
  22. enum {
  23. SHFL_FN_QUERY_MAPPINGS = 1, /* Query mappings changes. */
  24. SHFL_FN_QUERY_MAP_NAME = 2, /* Query map name. */
  25. SHFL_FN_CREATE = 3, /* Open/create object. */
  26. SHFL_FN_CLOSE = 4, /* Close object handle. */
  27. SHFL_FN_READ = 5, /* Read object content. */
  28. SHFL_FN_WRITE = 6, /* Write new object content. */
  29. SHFL_FN_LOCK = 7, /* Lock/unlock a range in the object. */
  30. SHFL_FN_LIST = 8, /* List object content. */
  31. SHFL_FN_INFORMATION = 9, /* Query/set object information. */
  32. /* Note function number 10 is not used! */
  33. SHFL_FN_REMOVE = 11, /* Remove object */
  34. SHFL_FN_MAP_FOLDER_OLD = 12, /* Map folder (legacy) */
  35. SHFL_FN_UNMAP_FOLDER = 13, /* Unmap folder */
  36. SHFL_FN_RENAME = 14, /* Rename object */
  37. SHFL_FN_FLUSH = 15, /* Flush file */
  38. SHFL_FN_SET_UTF8 = 16, /* Select UTF8 filename encoding */
  39. SHFL_FN_MAP_FOLDER = 17, /* Map folder */
  40. SHFL_FN_READLINK = 18, /* Read symlink dest (as of VBox 4.0) */
  41. SHFL_FN_SYMLINK = 19, /* Create symlink (as of VBox 4.0) */
  42. SHFL_FN_SET_SYMLINKS = 20, /* Ask host to show symlinks (4.0+) */
  43. };
  44. /* Root handles for a mapping are of type u32, Root handles are unique. */
  45. #define SHFL_ROOT_NIL UINT_MAX
  46. /* Shared folders handle for an opened object are of type u64. */
  47. #define SHFL_HANDLE_NIL ULLONG_MAX
  48. /* Hardcoded maximum length (in chars) of a shared folder name. */
  49. #define SHFL_MAX_LEN (256)
  50. /* Hardcoded maximum number of shared folder mapping available to the guest. */
  51. #define SHFL_MAX_MAPPINGS (64)
  52. /** Shared folder string buffer structure. */
  53. struct shfl_string {
  54. /** Allocated size of the string member in bytes. */
  55. u16 size;
  56. /** Length of string without trailing nul in bytes. */
  57. u16 length;
  58. /** UTF-8 or UTF-16 string. Nul terminated. */
  59. union {
  60. u8 utf8[2];
  61. u16 utf16[1];
  62. u16 ucs2[1]; /* misnomer, use utf16. */
  63. } string;
  64. };
  65. VMMDEV_ASSERT_SIZE(shfl_string, 6);
  66. /* The size of shfl_string w/o the string part. */
  67. #define SHFLSTRING_HEADER_SIZE 4
  68. /* Calculate size of the string. */
  69. static inline u32 shfl_string_buf_size(const struct shfl_string *string)
  70. {
  71. return string ? SHFLSTRING_HEADER_SIZE + string->size : 0;
  72. }
  73. /* Set user id on execution (S_ISUID). */
  74. #define SHFL_UNIX_ISUID 0004000U
  75. /* Set group id on execution (S_ISGID). */
  76. #define SHFL_UNIX_ISGID 0002000U
  77. /* Sticky bit (S_ISVTX / S_ISTXT). */
  78. #define SHFL_UNIX_ISTXT 0001000U
  79. /* Owner readable (S_IRUSR). */
  80. #define SHFL_UNIX_IRUSR 0000400U
  81. /* Owner writable (S_IWUSR). */
  82. #define SHFL_UNIX_IWUSR 0000200U
  83. /* Owner executable (S_IXUSR). */
  84. #define SHFL_UNIX_IXUSR 0000100U
  85. /* Group readable (S_IRGRP). */
  86. #define SHFL_UNIX_IRGRP 0000040U
  87. /* Group writable (S_IWGRP). */
  88. #define SHFL_UNIX_IWGRP 0000020U
  89. /* Group executable (S_IXGRP). */
  90. #define SHFL_UNIX_IXGRP 0000010U
  91. /* Other readable (S_IROTH). */
  92. #define SHFL_UNIX_IROTH 0000004U
  93. /* Other writable (S_IWOTH). */
  94. #define SHFL_UNIX_IWOTH 0000002U
  95. /* Other executable (S_IXOTH). */
  96. #define SHFL_UNIX_IXOTH 0000001U
  97. /* Named pipe (fifo) (S_IFIFO). */
  98. #define SHFL_TYPE_FIFO 0010000U
  99. /* Character device (S_IFCHR). */
  100. #define SHFL_TYPE_DEV_CHAR 0020000U
  101. /* Directory (S_IFDIR). */
  102. #define SHFL_TYPE_DIRECTORY 0040000U
  103. /* Block device (S_IFBLK). */
  104. #define SHFL_TYPE_DEV_BLOCK 0060000U
  105. /* Regular file (S_IFREG). */
  106. #define SHFL_TYPE_FILE 0100000U
  107. /* Symbolic link (S_IFLNK). */
  108. #define SHFL_TYPE_SYMLINK 0120000U
  109. /* Socket (S_IFSOCK). */
  110. #define SHFL_TYPE_SOCKET 0140000U
  111. /* Whiteout (S_IFWHT). */
  112. #define SHFL_TYPE_WHITEOUT 0160000U
  113. /* Type mask (S_IFMT). */
  114. #define SHFL_TYPE_MASK 0170000U
  115. /* Checks the mode flags indicate a directory (S_ISDIR). */
  116. #define SHFL_IS_DIRECTORY(m) (((m) & SHFL_TYPE_MASK) == SHFL_TYPE_DIRECTORY)
  117. /* Checks the mode flags indicate a symbolic link (S_ISLNK). */
  118. #define SHFL_IS_SYMLINK(m) (((m) & SHFL_TYPE_MASK) == SHFL_TYPE_SYMLINK)
  119. /** The available additional information in a shfl_fsobjattr object. */
  120. enum shfl_fsobjattr_add {
  121. /** No additional information is available / requested. */
  122. SHFLFSOBJATTRADD_NOTHING = 1,
  123. /**
  124. * The additional unix attributes (shfl_fsobjattr::u::unix_attr) are
  125. * available / requested.
  126. */
  127. SHFLFSOBJATTRADD_UNIX,
  128. /**
  129. * The additional extended attribute size (shfl_fsobjattr::u::size) is
  130. * available / requested.
  131. */
  132. SHFLFSOBJATTRADD_EASIZE,
  133. /**
  134. * The last valid item (inclusive).
  135. * The valid range is SHFLFSOBJATTRADD_NOTHING thru
  136. * SHFLFSOBJATTRADD_LAST.
  137. */
  138. SHFLFSOBJATTRADD_LAST = SHFLFSOBJATTRADD_EASIZE,
  139. /** The usual 32-bit hack. */
  140. SHFLFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
  141. };
  142. /**
  143. * Additional unix Attributes, these are available when
  144. * shfl_fsobjattr.additional == SHFLFSOBJATTRADD_UNIX.
  145. */
  146. struct shfl_fsobjattr_unix {
  147. /**
  148. * The user owning the filesystem object (st_uid).
  149. * This field is ~0U if not supported.
  150. */
  151. u32 uid;
  152. /**
  153. * The group the filesystem object is assigned (st_gid).
  154. * This field is ~0U if not supported.
  155. */
  156. u32 gid;
  157. /**
  158. * Number of hard links to this filesystem object (st_nlink).
  159. * This field is 1 if the filesystem doesn't support hardlinking or
  160. * the information isn't available.
  161. */
  162. u32 hardlinks;
  163. /**
  164. * The device number of the device which this filesystem object resides
  165. * on (st_dev). This field is 0 if this information is not available.
  166. */
  167. u32 inode_id_device;
  168. /**
  169. * The unique identifier (within the filesystem) of this filesystem
  170. * object (st_ino). Together with inode_id_device, this field can be
  171. * used as a OS wide unique id, when both their values are not 0.
  172. * This field is 0 if the information is not available.
  173. */
  174. u64 inode_id;
  175. /**
  176. * User flags (st_flags).
  177. * This field is 0 if this information is not available.
  178. */
  179. u32 flags;
  180. /**
  181. * The current generation number (st_gen).
  182. * This field is 0 if this information is not available.
  183. */
  184. u32 generation_id;
  185. /**
  186. * The device number of a char. or block device type object (st_rdev).
  187. * This field is 0 if the file isn't a char. or block device or when
  188. * the OS doesn't use the major+minor device idenfication scheme.
  189. */
  190. u32 device;
  191. } __packed;
  192. /** Extended attribute size. */
  193. struct shfl_fsobjattr_easize {
  194. /** Size of EAs. */
  195. s64 cb;
  196. } __packed;
  197. /** Shared folder filesystem object attributes. */
  198. struct shfl_fsobjattr {
  199. /** Mode flags (st_mode). SHFL_UNIX_*, SHFL_TYPE_*, and SHFL_DOS_*. */
  200. u32 mode;
  201. /** The additional attributes available. */
  202. enum shfl_fsobjattr_add additional;
  203. /**
  204. * Additional attributes.
  205. *
  206. * Unless explicitly specified to an API, the API can provide additional
  207. * data as it is provided by the underlying OS.
  208. */
  209. union {
  210. struct shfl_fsobjattr_unix unix_attr;
  211. struct shfl_fsobjattr_easize size;
  212. } __packed u;
  213. } __packed;
  214. VMMDEV_ASSERT_SIZE(shfl_fsobjattr, 44);
  215. struct shfl_timespec {
  216. s64 ns_relative_to_unix_epoch;
  217. };
  218. /** Filesystem object information structure. */
  219. struct shfl_fsobjinfo {
  220. /**
  221. * Logical size (st_size).
  222. * For normal files this is the size of the file.
  223. * For symbolic links, this is the length of the path name contained
  224. * in the symbolic link.
  225. * For other objects this fields needs to be specified.
  226. */
  227. s64 size;
  228. /** Disk allocation size (st_blocks * DEV_BSIZE). */
  229. s64 allocated;
  230. /** Time of last access (st_atime). */
  231. struct shfl_timespec access_time;
  232. /** Time of last data modification (st_mtime). */
  233. struct shfl_timespec modification_time;
  234. /**
  235. * Time of last status change (st_ctime).
  236. * If not available this is set to modification_time.
  237. */
  238. struct shfl_timespec change_time;
  239. /**
  240. * Time of file birth (st_birthtime).
  241. * If not available this is set to change_time.
  242. */
  243. struct shfl_timespec birth_time;
  244. /** Attributes. */
  245. struct shfl_fsobjattr attr;
  246. } __packed;
  247. VMMDEV_ASSERT_SIZE(shfl_fsobjinfo, 92);
  248. /**
  249. * result of an open/create request.
  250. * Along with handle value the result code
  251. * identifies what has happened while
  252. * trying to open the object.
  253. */
  254. enum shfl_create_result {
  255. SHFL_NO_RESULT,
  256. /** Specified path does not exist. */
  257. SHFL_PATH_NOT_FOUND,
  258. /** Path to file exists, but the last component does not. */
  259. SHFL_FILE_NOT_FOUND,
  260. /** File already exists and either has been opened or not. */
  261. SHFL_FILE_EXISTS,
  262. /** New file was created. */
  263. SHFL_FILE_CREATED,
  264. /** Existing file was replaced or overwritten. */
  265. SHFL_FILE_REPLACED
  266. };
  267. /* No flags. Initialization value. */
  268. #define SHFL_CF_NONE (0x00000000)
  269. /*
  270. * Only lookup the object, do not return a handle. When this is set all other
  271. * flags are ignored.
  272. */
  273. #define SHFL_CF_LOOKUP (0x00000001)
  274. /*
  275. * Open parent directory of specified object.
  276. * Useful for the corresponding Windows FSD flag
  277. * and for opening paths like \\dir\\*.* to search the 'dir'.
  278. */
  279. #define SHFL_CF_OPEN_TARGET_DIRECTORY (0x00000002)
  280. /* Create/open a directory. */
  281. #define SHFL_CF_DIRECTORY (0x00000004)
  282. /*
  283. * Open/create action to do if object exists
  284. * and if the object does not exists.
  285. * REPLACE file means atomically DELETE and CREATE.
  286. * OVERWRITE file means truncating the file to 0 and
  287. * setting new size.
  288. * When opening an existing directory REPLACE and OVERWRITE
  289. * actions are considered invalid, and cause returning
  290. * FILE_EXISTS with NIL handle.
  291. */
  292. #define SHFL_CF_ACT_MASK_IF_EXISTS (0x000000f0)
  293. #define SHFL_CF_ACT_MASK_IF_NEW (0x00000f00)
  294. /* What to do if object exists. */
  295. #define SHFL_CF_ACT_OPEN_IF_EXISTS (0x00000000)
  296. #define SHFL_CF_ACT_FAIL_IF_EXISTS (0x00000010)
  297. #define SHFL_CF_ACT_REPLACE_IF_EXISTS (0x00000020)
  298. #define SHFL_CF_ACT_OVERWRITE_IF_EXISTS (0x00000030)
  299. /* What to do if object does not exist. */
  300. #define SHFL_CF_ACT_CREATE_IF_NEW (0x00000000)
  301. #define SHFL_CF_ACT_FAIL_IF_NEW (0x00000100)
  302. /* Read/write requested access for the object. */
  303. #define SHFL_CF_ACCESS_MASK_RW (0x00003000)
  304. /* No access requested. */
  305. #define SHFL_CF_ACCESS_NONE (0x00000000)
  306. /* Read access requested. */
  307. #define SHFL_CF_ACCESS_READ (0x00001000)
  308. /* Write access requested. */
  309. #define SHFL_CF_ACCESS_WRITE (0x00002000)
  310. /* Read/Write access requested. */
  311. #define SHFL_CF_ACCESS_READWRITE (0x00003000)
  312. /* Requested share access for the object. */
  313. #define SHFL_CF_ACCESS_MASK_DENY (0x0000c000)
  314. /* Allow any access. */
  315. #define SHFL_CF_ACCESS_DENYNONE (0x00000000)
  316. /* Do not allow read. */
  317. #define SHFL_CF_ACCESS_DENYREAD (0x00004000)
  318. /* Do not allow write. */
  319. #define SHFL_CF_ACCESS_DENYWRITE (0x00008000)
  320. /* Do not allow access. */
  321. #define SHFL_CF_ACCESS_DENYALL (0x0000c000)
  322. /* Requested access to attributes of the object. */
  323. #define SHFL_CF_ACCESS_MASK_ATTR (0x00030000)
  324. /* No access requested. */
  325. #define SHFL_CF_ACCESS_ATTR_NONE (0x00000000)
  326. /* Read access requested. */
  327. #define SHFL_CF_ACCESS_ATTR_READ (0x00010000)
  328. /* Write access requested. */
  329. #define SHFL_CF_ACCESS_ATTR_WRITE (0x00020000)
  330. /* Read/Write access requested. */
  331. #define SHFL_CF_ACCESS_ATTR_READWRITE (0x00030000)
  332. /*
  333. * The file is opened in append mode.
  334. * Ignored if SHFL_CF_ACCESS_WRITE is not set.
  335. */
  336. #define SHFL_CF_ACCESS_APPEND (0x00040000)
  337. /** Create parameters buffer struct for SHFL_FN_CREATE call */
  338. struct shfl_createparms {
  339. /** Returned handle of opened object. */
  340. u64 handle;
  341. /** Returned result of the operation */
  342. enum shfl_create_result result;
  343. /** SHFL_CF_* */
  344. u32 create_flags;
  345. /**
  346. * Attributes of object to create and
  347. * returned actual attributes of opened/created object.
  348. */
  349. struct shfl_fsobjinfo info;
  350. } __packed;
  351. /** Shared Folder directory information */
  352. struct shfl_dirinfo {
  353. /** Full information about the object. */
  354. struct shfl_fsobjinfo info;
  355. /**
  356. * The length of the short field (number of UTF16 chars).
  357. * It is 16-bit for reasons of alignment.
  358. */
  359. u16 short_name_len;
  360. /**
  361. * The short name for 8.3 compatibility.
  362. * Empty string if not available.
  363. */
  364. u16 short_name[14];
  365. struct shfl_string name;
  366. };
  367. /** Shared folder filesystem properties. */
  368. struct shfl_fsproperties {
  369. /**
  370. * The maximum size of a filesystem object name.
  371. * This does not include the '\\0'.
  372. */
  373. u32 max_component_len;
  374. /**
  375. * True if the filesystem is remote.
  376. * False if the filesystem is local.
  377. */
  378. bool remote;
  379. /**
  380. * True if the filesystem is case sensitive.
  381. * False if the filesystem is case insensitive.
  382. */
  383. bool case_sensitive;
  384. /**
  385. * True if the filesystem is mounted read only.
  386. * False if the filesystem is mounted read write.
  387. */
  388. bool read_only;
  389. /**
  390. * True if the filesystem can encode unicode object names.
  391. * False if it can't.
  392. */
  393. bool supports_unicode;
  394. /**
  395. * True if the filesystem is compresses.
  396. * False if it isn't or we don't know.
  397. */
  398. bool compressed;
  399. /**
  400. * True if the filesystem compresses of individual files.
  401. * False if it doesn't or we don't know.
  402. */
  403. bool file_compression;
  404. };
  405. VMMDEV_ASSERT_SIZE(shfl_fsproperties, 12);
  406. struct shfl_volinfo {
  407. s64 total_allocation_bytes;
  408. s64 available_allocation_bytes;
  409. u32 bytes_per_allocation_unit;
  410. u32 bytes_per_sector;
  411. u32 serial;
  412. struct shfl_fsproperties properties;
  413. };
  414. /** SHFL_FN_MAP_FOLDER Parameters structure. */
  415. struct shfl_map_folder {
  416. /**
  417. * pointer, in:
  418. * Points to struct shfl_string buffer.
  419. */
  420. struct vmmdev_hgcm_function_parameter path;
  421. /**
  422. * pointer, out: SHFLROOT (u32)
  423. * Root handle of the mapping which name is queried.
  424. */
  425. struct vmmdev_hgcm_function_parameter root;
  426. /**
  427. * pointer, in: UTF16
  428. * Path delimiter
  429. */
  430. struct vmmdev_hgcm_function_parameter delimiter;
  431. /**
  432. * pointer, in: SHFLROOT (u32)
  433. * Case senstive flag
  434. */
  435. struct vmmdev_hgcm_function_parameter case_sensitive;
  436. };
  437. /* Number of parameters */
  438. #define SHFL_CPARMS_MAP_FOLDER (4)
  439. /** SHFL_FN_UNMAP_FOLDER Parameters structure. */
  440. struct shfl_unmap_folder {
  441. /**
  442. * pointer, in: SHFLROOT (u32)
  443. * Root handle of the mapping which name is queried.
  444. */
  445. struct vmmdev_hgcm_function_parameter root;
  446. };
  447. /* Number of parameters */
  448. #define SHFL_CPARMS_UNMAP_FOLDER (1)
  449. /** SHFL_FN_CREATE Parameters structure. */
  450. struct shfl_create {
  451. /**
  452. * pointer, in: SHFLROOT (u32)
  453. * Root handle of the mapping which name is queried.
  454. */
  455. struct vmmdev_hgcm_function_parameter root;
  456. /**
  457. * pointer, in:
  458. * Points to struct shfl_string buffer.
  459. */
  460. struct vmmdev_hgcm_function_parameter path;
  461. /**
  462. * pointer, in/out:
  463. * Points to struct shfl_createparms buffer.
  464. */
  465. struct vmmdev_hgcm_function_parameter parms;
  466. };
  467. /* Number of parameters */
  468. #define SHFL_CPARMS_CREATE (3)
  469. /** SHFL_FN_CLOSE Parameters structure. */
  470. struct shfl_close {
  471. /**
  472. * pointer, in: SHFLROOT (u32)
  473. * Root handle of the mapping which name is queried.
  474. */
  475. struct vmmdev_hgcm_function_parameter root;
  476. /**
  477. * value64, in:
  478. * SHFLHANDLE (u64) of object to close.
  479. */
  480. struct vmmdev_hgcm_function_parameter handle;
  481. };
  482. /* Number of parameters */
  483. #define SHFL_CPARMS_CLOSE (2)
  484. /** SHFL_FN_READ Parameters structure. */
  485. struct shfl_read {
  486. /**
  487. * pointer, in: SHFLROOT (u32)
  488. * Root handle of the mapping which name is queried.
  489. */
  490. struct vmmdev_hgcm_function_parameter root;
  491. /**
  492. * value64, in:
  493. * SHFLHANDLE (u64) of object to read from.
  494. */
  495. struct vmmdev_hgcm_function_parameter handle;
  496. /**
  497. * value64, in:
  498. * Offset to read from.
  499. */
  500. struct vmmdev_hgcm_function_parameter offset;
  501. /**
  502. * value64, in/out:
  503. * Bytes to read/How many were read.
  504. */
  505. struct vmmdev_hgcm_function_parameter cb;
  506. /**
  507. * pointer, out:
  508. * Buffer to place data to.
  509. */
  510. struct vmmdev_hgcm_function_parameter buffer;
  511. };
  512. /* Number of parameters */
  513. #define SHFL_CPARMS_READ (5)
  514. /** SHFL_FN_WRITE Parameters structure. */
  515. struct shfl_write {
  516. /**
  517. * pointer, in: SHFLROOT (u32)
  518. * Root handle of the mapping which name is queried.
  519. */
  520. struct vmmdev_hgcm_function_parameter root;
  521. /**
  522. * value64, in:
  523. * SHFLHANDLE (u64) of object to write to.
  524. */
  525. struct vmmdev_hgcm_function_parameter handle;
  526. /**
  527. * value64, in:
  528. * Offset to write to.
  529. */
  530. struct vmmdev_hgcm_function_parameter offset;
  531. /**
  532. * value64, in/out:
  533. * Bytes to write/How many were written.
  534. */
  535. struct vmmdev_hgcm_function_parameter cb;
  536. /**
  537. * pointer, in:
  538. * Data to write.
  539. */
  540. struct vmmdev_hgcm_function_parameter buffer;
  541. };
  542. /* Number of parameters */
  543. #define SHFL_CPARMS_WRITE (5)
  544. /*
  545. * SHFL_FN_LIST
  546. * Listing information includes variable length RTDIRENTRY[EX] structures.
  547. */
  548. #define SHFL_LIST_NONE 0
  549. #define SHFL_LIST_RETURN_ONE 1
  550. /** SHFL_FN_LIST Parameters structure. */
  551. struct shfl_list {
  552. /**
  553. * pointer, in: SHFLROOT (u32)
  554. * Root handle of the mapping which name is queried.
  555. */
  556. struct vmmdev_hgcm_function_parameter root;
  557. /**
  558. * value64, in:
  559. * SHFLHANDLE (u64) of object to be listed.
  560. */
  561. struct vmmdev_hgcm_function_parameter handle;
  562. /**
  563. * value32, in:
  564. * List flags SHFL_LIST_*.
  565. */
  566. struct vmmdev_hgcm_function_parameter flags;
  567. /**
  568. * value32, in/out:
  569. * Bytes to be used for listing information/How many bytes were used.
  570. */
  571. struct vmmdev_hgcm_function_parameter cb;
  572. /**
  573. * pointer, in/optional
  574. * Points to struct shfl_string buffer that specifies a search path.
  575. */
  576. struct vmmdev_hgcm_function_parameter path;
  577. /**
  578. * pointer, out:
  579. * Buffer to place listing information to. (struct shfl_dirinfo)
  580. */
  581. struct vmmdev_hgcm_function_parameter buffer;
  582. /**
  583. * value32, in/out:
  584. * Indicates a key where the listing must be resumed.
  585. * in: 0 means start from begin of object.
  586. * out: 0 means listing completed.
  587. */
  588. struct vmmdev_hgcm_function_parameter resume_point;
  589. /**
  590. * pointer, out:
  591. * Number of files returned
  592. */
  593. struct vmmdev_hgcm_function_parameter file_count;
  594. };
  595. /* Number of parameters */
  596. #define SHFL_CPARMS_LIST (8)
  597. /** SHFL_FN_READLINK Parameters structure. */
  598. struct shfl_readLink {
  599. /**
  600. * pointer, in: SHFLROOT (u32)
  601. * Root handle of the mapping which name is queried.
  602. */
  603. struct vmmdev_hgcm_function_parameter root;
  604. /**
  605. * pointer, in:
  606. * Points to struct shfl_string buffer.
  607. */
  608. struct vmmdev_hgcm_function_parameter path;
  609. /**
  610. * pointer, out:
  611. * Buffer to place data to.
  612. */
  613. struct vmmdev_hgcm_function_parameter buffer;
  614. };
  615. /* Number of parameters */
  616. #define SHFL_CPARMS_READLINK (3)
  617. /* SHFL_FN_INFORMATION */
  618. /* Mask of Set/Get bit. */
  619. #define SHFL_INFO_MODE_MASK (0x1)
  620. /* Get information */
  621. #define SHFL_INFO_GET (0x0)
  622. /* Set information */
  623. #define SHFL_INFO_SET (0x1)
  624. /* Get name of the object. */
  625. #define SHFL_INFO_NAME (0x2)
  626. /* Set size of object (extend/trucate); only applies to file objects */
  627. #define SHFL_INFO_SIZE (0x4)
  628. /* Get/Set file object info. */
  629. #define SHFL_INFO_FILE (0x8)
  630. /* Get volume information. */
  631. #define SHFL_INFO_VOLUME (0x10)
  632. /** SHFL_FN_INFORMATION Parameters structure. */
  633. struct shfl_information {
  634. /**
  635. * pointer, in: SHFLROOT (u32)
  636. * Root handle of the mapping which name is queried.
  637. */
  638. struct vmmdev_hgcm_function_parameter root;
  639. /**
  640. * value64, in:
  641. * SHFLHANDLE (u64) of object to be listed.
  642. */
  643. struct vmmdev_hgcm_function_parameter handle;
  644. /**
  645. * value32, in:
  646. * SHFL_INFO_*
  647. */
  648. struct vmmdev_hgcm_function_parameter flags;
  649. /**
  650. * value32, in/out:
  651. * Bytes to be used for information/How many bytes were used.
  652. */
  653. struct vmmdev_hgcm_function_parameter cb;
  654. /**
  655. * pointer, in/out:
  656. * Information to be set/get (shfl_fsobjinfo or shfl_string). Do not
  657. * forget to set the shfl_fsobjinfo::attr::additional for a get
  658. * operation as well.
  659. */
  660. struct vmmdev_hgcm_function_parameter info;
  661. };
  662. /* Number of parameters */
  663. #define SHFL_CPARMS_INFORMATION (5)
  664. /* SHFL_FN_REMOVE */
  665. #define SHFL_REMOVE_FILE (0x1)
  666. #define SHFL_REMOVE_DIR (0x2)
  667. #define SHFL_REMOVE_SYMLINK (0x4)
  668. /** SHFL_FN_REMOVE Parameters structure. */
  669. struct shfl_remove {
  670. /**
  671. * pointer, in: SHFLROOT (u32)
  672. * Root handle of the mapping which name is queried.
  673. */
  674. struct vmmdev_hgcm_function_parameter root;
  675. /**
  676. * pointer, in:
  677. * Points to struct shfl_string buffer.
  678. */
  679. struct vmmdev_hgcm_function_parameter path;
  680. /**
  681. * value32, in:
  682. * remove flags (file/directory)
  683. */
  684. struct vmmdev_hgcm_function_parameter flags;
  685. };
  686. #define SHFL_CPARMS_REMOVE (3)
  687. /* SHFL_FN_RENAME */
  688. #define SHFL_RENAME_FILE (0x1)
  689. #define SHFL_RENAME_DIR (0x2)
  690. #define SHFL_RENAME_REPLACE_IF_EXISTS (0x4)
  691. /** SHFL_FN_RENAME Parameters structure. */
  692. struct shfl_rename {
  693. /**
  694. * pointer, in: SHFLROOT (u32)
  695. * Root handle of the mapping which name is queried.
  696. */
  697. struct vmmdev_hgcm_function_parameter root;
  698. /**
  699. * pointer, in:
  700. * Points to struct shfl_string src.
  701. */
  702. struct vmmdev_hgcm_function_parameter src;
  703. /**
  704. * pointer, in:
  705. * Points to struct shfl_string dest.
  706. */
  707. struct vmmdev_hgcm_function_parameter dest;
  708. /**
  709. * value32, in:
  710. * rename flags (file/directory)
  711. */
  712. struct vmmdev_hgcm_function_parameter flags;
  713. };
  714. #define SHFL_CPARMS_RENAME (4)
  715. /** SHFL_FN_SYMLINK Parameters structure. */
  716. struct shfl_symlink {
  717. /**
  718. * pointer, in: SHFLROOT (u32)
  719. * Root handle of the mapping which name is queried.
  720. */
  721. struct vmmdev_hgcm_function_parameter root;
  722. /**
  723. * pointer, in:
  724. * Points to struct shfl_string of path for the new symlink.
  725. */
  726. struct vmmdev_hgcm_function_parameter new_path;
  727. /**
  728. * pointer, in:
  729. * Points to struct shfl_string of destination for symlink.
  730. */
  731. struct vmmdev_hgcm_function_parameter old_path;
  732. /**
  733. * pointer, out:
  734. * Information about created symlink.
  735. */
  736. struct vmmdev_hgcm_function_parameter info;
  737. };
  738. #define SHFL_CPARMS_SYMLINK (4)
  739. #endif