1 | /** @file
|
---|
2 | *
|
---|
3 | * vboxvfs -- VirtualBox Guest Additions for Linux
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
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 |
|
---|
18 | #ifndef VFSMOD_H
|
---|
19 | #define VFSMOD_H
|
---|
20 |
|
---|
21 | #include "the-linux-kernel.h"
|
---|
22 | #include "version-generated.h"
|
---|
23 |
|
---|
24 | #include "VBoxCalls.h"
|
---|
25 | #include "vbsfmount.h"
|
---|
26 |
|
---|
27 | /* structs */
|
---|
28 | struct sf_glob_info {
|
---|
29 | VBSFMAP map;
|
---|
30 | struct nls_table *nls;
|
---|
31 | int ttl;
|
---|
32 | int uid;
|
---|
33 | int gid;
|
---|
34 | };
|
---|
35 |
|
---|
36 | struct sf_inode_info {
|
---|
37 | SHFLSTRING *path;
|
---|
38 | int force_restat;
|
---|
39 | };
|
---|
40 |
|
---|
41 | struct sf_dir_info {
|
---|
42 | struct list_head info_list;
|
---|
43 | };
|
---|
44 |
|
---|
45 | struct sf_dir_buf {
|
---|
46 | size_t nb_entries;
|
---|
47 | size_t free_bytes;
|
---|
48 | size_t used_bytes;
|
---|
49 | void *buf;
|
---|
50 | struct list_head head;
|
---|
51 | };
|
---|
52 |
|
---|
53 | struct sf_reg_info {
|
---|
54 | SHFLHANDLE handle;
|
---|
55 | };
|
---|
56 |
|
---|
57 | /* globals */
|
---|
58 | extern VBSFCLIENT client_handle;
|
---|
59 |
|
---|
60 | /* forward declarations */
|
---|
61 | extern struct inode_operations sf_dir_iops;
|
---|
62 | extern struct inode_operations sf_reg_iops;
|
---|
63 | extern struct file_operations sf_dir_fops;
|
---|
64 | extern struct file_operations sf_reg_fops;
|
---|
65 | extern struct dentry_operations sf_dentry_ops;
|
---|
66 |
|
---|
67 | extern void
|
---|
68 | sf_init_inode (struct sf_glob_info *sf_g, struct inode *inode,
|
---|
69 | RTFSOBJINFO *info);
|
---|
70 | extern int
|
---|
71 | sf_stat (const char *caller, struct sf_glob_info *sf_g,
|
---|
72 | SHFLSTRING *path, RTFSOBJINFO *result, int ok_to_fail);
|
---|
73 | extern int
|
---|
74 | sf_inode_revalidate (struct dentry *dentry);
|
---|
75 | #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
|
---|
76 | extern int
|
---|
77 | sf_getattr (struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat);
|
---|
78 | #endif
|
---|
79 | extern int
|
---|
80 | sf_path_from_dentry (const char *caller, struct sf_glob_info *sf_g,
|
---|
81 | struct sf_inode_info *sf_i, struct dentry *dentry,
|
---|
82 | SHFLSTRING **result);
|
---|
83 | extern int
|
---|
84 | sf_nlscpy (struct sf_glob_info *sf_g,
|
---|
85 | char *name, size_t name_bound_len,
|
---|
86 | const unsigned char *utf8_name, size_t utf8_len);
|
---|
87 | extern void
|
---|
88 | sf_dir_info_free (struct sf_dir_info *p);
|
---|
89 | extern struct sf_dir_info *
|
---|
90 | sf_dir_info_alloc (void);
|
---|
91 | extern int
|
---|
92 | sf_dir_read_all (struct sf_glob_info *sf_g, struct sf_inode_info *sf_i,
|
---|
93 | struct sf_dir_info *sf_d, SHFLHANDLE handle);
|
---|
94 |
|
---|
95 | #if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
|
---|
96 | #define STRUCT_STATFS struct statfs
|
---|
97 | #else
|
---|
98 | #define STRUCT_STATFS struct kstatfs
|
---|
99 | #endif
|
---|
100 | int sf_get_volume_info(struct super_block *sb,STRUCT_STATFS *stat);
|
---|
101 |
|
---|
102 | #ifdef ALIGN
|
---|
103 | #undef ALIGN
|
---|
104 | #endif
|
---|
105 |
|
---|
106 | #define CMC_API __attribute__ ((cdecl, regparm (0)))
|
---|
107 |
|
---|
108 | #define TRACE() LogFunc (("tracepoint\n"))
|
---|
109 |
|
---|
110 | /* Following casts are here to prevent assignment of void * to
|
---|
111 | pointers of arbitrary type */
|
---|
112 | #if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
|
---|
113 | #define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->u.generic_sbp)
|
---|
114 | #define SET_GLOB_INFO(sb, sf_g) (sb)->u.generic_sbp = sf_g
|
---|
115 | #else
|
---|
116 | #define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->s_fs_info)
|
---|
117 | #define SET_GLOB_INFO(sb, sf_g) (sb)->s_fs_info = sf_g
|
---|
118 | #endif
|
---|
119 |
|
---|
120 | #if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 19) || defined(KERNEL_FC6)
|
---|
121 | /* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
|
---|
122 | #define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->i_private)
|
---|
123 | #define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
|
---|
124 | #else
|
---|
125 | /* vanilla kernel up to 2.6.18 */
|
---|
126 | #define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->u.generic_ip)
|
---|
127 | #define SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
|
---|
128 | #endif
|
---|
129 |
|
---|
130 | #endif /* vfsmod.h */
|
---|