linux/fs/vboxsf/shfl_hostintf.h

/* SPDX-License-Identifier: MIT */
/*
 * VirtualBox Shared Folders: host interface definition.
 *
 * Copyright (C) 2006-2018 Oracle Corporation
 */

#ifndef SHFL_HOSTINTF_H
#define SHFL_HOSTINTF_H

#include <linux/vbox_vmmdev_types.h>

/* The max in/out buffer size for a FN_READ or FN_WRITE call */
#define SHFL_MAX_RW_COUNT

/*
 * 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.
 */

enum {};

/* Root handles for a mapping are of type u32, Root handles are unique. */
#define SHFL_ROOT_NIL

/* Shared folders handle for an opened object are of type u64. */
#define SHFL_HANDLE_NIL

/* Hardcoded maximum length (in chars) of a shared folder name. */
#define SHFL_MAX_LEN
/* Hardcoded maximum number of shared folder mapping available to the guest. */
#define SHFL_MAX_MAPPINGS

/** Shared folder string buffer structure. */
struct shfl_string {};
VMMDEV_ASSERT_SIZE();

/* The size of shfl_string w/o the string part. */
#define SHFLSTRING_HEADER_SIZE

/* Calculate size of the string. */
static inline u32 shfl_string_buf_size(const struct shfl_string *string)
{}

/* Set user id on execution (S_ISUID). */
#define SHFL_UNIX_ISUID
/* Set group id on execution (S_ISGID). */
#define SHFL_UNIX_ISGID
/* Sticky bit (S_ISVTX / S_ISTXT). */
#define SHFL_UNIX_ISTXT

/* Owner readable (S_IRUSR). */
#define SHFL_UNIX_IRUSR
/* Owner writable (S_IWUSR). */
#define SHFL_UNIX_IWUSR
/* Owner executable (S_IXUSR). */
#define SHFL_UNIX_IXUSR

/* Group readable (S_IRGRP). */
#define SHFL_UNIX_IRGRP
/* Group writable (S_IWGRP). */
#define SHFL_UNIX_IWGRP
/* Group executable (S_IXGRP). */
#define SHFL_UNIX_IXGRP

/* Other readable (S_IROTH). */
#define SHFL_UNIX_IROTH
/* Other writable (S_IWOTH). */
#define SHFL_UNIX_IWOTH
/* Other executable (S_IXOTH). */
#define SHFL_UNIX_IXOTH

/* Named pipe (fifo) (S_IFIFO). */
#define SHFL_TYPE_FIFO
/* Character device (S_IFCHR). */
#define SHFL_TYPE_DEV_CHAR
/* Directory (S_IFDIR). */
#define SHFL_TYPE_DIRECTORY
/* Block device (S_IFBLK). */
#define SHFL_TYPE_DEV_BLOCK
/* Regular file (S_IFREG). */
#define SHFL_TYPE_FILE
/* Symbolic link (S_IFLNK). */
#define SHFL_TYPE_SYMLINK
/* Socket (S_IFSOCK). */
#define SHFL_TYPE_SOCKET
/* Whiteout (S_IFWHT). */
#define SHFL_TYPE_WHITEOUT
/* Type mask (S_IFMT). */
#define SHFL_TYPE_MASK

/* Checks the mode flags indicate a directory (S_ISDIR). */
#define SHFL_IS_DIRECTORY(m)
/* Checks the mode flags indicate a symbolic link (S_ISLNK). */
#define SHFL_IS_SYMLINK(m)

/** The available additional information in a shfl_fsobjattr object. */
enum shfl_fsobjattr_add {};

/**
 * Additional unix Attributes, these are available when
 * shfl_fsobjattr.additional == SHFLFSOBJATTRADD_UNIX.
 */
struct shfl_fsobjattr_unix {} __packed;

/** Extended attribute size. */
struct shfl_fsobjattr_easize {} __packed;

/** Shared folder filesystem object attributes. */
struct shfl_fsobjattr {} __packed;
VMMDEV_ASSERT_SIZE();

struct shfl_timespec {};

/** Filesystem object information structure. */
struct shfl_fsobjinfo {} __packed;
VMMDEV_ASSERT_SIZE();

/**
 * 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 {};

/* No flags. Initialization value. */
#define SHFL_CF_NONE

/*
 * Only lookup the object, do not return a handle. When this is set all other
 * flags are ignored.
 */
#define SHFL_CF_LOOKUP

/*
 * 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

/* Create/open a directory. */
#define SHFL_CF_DIRECTORY

/*
 *  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
#define SHFL_CF_ACT_MASK_IF_NEW

/* What to do if object exists. */
#define SHFL_CF_ACT_OPEN_IF_EXISTS
#define SHFL_CF_ACT_FAIL_IF_EXISTS
#define SHFL_CF_ACT_REPLACE_IF_EXISTS
#define SHFL_CF_ACT_OVERWRITE_IF_EXISTS

