1 | /** @file
|
---|
2 | *
|
---|
3 | * vboxvfs -- VirtualBox Guest Additions for Linux
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
18 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
19 | * additional information or have any questions.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef VFSMOD_H
|
---|
23 | #define VFSMOD_H
|
---|
24 |
|
---|
25 | #include "the-linux-kernel.h"
|
---|
26 | #include "version-generated.h"
|
---|
27 |
|
---|
28 | #include "VBoxCalls.h"
|
---|
29 | #include "vbsfmount.h"
|
---|
30 |
|
---|
31 | /* structs */
|
---|
32 | struct sf_glob_info {
|
---|
33 | VBSFMAP map;
|
---|
34 | struct nls_table *nls;
|
---|
35 | int ttl;
|
---|
36 | int uid;
|
---|
37 | int gid;
|
---|
38 | };
|
---|
39 |
|
---|
40 | struct sf_inode_info {
|
---|
41 | SHFLSTRING *path;
|
---|
42 | int force_restat;
|
---|
43 | };
|
---|
44 |
|
---|
45 | struct sf_dir_info {
|
---|
46 | struct list_head info_list;
|
---|
47 | };
|
---|
48 |
|
---|
49 | struct sf_dir_buf {
|
---|
50 | size_t nb_entries;
|
---|
51 | size_t free_bytes;
|
---|
52 | size_t used_bytes;
|
---|
53 | void *buf;
|
---|
54 | struct list_head head;
|
---|
55 | };
|
---|
56 |
|
---|
57 | struct sf_reg_info {
|
---|
58 | SHFLHANDLE handle;
|
---|
59 | };
|
---|
60 |
|
---|
61 | /* globals */
|
---|
62 | extern VBSFCLIENT client_handle;
|
---|
63 |
|
---|
64 | /* forward declarations */
|
---|
65 | extern struct inode_operations sf_dir_iops;
|
---|
66 | extern struct inode_operations sf_reg_iops;
|
---|
67 | extern struct file_operations sf_dir_fops;
|
---|
68 | extern struct file_operations sf_reg_fops;
|
---|
69 | extern struct dentry_operations sf_dentry_ops;
|
---|
70 | extern struct address_space_operations sf_reg_aops;
|
---|
71 |
|
---|
72 | extern void
|
---|
73 | sf_init_inode (struct sf_glob_info *sf_g, struct inode *inode,
|
---|
74 | RTFSOBJINFO *info);
|
---|
75 | extern int
|
---|
76 | sf_stat (const char *caller, struct sf_glob_info *sf_g,
|
---|
77 | SHFLSTRING *path, RTFSOBJINFO *result, int ok_to_fail);
|
---|
78 | extern int
|
---|
79 | sf_inode_revalidate (struct dentry *dentry);
|
---|
80 | #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
|
---|
81 | extern int
|
---|
82 | sf_getattr (struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat);
|
---|
83 | #endif
|
---|
84 | extern int
|
---|
85 | sf_path_from_dentry (const char *caller, struct sf_glob_info *sf_g,
|
---|
86 | struct sf_inode_info *sf_i, struct dentry *dentry,
|
---|
87 | SHFLSTRING **result);
|
---|
88 | extern int
|
---|
89 | sf_nlscpy (struct sf_glob_info *sf_g,
|
---|
90 | char *name, size_t name_bound_len,
|
---|
91 | const unsigned char *utf8_name, size_t utf8_len);
|
---|
92 | extern void
|
---|
93 | sf_dir_info_free (struct sf_dir_info *p);
|
---|
94 | extern struct sf_dir_info *
|
---|
95 | sf_dir_info_alloc (void);
|
---|
96 | extern int
|
---|
97 | sf_dir_read_all (struct sf_glob_info *sf_g, struct sf_inode_info *sf_i,
|
---|
98 | struct sf_dir_info *sf_d, SHFLHANDLE handle);
|
---|
99 |
|
---|
100 | #if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
|
---|
101 | #define STRUCT_STATFS struct statfs
|
---|
102 | #else
|
---|
103 | #define STRUCT_STATFS struct kstatfs
|
---|
104 | #endif
|
---|
105 | int sf_get_volume_info(struct super_block *sb,STRUCT_STATFS *stat);
|
---|
106 |
|
---|
107 | #ifdef ALIGN
|
---|
108 | #undef ALIGN
|
---|
109 | #endif
|
---|
110 |
|
---|
111 | #define CMC_API __attribute__ ((cdecl, regparm (0)))
|
---|
112 |
|
---|
113 | #define TRACE() LogFunc (("tracepoint\n"))
|
---|
114 |
|
---|
115 | /* Following casts are here to prevent assignment of void * to
|
---|
116 | pointers of arbitrary type */
|
---|
117 | #if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
|
---|
118 | #define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->u.generic_sbp)
|
---|
119 | #define SET_GLOB_INFO(sb, sf_g) (sb)->u.generic_sbp = sf_g
|
---|
120 | #else
|
---|
121 | #define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->s_fs_info)
|
---|
122 | #define SET_GLOB_INFO(sb, sf_g) (sb)->s_fs_info = sf_g
|
---|
123 | #endif
|
---|
124 |
|
---|
125 | #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 19) || defined(KERNEL_FC6)
|
---|
126 | /* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
|
---|
127 | #define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->i_private)
|
---|
128 | #define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
|
---|
129 | #else
|
---|
130 | /* vanilla kernel up to 2.6.18 */
|
---|
131 | #define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->u.generic_ip)
|
---|
132 | #define SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
|
---|
133 | #endif
|
---|
134 |
|
---|
135 | #endif /* vfsmod.h */
|
---|