summaryrefslogtreecommitdiff
path: root/open-vm-tools/modules/solaris/vmhgfs/filesystem.h
blob: 709fc21833120c4e5e0bce4bfc04bc0975dc520c (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*********************************************************
 * Copyright (C) 2004-2015 VMware, Inc. All rights reserved.
 *
 * The contents of this file are subject to the terms of the Common
 * Development and Distribution License (the "License") version 1.0
 * and no later version.  You may not use this file except in
 * compliance with the License.
 *
 * You can obtain a copy of the License at
 *         http://www.opensource.org/licenses/cddl1.php
 *
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 *********************************************************/

/*
 * filesystem.h --
 *
 * Includes and definitions for filesystem code.
 *
 */



#ifndef __FILESYSTEM_H_
#define __FILESYSTEM_H_


/*
 * Solaris includes
 */
#include <sys/mntent.h>		/* mount flags */
#include <sys/mount.h>

/*
 * Kernel only includes
 */
#ifdef _KERNEL

#include <sys/modctl.h>         /* mod_fsops, ... */
#include <sys/cmn_err.h>        /* cmn_err() */
#include <sys/ddi.h>            /* cmn_err() */
#include <sys/sunddi.h>         /* cmn_err() */
#include <sys/vfs.h>            /* struct vfs, ... */
#include <sys/vnode.h>          /* struct vnode, ... */

#if SOL11
#include <sys/vfs_opreg.h>      /* fs_operation_def_t, ... */
#endif

#endif /* _KERNEL */

#include "hgfsSolaris.h"

/*
 * Macros
 */
#define HGFS_MAGIC           (0xbacbacbc)
#define HGFS_FSTYPE          HGFS_FS_NAME

/*
 * Struct passed from mount program to kernel (fs module)
 */
typedef struct HgfsMountData {
   uint32_t magic;
   uint32_t version;
   uint32_t fd;
} HgfsMountData;


#ifdef _KERNEL
/*
 * Macros
 */
#ifdef SOL9
 #define HGFS_VFS_FLAGS         VFS_NOSUID
#else
 #define HGFS_VFS_FLAGS         VFS_NOSETUID
#endif

#ifdef SOL9
 #define HGFS_VFS_VERSION       2
#elif defined SOL10
 #define HGFS_VFS_VERSION       3
#else
 #define HGFS_VFS_VERSION       5
#endif

#define HGFS_VFS_BSIZE          HGFS_PACKET_MAX
#define HGFS_COPYIN_FLAGS	(0)
#define HGFS_VFS_TO_SI(vfsp)	((HgfsSuperInfo *)vfsp->vfs_data)

/* This macro is used for both vnode ops and vfs ops. */
#if defined SOL9 || defined SOL10
#define HGFS_VOP(vopName, vopFn, hgfsFn) { vopName, hgfsFn }
#else
#define HGFS_VOP(vopName, vopFn, hgfsFn) { vopName, { .vopFn = hgfsFn } }
#endif

/*
 * Functions
 */
/* To abstract Solaris 9 and 10 differences in suser() calls */
int HgfsSuser(struct cred *cr);

void HgfsFreeVfsOps(void);

/*
 * Extern variables
 */
#ifdef SOL9
EXTERN struct vfsops HgfsVfsOps;
#endif

#endif /* _KERNEL */


#endif /* __FILESYSTEM_H_ */