VirtualBox

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

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

Linux shared folders: re-read the directory if a file was changed

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