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