/* The max in/out buffer size for a FN_READ or FN_WRITE call */ #define SHFL_MAX_RW_COUNT (16 * SZ_1M)
/* * Structures shared between guest and the service * can be relocated and use offsets to point to variable * length parts. * * Shared folders protocol works with handles. * Before doing any action on a file system object, * one have to obtain the object handle via a SHFL_FN_CREATE * request. A handle must be closed with SHFL_FN_CLOSE.
*/
/* Root handles for a mapping are of type u32, Root handles are unique. */ #define SHFL_ROOT_NIL UINT_MAX
/* Shared folders handle for an opened object are of type u64. */ #define SHFL_HANDLE_NIL ULLONG_MAX
/* Hardcoded maximum length (in chars) of a shared folder name. */ #define SHFL_MAX_LEN (256) /* Hardcoded maximum number of shared folder mapping available to the guest. */ #define SHFL_MAX_MAPPINGS (64)
/** Shared folder string buffer structure. */ struct shfl_string { /** Allocated size of the string member in bytes. */
u16 size;
/** Length of string without trailing nul in bytes. */
u16 length;
/* Set user id on execution (S_ISUID). */ #define SHFL_UNIX_ISUID 0004000U /* Set group id on execution (S_ISGID). */ #define SHFL_UNIX_ISGID 0002000U /* Sticky bit (S_ISVTX / S_ISTXT). */ #define SHFL_UNIX_ISTXT 0001000U
/* Checks the mode flags indicate a directory (S_ISDIR). */ #define SHFL_IS_DIRECTORY(m) (((m) & SHFL_TYPE_MASK) == SHFL_TYPE_DIRECTORY) /* Checks the mode flags indicate a symbolic link (S_ISLNK). */ #define SHFL_IS_SYMLINK(m) (((m) & SHFL_TYPE_MASK) == SHFL_TYPE_SYMLINK)
/** The available additional information in a shfl_fsobjattr object. */ enum shfl_fsobjattr_add { /** No additional information is available / requested. */
SHFLFSOBJATTRADD_NOTHING = 1, /** * The additional unix attributes (shfl_fsobjattr::u::unix_attr) are * available / requested.
*/
SHFLFSOBJATTRADD_UNIX, /** * The additional extended attribute size (shfl_fsobjattr::u::size) is * available / requested.
*/
SHFLFSOBJATTRADD_EASIZE, /** * The last valid item (inclusive). * The valid range is SHFLFSOBJATTRADD_NOTHING thru * SHFLFSOBJATTRADD_LAST.
*/
SHFLFSOBJATTRADD_LAST = SHFLFSOBJATTRADD_EASIZE,
/** The usual 32-bit hack. */
SHFLFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
};
/** * Additional unix Attributes, these are available when * shfl_fsobjattr.additional == SHFLFSOBJATTRADD_UNIX.
*/ struct shfl_fsobjattr_unix { /** * The user owning the filesystem object (st_uid). * This field is ~0U if not supported.
*/
u32 uid;
/** * The group the filesystem object is assigned (st_gid). * This field is ~0U if not supported.
*/
u32 gid;
/** * Number of hard links to this filesystem object (st_nlink). * This field is 1 if the filesystem doesn't support hardlinking or * the information isn't available.
*/
u32 hardlinks;
/** * The device number of the device which this filesystem object resides * on (st_dev). This field is 0 if this information is not available.
*/
u32 inode_id_device;
/** * The unique identifier (within the filesystem) of this filesystem * object (st_ino). Together with inode_id_device, this field can be * used as a OS wide unique id, when both their values are not 0. * This field is 0 if the information is not available.
*/
u64 inode_id;
/** * User flags (st_flags). * This field is 0 if this information is not available.
*/
u32 flags;
/** * The current generation number (st_gen). * This field is 0 if this information is not available.
*/
u32 generation_id;
/** * The device number of a char. or block device type object (st_rdev). * This field is 0 if the file isn't a char. or block device or when * the OS doesn't use the major+minor device idenfication scheme.
*/
u32 device;
} __packed;
/** The additional attributes available. */ enum shfl_fsobjattr_add additional;
/** * Additional attributes. * * Unless explicitly specified to an API, the API can provide additional * data as it is provided by the underlying OS.
*/ union { struct shfl_fsobjattr_unix unix_attr; struct shfl_fsobjattr_easize size;
} __packed u;
} __packed;
VMMDEV_ASSERT_SIZE(shfl_fsobjattr, 44);
/** Filesystem object information structure. */ struct shfl_fsobjinfo { /** * Logical size (st_size). * For normal files this is the size of the file. * For symbolic links, this is the length of the path name contained * in the symbolic link. * For other objects this fields needs to be specified.
*/
s64 size;
/** Disk allocation size (st_blocks * DEV_BSIZE). */
s64 allocated;
/** Time of last access (st_atime). */ struct shfl_timespec access_time;
/** Time of last data modification (st_mtime). */ struct shfl_timespec modification_time;
/** * Time of last status change (st_ctime). * If not available this is set to modification_time.
*/ struct shfl_timespec change_time;
/** * Time of file birth (st_birthtime). * If not available this is set to change_time.
*/ struct shfl_timespec birth_time;
/** * result of an open/create request. * Along with handle value the result code * identifies what has happened while * trying to open the object.
*/ enum shfl_create_result {
SHFL_NO_RESULT, /** Specified path does not exist. */
SHFL_PATH_NOT_FOUND, /** Path to file exists, but the last component does not. */
SHFL_FILE_NOT_FOUND, /** File already exists and either has been opened or not. */
SHFL_FILE_EXISTS, /** New file was created. */
SHFL_FILE_CREATED, /** Existing file was replaced or overwritten. */
SHFL_FILE_REPLACED
};
/* No flags. Initialization value. */ #define SHFL_CF_NONE (0x00000000)
/* * Only lookup the object, do not return a handle. When this is set all other * flags are ignored.
*/ #define SHFL_CF_LOOKUP (0x00000001)
/* * Open parent directory of specified object. * Useful for the corresponding Windows FSD flag * and for opening paths like \\dir\\*.* to search the 'dir'.
*/ #define SHFL_CF_OPEN_TARGET_DIRECTORY (0x00000002)
/* Create/open a directory. */ #define SHFL_CF_DIRECTORY (0x00000004)
/* * Open/create action to do if object exists * and if the object does not exists. * REPLACE file means atomically DELETE and CREATE. * OVERWRITE file means truncating the file to 0 and * setting new size. * When opening an existing directory REPLACE and OVERWRITE * actions are considered invalid, and cause returning * FILE_EXISTS with NIL handle.
*/ #define SHFL_CF_ACT_MASK_IF_EXISTS (0x000000f0) #define SHFL_CF_ACT_MASK_IF_NEW (0x00000f00)
/* What to do if object exists. */ #define SHFL_CF_ACT_OPEN_IF_EXISTS (0x00000000) #define SHFL_CF_ACT_FAIL_IF_EXISTS (0x00000010) #define SHFL_CF_ACT_REPLACE_IF_EXISTS (0x00000020) #define SHFL_CF_ACT_OVERWRITE_IF_EXISTS (0x00000030)
/* What to do if object does not exist. */ #define SHFL_CF_ACT_CREATE_IF_NEW (0x00000000) #define SHFL_CF_ACT_FAIL_IF_NEW (0x00000100)
/* Read/write requested access for the object. */ #define SHFL_CF_ACCESS_MASK_RW (0x00003000)
/* Requested share access for the object. */ #define SHFL_CF_ACCESS_MASK_DENY (0x0000c000)
/* Allow any access. */ #define SHFL_CF_ACCESS_DENYNONE (0x00000000) /* Do not allow read. */ #define SHFL_CF_ACCESS_DENYREAD (0x00004000) /* Do not allow write. */ #define SHFL_CF_ACCESS_DENYWRITE (0x00008000) /* Do not allow access. */ #define SHFL_CF_ACCESS_DENYALL (0x0000c000)
/* Requested access to attributes of the object. */ #define SHFL_CF_ACCESS_MASK_ATTR (0x00030000)
/* * The file is opened in append mode. * Ignored if SHFL_CF_ACCESS_WRITE is not set.
*/ #define SHFL_CF_ACCESS_APPEND (0x00040000)
/** Create parameters buffer struct for SHFL_FN_CREATE call */ struct shfl_createparms { /** Returned handle of opened object. */
u64 handle;
/** Returned result of the operation */ enum shfl_create_result result;
/** SHFL_CF_* */
u32 create_flags;
/** * Attributes of object to create and * returned actual attributes of opened/created object.
*/ struct shfl_fsobjinfo info;
} __packed;
/** Shared Folder directory information */ struct shfl_dirinfo { /** Full information about the object. */ struct shfl_fsobjinfo info; /** * The length of the short field (number of UTF16 chars). * It is 16-bit for reasons of alignment.
*/
u16 short_name_len; /** * The short name for 8.3 compatibility. * Empty string if not available.
*/
u16 short_name[14]; struct shfl_string name;
};
/** Shared folder filesystem properties. */ struct shfl_fsproperties { /** * The maximum size of a filesystem object name. * This does not include the '\\0'.
*/
u32 max_component_len;
/** * True if the filesystem is remote. * False if the filesystem is local.
*/ bool remote;
/** * True if the filesystem is case sensitive. * False if the filesystem is case insensitive.
*/ bool case_sensitive;
/** * True if the filesystem is mounted read only. * False if the filesystem is mounted read write.
*/ bool read_only;
/** * True if the filesystem can encode unicode object names. * False if it can't.
*/ bool supports_unicode;
/** * True if the filesystem is compresses. * False if it isn't or we don't know.
*/ bool compressed;
/** * True if the filesystem compresses of individual files. * False if it doesn't or we don't know.
*/ bool file_compression;
};
VMMDEV_ASSERT_SIZE(shfl_fsproperties, 12);
/** * value32, in/out: * Bytes to be used for listing information/How many bytes were used.
*/ struct vmmdev_hgcm_function_parameter cb;
/** * pointer, in/optional * Points to struct shfl_string buffer that specifies a search path.
*/ struct vmmdev_hgcm_function_parameter path;
/** * pointer, out: * Buffer to place listing information to. (struct shfl_dirinfo)
*/ struct vmmdev_hgcm_function_parameter buffer;
/** * value32, in/out: * Indicates a key where the listing must be resumed. * in: 0 means start from begin of object. * out: 0 means listing completed.
*/ struct vmmdev_hgcm_function_parameter resume_point;
/** * pointer, out: * Number of files returned
*/ struct vmmdev_hgcm_function_parameter file_count;
};
/* Number of parameters */ #define SHFL_CPARMS_LIST (8)
/** SHFL_FN_READLINK Parameters structure. */ struct shfl_readLink { /** * pointer, in: SHFLROOT (u32) * Root handle of the mapping which name is queried.
*/ struct vmmdev_hgcm_function_parameter root;
/** * pointer, out: * Buffer to place data to.
*/ struct vmmdev_hgcm_function_parameter buffer;
};
/* Number of parameters */ #define SHFL_CPARMS_READLINK (3)
/* SHFL_FN_INFORMATION */
/* Mask of Set/Get bit. */ #define SHFL_INFO_MODE_MASK (0x1) /* Get information */ #define SHFL_INFO_GET (0x0) /* Set information */ #define SHFL_INFO_SET (0x1)
/* Get name of the object. */ #define SHFL_INFO_NAME (0x2) /* Set size of object (extend/trucate); only applies to file objects */ #define SHFL_INFO_SIZE (0x4) /* Get/Set file object info. */ #define SHFL_INFO_FILE (0x8) /* Get volume information. */ #define SHFL_INFO_VOLUME (0x10)
/** SHFL_FN_INFORMATION Parameters structure. */ struct shfl_information { /** * pointer, in: SHFLROOT (u32) * Root handle of the mapping which name is queried.
*/ struct vmmdev_hgcm_function_parameter root;
/** * value64, in: * SHFLHANDLE (u64) of object to be listed.
*/ struct vmmdev_hgcm_function_parameter handle;
/** * value32, in/out: * Bytes to be used for information/How many bytes were used.
*/ struct vmmdev_hgcm_function_parameter cb;
/** * pointer, in/out: * Information to be set/get (shfl_fsobjinfo or shfl_string). Do not * forget to set the shfl_fsobjinfo::attr::additional for a get * operation as well.
*/ struct vmmdev_hgcm_function_parameter info;
};
/* Number of parameters */ #define SHFL_CPARMS_INFORMATION (5)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.