[76733] | 1 | /* $Id: vbsfmount.h 100317 2023-06-28 10:34:21Z vboxsync $ */
|
---|
[2614] | 2 | /** @file
|
---|
[76733] | 3 | * vboxsf - VBox Linux Shared Folders VFS, mount(2) parameter structure.
|
---|
[2614] | 4 | */
|
---|
| 5 |
|
---|
| 6 | /*
|
---|
[98103] | 7 | * Copyright (C) 2006-2023 Oracle and/or its affiliates.
|
---|
[2614] | 8 | *
|
---|
[72627] | 9 | * Permission is hereby granted, free of charge, to any person
|
---|
| 10 | * obtaining a copy of this software and associated documentation
|
---|
| 11 | * files (the "Software"), to deal in the Software without
|
---|
| 12 | * restriction, including without limitation the rights to use,
|
---|
| 13 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
| 14 | * copies of the Software, and to permit persons to whom the
|
---|
| 15 | * Software is furnished to do so, subject to the following
|
---|
| 16 | * conditions:
|
---|
| 17 | *
|
---|
| 18 | * The above copyright notice and this permission notice shall be
|
---|
| 19 | * included in all copies or substantial portions of the Software.
|
---|
| 20 | *
|
---|
| 21 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
| 22 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
| 23 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
| 24 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
| 25 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
| 26 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
| 27 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
| 28 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
[2614] | 29 | */
|
---|
| 30 |
|
---|
[76563] | 31 | #ifndef GA_INCLUDED_SRC_linux_sharedfolders_vbsfmount_h
|
---|
| 32 | #define GA_INCLUDED_SRC_linux_sharedfolders_vbsfmount_h
|
---|
[76534] | 33 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
| 34 | # pragma once
|
---|
| 35 | #endif
|
---|
[2614] | 36 |
|
---|
[87463] | 37 | #define MAX_HOST_NAME 256
|
---|
| 38 | #define MAX_NLS_NAME 32
|
---|
[77492] | 39 | #define VBSF_DEFAULT_TTL_MS 200
|
---|
[2614] | 40 |
|
---|
[11507] | 41 | #define VBSF_MOUNT_SIGNATURE_BYTE_0 '\377'
|
---|
| 42 | #define VBSF_MOUNT_SIGNATURE_BYTE_1 '\376'
|
---|
| 43 | #define VBSF_MOUNT_SIGNATURE_BYTE_2 '\375'
|
---|
| 44 |
|
---|
[77953] | 45 | /**
|
---|
| 46 | * VBox Linux Shared Folders VFS caching mode.
|
---|
| 47 | */
|
---|
| 48 | enum vbsf_cache_mode {
|
---|
| 49 | /** Use the kernel modules default caching mode (kVbsfCacheMode_Strict). */
|
---|
| 50 | kVbsfCacheMode_Default = 0,
|
---|
| 51 | /** No caching, go to the host for everything. This will have some minor
|
---|
| 52 | * coherency issues for memory mapping with unsynced dirty pages. */
|
---|
| 53 | kVbsfCacheMode_None,
|
---|
| 54 | /** No caching, except for files with writable memory mappings.
|
---|
| 55 | * (Note to future: if we do oplock like stuff, it goes in here.) */
|
---|
| 56 | kVbsfCacheMode_Strict,
|
---|
| 57 | /** Use page cache for reads.
|
---|
| 58 | * This improves guest performance for read intensive jobs, like compiling
|
---|
| 59 | * building. The flip side is that the guest may not see host modification in a
|
---|
| 60 | * timely manner and possibly update files with out-of-date cache information,
|
---|
| 61 | * as there exists no protocol for the host to notify the guest about file
|
---|
| 62 | * modifications. */
|
---|
| 63 | kVbsfCacheMode_Read,
|
---|
| 64 | /** Use page cache for both reads and writes as far as that's possible.
|
---|
| 65 | * This is good for guest performance, but the price is that the guest possibly
|
---|
| 66 | * ignoring host changes and the host not seeing guest changes in a timely
|
---|
| 67 | * manner. */
|
---|
| 68 | kVbsfCacheMode_ReadWrite,
|
---|
| 69 | /** End of valid values (exclusive). */
|
---|
| 70 | kVbsfCacheMode_End,
|
---|
| 71 | /** Make sure the enum is sizeof(int32_t). */
|
---|
| 72 | kVbsfCacheMode_32BitHack = 0x7fffffff
|
---|
| 73 | };
|
---|
| 74 |
|
---|
| 75 | /**
|
---|
| 76 | * VBox Linux Shared Folders VFS mount options.
|
---|
| 77 | */
|
---|
[70786] | 78 | struct vbsf_mount_info_new {
|
---|
[77526] | 79 | /**
|
---|
| 80 | * The old version of the mount_info struct started with a
|
---|
| 81 | * char name[MAX_HOST_NAME] field, where name cannot be '\0'.
|
---|
| 82 | * So the new version of the mount_info struct starts with a
|
---|
| 83 | * nullchar field which is always 0 so that we can detect and
|
---|
| 84 | * reject the old structure being passed.
|
---|
| 85 | */
|
---|
[77953] | 86 | char nullchar;
|
---|
| 87 | /** Signature */
|
---|
| 88 | char signature[3];
|
---|
| 89 | /** Length of the whole structure */
|
---|
| 90 | int length;
|
---|
| 91 | /** Share name */
|
---|
| 92 | char name[MAX_HOST_NAME];
|
---|
| 93 | /** Name of an I/O charset */
|
---|
| 94 | char nls_name[MAX_NLS_NAME];
|
---|
| 95 | /** User ID for all entries, default 0=root */
|
---|
| 96 | int uid;
|
---|
| 97 | /** Group ID for all entries, default 0=root */
|
---|
| 98 | int gid;
|
---|
| 99 | /** Directory entry and inode time to live in milliseconds.
|
---|
| 100 | * -1 for kernel default, 0 to disable caching.
|
---|
| 101 | * @sa vbsf_mount_info_new::msDirCacheTTL, vbsf_mount_info_new::msInodeTTL */
|
---|
| 102 | int ttl;
|
---|
| 103 | /** Mode for directories if != -1. */
|
---|
| 104 | int dmode;
|
---|
| 105 | /** Mode for regular files if != -1. */
|
---|
| 106 | int fmode;
|
---|
| 107 | /** umask applied to directories */
|
---|
| 108 | int dmask;
|
---|
| 109 | /** umask applied to regular files */
|
---|
| 110 | int fmask;
|
---|
| 111 | /** Mount tag for VBoxService automounter.
|
---|
| 112 | * @since 6.0.0 */
|
---|
| 113 | char szTag[32];
|
---|
| 114 | /** Max pages to read & write at a time.
|
---|
| 115 | * @since 6.0.6 */
|
---|
| 116 | uint32_t cMaxIoPages;
|
---|
| 117 | /** The directory content buffer size. Set to 0 for kernel module default.
|
---|
| 118 | * Larger value reduces the number of host calls on large directories. */
|
---|
| 119 | uint32_t cbDirBuf;
|
---|
| 120 | /** The time to live for directory entries (in milliseconds). @a ttl is used
|
---|
| 121 | * if negative.
|
---|
| 122 | * @since 6.0.6 */
|
---|
| 123 | int32_t msDirCacheTTL;
|
---|
| 124 | /** The time to live for inode information (in milliseconds). @a ttl is used
|
---|
| 125 | * if negative.
|
---|
| 126 | * @since 6.0.6 */
|
---|
| 127 | int32_t msInodeTTL;
|
---|
| 128 | /** The cache and coherency mode.
|
---|
| 129 | * @since 6.0.6 */
|
---|
| 130 | enum vbsf_cache_mode enmCacheMode;
|
---|
[11507] | 131 | };
|
---|
[77953] | 132 | #ifdef AssertCompileSize
|
---|
| 133 | AssertCompileSize(struct vbsf_mount_info_new, 2*4 + MAX_HOST_NAME + MAX_NLS_NAME + 7*4 + 32 + 5*4);
|
---|
| 134 | #endif
|
---|
[11507] | 135 |
|
---|
[31202] | 136 | /** Completes the mount operation by adding the new mount point to mtab if required. */
|
---|
[87463] | 137 | int vbsfmount_complete(const char *pszSharedFolder, const char *pszMountPoint,
|
---|
| 138 | unsigned long fFlags, const char *pszOpts);
|
---|
[31202] | 139 |
|
---|
[76563] | 140 | #endif /* !GA_INCLUDED_SRC_linux_sharedfolders_vbsfmount_h */
|
---|