VirtualBox

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

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

Linux shared folders: implemented some missing functions, xTracker 3764

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.4 KB
Line 
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/* per-shared folder information */
32struct sf_glob_info {
33 VBSFMAP map;
34 struct nls_table *nls;
35 int ttl;
36 int uid;
37 int gid;
38 int dmode;
39 int fmode;
40 int dmask;
41 int fmask;
42};
43
44/* per-inode information */
45struct sf_inode_info {
46 /* which file */
47 SHFLSTRING *path;
48 /* some information was changed, update data on next revalidate */
49 int force_restat;
50 /* file structure, only valid between open() and release() */
51 struct file *file;
52};
53
54struct sf_dir_info {
55 struct list_head info_list;
56};
57
58struct sf_dir_buf {
59 size_t nb_entries;
60 size_t free_bytes;
61 size_t used_bytes;
62 void *buf;
63 struct list_head head;
64};
65
66struct sf_reg_info {
67 SHFLHANDLE handle;
68};
69
70/* globals */
71extern VBSFCLIENT client_handle;
72
73/* forward declarations */
74extern struct inode_operations sf_dir_iops;
75extern struct inode_operations sf_reg_iops;
76extern struct file_operations sf_dir_fops;
77extern struct file_operations sf_reg_fops;
78extern struct dentry_operations sf_dentry_ops;
79extern struct address_space_operations sf_reg_aops;
80
81extern void
82sf_init_inode (struct sf_glob_info *sf_g, struct inode *inode,
83 RTFSOBJINFO *info);
84extern int
85sf_stat (const char *caller, struct sf_glob_info *sf_g,
86 SHFLSTRING *path, RTFSOBJINFO *result, int ok_to_fail);
87extern int
88sf_inode_revalidate (struct dentry *dentry);
89#if LINUX_VERSION_CODE >= KERNEL_VERSION (2, 6, 0)
90extern int
91sf_getattr (struct vfsmount *mnt, struct dentry *dentry, struct kstat *kstat);
92extern int
93sf_setattr (struct dentry *dentry, struct iattr *iattr);
94#endif
95extern int
96sf_path_from_dentry (const char *caller, struct sf_glob_info *sf_g,
97 struct sf_inode_info *sf_i, struct dentry *dentry,
98 SHFLSTRING **result);
99extern int
100sf_nlscpy (struct sf_glob_info *sf_g,
101 char *name, size_t name_bound_len,
102 const unsigned char *utf8_name, size_t utf8_len);
103extern void
104sf_dir_info_free (struct sf_dir_info *p);
105extern struct sf_dir_info *
106sf_dir_info_alloc (void);
107extern int
108sf_dir_read_all (struct sf_glob_info *sf_g, struct sf_inode_info *sf_i,
109 struct sf_dir_info *sf_d, SHFLHANDLE handle);
110
111#if LINUX_VERSION_CODE < KERNEL_VERSION (2, 6, 0)
112#define STRUCT_STATFS struct statfs
113#else
114#define STRUCT_STATFS struct kstatfs
115#endif
116int sf_get_volume_info(struct super_block *sb,STRUCT_STATFS *stat);
117
118#ifdef ALIGN
119#undef ALIGN
120#endif
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