summaryrefslogtreecommitdiffstats
path: root/src/VBox/Additions/linux/sharedfolders/vbsfmount.h
blob: c14e5284a5376c7d9cc2133bc5c126ee51524e5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* $Id: vbsfmount.h $ */
/** @file
 * vboxsf - VBox Linux Shared Folders VFS, mount(2) parameter structure.
 */

/*
 * Copyright (C) 2006-2019 Oracle Corporation
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef GA_INCLUDED_SRC_linux_sharedfolders_vbsfmount_h
#define GA_INCLUDED_SRC_linux_sharedfolders_vbsfmount_h
#ifndef RT_WITHOUT_PRAGMA_ONCE
# pragma once
#endif

/* Linux constraints the size of data mount argument to PAGE_SIZE - 1. */
#define MAX_HOST_NAME  256
#define MAX_NLS_NAME    32

#define VBSF_MOUNT_SIGNATURE_BYTE_0 '\377'
#define VBSF_MOUNT_SIGNATURE_BYTE_1 '\376'
#define VBSF_MOUNT_SIGNATURE_BYTE_2 '\375'

struct vbsf_mount_info_new {
	/*
	 * The old version of the mount_info struct started with a
	 * char name[MAX_HOST_NAME] field, where name cannot be '\0'.
	 * So the new version of the mount_info struct starts with a
	 * nullchar field which is always 0 so that we can detect and
	 * reject the old structure being passed.
	 */
	char nullchar;
	char signature[3];	/* signature */
	int length;		/* length of the whole structure */
	char name[MAX_HOST_NAME];	/* share name */
	char nls_name[MAX_NLS_NAME];	/* name of an I/O charset */
	int uid;		/* user ID for all entries, default 0=root */
	int gid;		/* group ID for all entries, default 0=root */
	int ttl;		/* time to live */
	int dmode;		/* mode for directories if != 0xffffffff */
	int fmode;		/* mode for regular files if != 0xffffffff */
	int dmask;		/* umask applied to directories */
	int fmask;		/* umask applied to regular files */
	char tag[32];		/**< Mount tag for VBoxService automounter.  @since 6.0 */
};

struct vbsf_mount_opts {
	int uid;
	int gid;
	int ttl;
	int dmode;
	int fmode;
	int dmask;
	int fmask;
	int ronly;
	int sloppy;
	int noexec;
	int nodev;
	int nosuid;
	int remount;
	char nls_name[MAX_NLS_NAME];
	char *convertcp;
};

/** Completes the mount operation by adding the new mount point to mtab if required. */
int vbsfmount_complete(const char *host_name, const char *mount_point,
		       unsigned long flags, struct vbsf_mount_opts *opts);

#endif /* !GA_INCLUDED_SRC_linux_sharedfolders_vbsfmount_h */