VirtualBox

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

Last change on this file since 28998 was 28998, checked in by vboxsync, 15 years ago

Linux Additions: rename the vboxvfs module to vboxsf to make it load by demand of the Linux kernel

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 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 /* file structure, only valid between open() and release() */
55 struct file *file;
56 /* handle valid if a file was created with sf_create_aux until it will
57 * be opened with sf_reg_open() */
58 SHFLHANDLE handle;
59};
60
61struct sf_dir_info {
62 struct list_head info_list;
63};
64
65struct sf_dir_buf {
66 size_t nb_entries;
67 size_t free_bytes;
68 size_t used_bytes;
69 void *buf;
70 struct list_head head;
71};
72
73struct sf_reg_info {
74 SHFLHANDLE handle;
75};
76
77/* globals */
78extern VBSFCLIENT client_handle;
79
80/* forward declarations */
81extern struct inode_operations sf_dir_iops;
82extern struct inode_operations sf_reg_iops;
83extern struct file_operations sf_dir_fops;
84extern struct file_operations sf_reg_fops;
85extern struct dentry_operations sf_dentry_ops;
86extern struct address_space_operations sf_reg_aops;
87
88extern void
89sf_init_inode (struct sf_glob_info *sf_g, struct inode *inode,
90 RTFSOBJINFO *info);
91extern int
92sf_stat (const char *caller, struct sf_glob_info *sf_g,
93 SHFLSTRING *path, RTFSOBJINFO *result, int ok_to_fail);
94extern int
95sf_inode_revalidate (struct dentry *dentry);
96#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
97extern int
98sf_getattr (struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat);
99extern int
100sf_setattr (struct dentry *dentry, struct iattr *iattr);
101#endif
102extern int
103sf_path_from_dentry (const char *caller, struct sf_glob_info *sf_g,
104 struct sf_inode_info *sf_i, struct dentry *dentry,
105 SHFLSTRING **result);
106extern int
107sf_nlscpy (struct sf_glob_info *sf_g,
108 char *name, size_t name_bound_len,
109 const unsigned char *utf8_name, size_t utf8_len);
110extern void
111sf_dir_info_free (struct sf_dir_info *p);
112extern struct sf_dir_info *
113sf_dir_info_alloc (void);
114extern int
115sf_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
118sf_init_backing_dev (struct sf_glob_info *sf_g, const char *name);
119extern void
120sf_done_backing_dev (struct sf_glob_info *sf_g);
121
122#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
123#define STRUCT_STATFS struct statfs
124#else
125#define STRUCT_STATFS struct kstatfs
126#endif
127int sf_get_volume_info(struct super_block *sb,STRUCT_STATFS *stat);
128
129#ifdef __cplusplus
130# define CMC_API __attribute__ ((cdecl, regparm (0)))
131#else
132# define CMC_API __attribute__ ((regparm (0)))
133#endif
134
135#define TRACE() LogFunc (("tracepoint\n"))
136
137/* Following casts are here to prevent assignment of void * to
138 pointers of arbitrary type */
139#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
140#define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->u.generic_sbp)
141#define SET_GLOB_INFO(sb, sf_g) (sb)->u.generic_sbp = sf_g
142#else
143#define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->s_fs_info)
144#define SET_GLOB_INFO(sb, sf_g) (sb)->s_fs_info = sf_g
145#endif
146
147#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 19) || defined(KERNEL_FC6)
148/* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
149#define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->i_private)
150#define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
151#else
152/* vanilla kernel up to 2.6.18 */
153#define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->u.generic_ip)
154#define SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
155#endif
156
157#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