/* What to do if object does not exist. */
#define SHFL_CF_ACT_CREATE_IF_NEW
#define SHFL_CF_ACT_FAIL_IF_NEW

/* Read/write requested access for the object. */
#define SHFL_CF_ACCESS_MASK_RW

/* No access requested. */
#define SHFL_CF_ACCESS_NONE
/* Read access requested. */
#define SHFL_CF_ACCESS_READ
/* Write access requested. */
#define SHFL_CF_ACCESS_WRITE
/* Read/Write access requested. */
#define SHFL_CF_ACCESS_READWRITE

/* Requested share access for the object. */
#define SHFL_CF_ACCESS_MASK_DENY

/* Allow any access. */
#define SHFL_CF_ACCESS_DENYNONE
/* Do not allow read. */
#define SHFL_CF_ACCESS_DENYREAD
/* Do not allow write. */
#define SHFL_CF_ACCESS_DENYWRITE
/* Do not allow access. */
#define SHFL_CF_ACCESS_DENYALL

/* Requested access to attributes of the object. */
#define SHFL_CF_ACCESS_MASK_ATTR

/* No access requested. */
#define SHFL_CF_ACCESS_ATTR_NONE
/* Read access requested. */
#define SHFL_CF_ACCESS_ATTR_READ
/* Write access requested. */
#define SHFL_CF_ACCESS_ATTR_WRITE
/* Read/Write access requested. */
#define SHFL_CF_ACCESS_ATTR_READWRITE

/*
 * The file is opened in append mode.
 * Ignored if SHFL_CF_ACCESS_WRITE is not set.
 */
#define SHFL_CF_ACCESS_APPEND

/** Create parameters buffer struct for SHFL_FN_CREATE call */
struct shfl_createparms {} __packed;

/** Shared Folder directory information */
struct shfl_dirinfo {};

/** Shared folder filesystem properties. */
struct shfl_fsproperties {};
VMMDEV_ASSERT_SIZE();

struct shfl_volinfo {};


/** SHFL_FN_MAP_FOLDER Parameters structure. */
struct shfl_map_folder {};

/* Number of parameters */
#define SHFL_CPARMS_MAP_FOLDER


/** SHFL_FN_UNMAP_FOLDER Parameters structure. */
struct shfl_unmap_folder {};

/* Number of parameters */
#define SHFL_CPARMS_UNMAP_FOLDER


/** SHFL_FN_CREATE Parameters structure. */
struct shfl_create {};

/* Number of parameters */
#define SHFL_CPARMS_CREATE


/** SHFL_FN_CLOSE Parameters structure. */
struct shfl_close {};

/* Number of parameters */
#define SHFL_CPARMS_CLOSE


/** SHFL_FN_READ Parameters structure. */
struct shfl_read {};

/* Number of parameters */
#define SHFL_CPARMS_READ


/** SHFL_FN_WRITE Parameters structure. */
struct shfl_write {};

/* Number of parameters */
#define SHFL_CPARMS_WRITE


/*
 * SHFL_FN_LIST
 * Listing information includes variable length RTDIRENTRY[EX] structures.
 */

#define SHFL_LIST_NONE
#define SHFL_LIST_RETURN_ONE

/** SHFL_FN_LIST Parameters structure. */
struct shfl_list {};

/* Number of parameters */
#define SHFL_CPARMS_LIST


/** SHFL_FN_READLINK Parameters structure. */
struct shfl_readLink {};

/* Number of parameters */
#define SHFL_CPARMS_READLINK


/* SHFL_FN_INFORMATION */

/* Mask of Set/Get bit. */
#define SHFL_INFO_MODE_MASK
/* Get information */
#define SHFL_INFO_GET
/* Set information */
#define SHFL_INFO_SET

/* Get name of the object. */
#define SHFL_INFO_NAME
/* Set size of object (extend/trucate); only applies to file objects */
#define SHFL_INFO_SIZE
/* Get/Set file object info. */
#define SHFL_INFO_FILE
/* Get volume information. */
#define SHFL_INFO_VOLUME

/** SHFL_FN_INFORMATION Parameters structure. */
struct shfl_information {};

/* Number of parameters */
#define SHFL_CPARMS_INFORMATION


/* SHFL_FN_REMOVE */

#define SHFL_REMOVE_FILE
#define SHFL_REMOVE_DIR
#define SHFL_REMOVE_SYMLINK

/** SHFL_FN_REMOVE Parameters structure. */
struct shfl_remove {};

#define SHFL_CPARMS_REMOVE


/* SHFL_FN_RENAME */

#define SHFL_RENAME_FILE
#define SHFL_RENAME_DIR
#define SHFL_RENAME_REPLACE_IF_EXISTS

/** SHFL_FN_RENAME Parameters structure. */
struct shfl_rename {};

#define SHFL_CPARMS_RENAME


/** SHFL_FN_SYMLINK Parameters structure. */
struct shfl_symlink {};

#define SHFL_CPARMS_SYMLINK

#endif