VirtualBox

source: vbox/trunk/src/VBox/Additions/linux/sharedfolders/vfsmod.h@ 31890

Last change on this file since 31890 was 31006, checked in by vboxsync, 14 years ago

Build fix.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/** @file
2 *
3 * vboxsf -- VirtualBox Guest Additions for Linux
4 */
5
6/*
7 * Copyright (C) 2006-2010 Oracle Corporation
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#include "product-generated.h"
24
25#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
26# include <linux/backing-dev.h>
27#endif
28
29#include "VBoxGuestR0LibSharedFolders.h"
30#include "vbsfmount.h"
31
32#define DIR_BUFFER_SIZE (16*_1K)
33
34/* per-shared folder information */
35struct sf_glob_info
36{
37 VBSFMAP map;
38 struct nls_table *nls;
39 int ttl;
40 int uid;
41 int gid;
42 int dmode;
43 int fmode;
44 int dmask;
45 int fmask;
46#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
47 struct backing_dev_info bdi;
48#endif
49};
50
51/* per-inode information */
52struct sf_inode_info
53{
54 /* which file */
55 SHFLSTRING *path;
56 /* some information was changed, update data on next revalidate */
57 int force_restat;
58 /* directory content changed, update the whole directory on next sf_getdent */
59 int force_reread;
60 /* file structure, only valid between open() and release() */
61 struct file *file;
62 /* handle valid if a file was created with sf_create_aux until it will
63 * be opened with sf_reg_open() */
64 SHFLHANDLE handle;
65};
66
67struct sf_dir_info {
68 struct list_head info_list;
69};
70
71struct sf_dir_buf
72{
73 size_t cEntries;
74 size_t cbFree;
75 size_t cbUsed;
76 void *buf;
77 struct list_head head;
78};
79
80struct sf_reg_info
81{
82 SHFLHANDLE handle;
83};
84
85/* globals */
86extern VBSFCLIENT client_handle;
87
88/* forward declarations */
89extern struct inode_operations sf_dir_iops;
90extern struct inode_operations sf_reg_iops;
91extern struct file_operations sf_dir_fops;
92extern struct file_operations sf_reg_fops;
93extern struct dentry_operations sf_dentry_ops;
94extern struct address_space_operations sf_reg_aops;
95
96extern void sf_init_inode(struct sf_glob_info *sf_g, struct inode *inode,
97 RTFSOBJINFO *info);
98extern int sf_stat(const char *caller, struct sf_glob_info *sf_g,
99 SHFLSTRING *path, RTFSOBJINFO *result, int ok_to_fail);
100extern int sf_inode_revalidate(struct dentry *dentry);
101#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
102extern int sf_getattr(struct vfsmount *mnt, struct dentry *dentry,
103 struct kstat *kstat);
104extern int sf_setattr(struct dentry *dentry, struct iattr *iattr);
105#endif
106extern int sf_path_from_dentry(const char *caller, struct sf_glob_info *sf_g,
107 struct sf_inode_info *sf_i, struct dentry *dentry,
108 SHFLSTRING **result);
109extern int sf_nlscpy(struct sf_glob_info *sf_g,
110 char *name, size_t name_bound_len,
111 const unsigned char *utf8_name, size_t utf8_len);
112extern void sf_dir_info_free(struct sf_dir_info *p);
113extern void sf_dir_info_empty(struct sf_dir_info *p);
114extern struct sf_dir_info *sf_dir_info_alloc(void);
115extern int sf_dir_read_all(struct sf_glob_info *sf_g, struct sf_inode_info *sf_i,
116 struct sf_dir_info *sf_d, SHFLHANDLE handle);
117extern int sf_init_backing_dev(struct sf_glob_info *sf_g, const char *name);
118extern void sf_done_backing_dev(struct sf_glob_info *sf_g);
119
120#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
121# define STRUCT_STATFS struct statfs
122#else
123# define STRUCT_STATFS struct kstatfs
124#endif
125int sf_get_volume_info(struct super_block *sb,STRUCT_STATFS *stat);
126
127#ifdef __cplusplus
128# define CMC_API __attribute__ ((cdecl, regparm (0)))
129#else
130# define CMC_API __attribute__ ((regparm (0)))
131#endif
132
133#define TRACE() LogFunc(("tracepoint\n"))
134
135/* Following casts are here to prevent assignment of void * to
136 pointers of arbitrary type */
137#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
138# define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->u.generic_sbp)
139# define SET_GLOB_INFO(sb, sf_g) (sb)->u.generic_sbp = sf_g
140#else
141# define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->s_fs_info)
142# define SET_GLOB_INFO(sb, sf_g) (sb)->s_fs_info = sf_g
143#endif
144
145#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 19) || defined(KERNEL_FC6)
146/* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
147# define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->i_private)
148# define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
149#else
150/* vanilla kernel up to 2.6.18 */
151# define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->u.generic_ip)
152# define SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
153#endif
154
155#endif /* vfsmod.h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette