1 | /** @file
|
---|
2 | * vboxsf -- VirtualBox Guest Additions for Linux: mount(2) parameter structure.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2018 Oracle Corporation
|
---|
7 | *
|
---|
8 | * Permission is hereby granted, free of charge, to any person
|
---|
9 | * obtaining a copy of this software and associated documentation
|
---|
10 | * files (the "Software"), to deal in the Software without
|
---|
11 | * restriction, including without limitation the rights to use,
|
---|
12 | * copy, modify, merge, publish, distribute, sublicense, and/or sell
|
---|
13 | * copies of the Software, and to permit persons to whom the
|
---|
14 | * Software is furnished to do so, subject to the following
|
---|
15 | * conditions:
|
---|
16 | *
|
---|
17 | * The above copyright notice and this permission notice shall be
|
---|
18 | * included in all copies or substantial portions of the Software.
|
---|
19 | *
|
---|
20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
---|
21 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
---|
22 | * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
---|
23 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
---|
24 | * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
---|
25 | * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
26 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
---|
27 | * OTHER DEALINGS IN THE SOFTWARE.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef VBFS_MOUNT_H
|
---|
31 | #define VBFS_MOUNT_H
|
---|
32 |
|
---|
33 | /* Linux constraints the size of data mount argument to PAGE_SIZE - 1. */
|
---|
34 | #define MAX_HOST_NAME 256
|
---|
35 | #define MAX_NLS_NAME 32
|
---|
36 |
|
---|
37 | #define VBSF_MOUNT_SIGNATURE_BYTE_0 '\377'
|
---|
38 | #define VBSF_MOUNT_SIGNATURE_BYTE_1 '\376'
|
---|
39 | #define VBSF_MOUNT_SIGNATURE_BYTE_2 '\375'
|
---|
40 |
|
---|
41 | struct vbsf_mount_info_new {
|
---|
42 | /*
|
---|
43 | * The old version of the mount_info struct started with a
|
---|
44 | * char name[MAX_HOST_NAME] field, where name cannot be '\0'.
|
---|
45 | * So the new version of the mount_info struct starts with a
|
---|
46 | * nullchar field which is always 0 so that we can detect and
|
---|
47 | * reject the old structure being passed.
|
---|
48 | */
|
---|
49 | char nullchar;
|
---|
50 | char signature[3]; /* signature */
|
---|
51 | int length; /* length of the whole structure */
|
---|
52 | char name[MAX_HOST_NAME]; /* share name */
|
---|
53 | char nls_name[MAX_NLS_NAME]; /* name of an I/O charset */
|
---|
54 | int uid; /* user ID for all entries, default 0=root */
|
---|
55 | int gid; /* group ID for all entries, default 0=root */
|
---|
56 | int ttl; /* time to live */
|
---|
57 | int dmode; /* mode for directories if != 0xffffffff */
|
---|
58 | int fmode; /* mode for regular files if != 0xffffffff */
|
---|
59 | int dmask; /* umask applied to directories */
|
---|
60 | int fmask; /* umask applied to regular files */
|
---|
61 | };
|
---|
62 |
|
---|
63 | struct vbsf_mount_opts {
|
---|
64 | int uid;
|
---|
65 | int gid;
|
---|
66 | int ttl;
|
---|
67 | int dmode;
|
---|
68 | int fmode;
|
---|
69 | int dmask;
|
---|
70 | int fmask;
|
---|
71 | int ronly;
|
---|
72 | int sloppy;
|
---|
73 | int noexec;
|
---|
74 | int nodev;
|
---|
75 | int nosuid;
|
---|
76 | int remount;
|
---|
77 | char nls_name[MAX_NLS_NAME];
|
---|
78 | char *convertcp;
|
---|
79 | };
|
---|
80 |
|
---|
81 | /** Completes the mount operation by adding the new mount point to mtab if required. */
|
---|
82 | int vbsfmount_complete(const char *host_name, const char *mount_point,
|
---|
83 | unsigned long flags, struct vbsf_mount_opts *opts);
|
---|
84 |
|
---|
85 | #endif /* vbsfmount.h */
|
---|