VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/sharedfolders/vbsfmount.h@ 96407

Last change on this file since 96407 was 96407, checked in by vboxsync, 22 months ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.8 KB
Line 
1/* $Id: vbsfmount.h 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * vboxsf - VBox Linux Shared Folders VFS, mount(2) parameter structure.
4 */
5
6/*
7 * Copyright (C) 2006-2022 Oracle and/or its affiliates.
8 *
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.
29 */
30
31#ifndef GA_INCLUDED_SRC_linux_sharedfolders_vbsfmount_h
32#define GA_INCLUDED_SRC_linux_sharedfolders_vbsfmount_h
33#ifndef RT_WITHOUT_PRAGMA_ONCE
34# pragma once
35#endif
36
37/* Linux constrains the size of data mount argument to PAGE_SIZE - 1. */
38#define MAX_MNTOPT_STR PAGE_SIZE
39#define MAX_HOST_NAME 256
40#define MAX_NLS_NAME 32
41#define VBSF_DEFAULT_TTL_MS 200
42
43#define VBSF_MOUNT_SIGNATURE_BYTE_0 '\377'
44#define VBSF_MOUNT_SIGNATURE_BYTE_1 '\376'
45#define VBSF_MOUNT_SIGNATURE_BYTE_2 '\375'
46
47/**
48 * VBox Linux Shared Folders VFS caching mode.
49 */
50enum vbsf_cache_mode {
51 /** Use the kernel modules default caching mode (kVbsfCacheMode_Strict). */
52 kVbsfCacheMode_Default = 0,
53 /** No caching, go to the host for everything. This will have some minor
54 * coherency issues for memory mapping with unsynced dirty pages. */
55 kVbsfCacheMode_None,
56 /** No caching, except for files with writable memory mappings.
57 * (Note to future: if we do oplock like stuff, it goes in here.) */
58 kVbsfCacheMode_Strict,
59 /** Use page cache for reads.
60 * This improves guest performance for read intensive jobs, like compiling
61 * building. The flip side is that the guest may not see host modification in a
62 * timely manner and possibly update files with out-of-date cache information,
63 * as there exists no protocol for the host to notify the guest about file
64 * modifications. */
65 kVbsfCacheMode_Read,
66 /** Use page cache for both reads and writes as far as that's possible.
67 * This is good for guest performance, but the price is that the guest possibly
68 * ignoring host changes and the host not seeing guest changes in a timely
69 * manner. */
70 kVbsfCacheMode_ReadWrite,
71 /** End of valid values (exclusive). */
72 kVbsfCacheMode_End,
73 /** Make sure the enum is sizeof(int32_t). */
74 kVbsfCacheMode_32BitHack = 0x7fffffff
75};
76
77/**
78 * VBox Linux Shared Folders VFS mount options.
79 */
80struct vbsf_mount_info_new {
81 /**
82 * The old version of the mount_info struct started with a
83 * char name[MAX_HOST_NAME] field, where name cannot be '\0'.
84 * So the new version of the mount_info struct starts with a
85 * nullchar field which is always 0 so that we can detect and
86 * reject the old structure being passed.
87 */
88 char nullchar;
89 /** Signature */
90 char signature[3];
91 /** Length of the whole structure */
92 int length;
93 /** Share name */
94 char name[MAX_HOST_NAME];
95 /** Name of an I/O charset */
96 char nls_name[MAX_NLS_NAME];
97 /** User ID for all entries, default 0=root */
98 int uid;
99 /** Group ID for all entries, default 0=root */
100 int gid;
101 /** Directory entry and inode time to live in milliseconds.
102 * -1 for kernel default, 0 to disable caching.
103 * @sa vbsf_mount_info_new::msDirCacheTTL, vbsf_mount_info_new::msInodeTTL */
104 int ttl;
105 /** Mode for directories if != -1. */
106 int dmode;
107 /** Mode for regular files if != -1. */
108 int fmode;
109 /** umask applied to directories */
110 int dmask;
111 /** umask applied to regular files */
112 int fmask;
113 /** Mount tag for VBoxService automounter.
114 * @since 6.0.0 */
115 char szTag[32];
116 /** Max pages to read & write at a time.
117 * @since 6.0.6 */
118 uint32_t cMaxIoPages;
119 /** The directory content buffer size. Set to 0 for kernel module default.
120 * Larger value reduces the number of host calls on large directories. */
121 uint32_t cbDirBuf;
122 /** The time to live for directory entries (in milliseconds). @a ttl is used
123 * if negative.
124 * @since 6.0.6 */
125 int32_t msDirCacheTTL;
126 /** The time to live for inode information (in milliseconds). @a ttl is used
127 * if negative.
128 * @since 6.0.6 */
129 int32_t msInodeTTL;
130 /** The cache and coherency mode.
131 * @since 6.0.6 */
132 enum vbsf_cache_mode enmCacheMode;
133};
134#ifdef AssertCompileSize
135AssertCompileSize(struct vbsf_mount_info_new, 2*4 + MAX_HOST_NAME + MAX_NLS_NAME + 7*4 + 32 + 5*4);
136#endif
137
138/** Completes the mount operation by adding the new mount point to mtab if required. */
139int vbsfmount_complete(const char *pszSharedFolder, const char *pszMountPoint,
140 unsigned long fFlags, const char *pszOpts);
141
142#endif /* !GA_INCLUDED_SRC_linux_sharedfolders_vbsfmount_h */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use