VirtualBox

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

Last change on this file since 60584 was 60584, checked in by vboxsync, 9 years ago

Linux host/guest modules: include the revision into the Linux kernel modules (for modinfo MODULE.ko)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1/** @file
2 * vboxsf - VirtualBox Guest Additions for Linux.
3 */
4
5/*
6 * Copyright (C) 2006-2011 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16
17#ifndef VFSMOD_H
18#define VFSMOD_H
19
20#define LOG_GROUP LOG_GROUP_SHARED_FOLDERS
21#include "the-linux-kernel.h"
22#include "version-generated.h"
23#include "revision-generated.h"
24#include "product-generated.h"
25#include <VBox/log.h>
26
27#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
28# include <linux/backing-dev.h>
29#endif
30
31#include <VBox/VBoxGuestLibSharedFolders.h>
32#include "vbsfmount.h"
33
34#define DIR_BUFFER_SIZE (16*_1K)
35
36/* per-shared folder information */
37struct sf_glob_info
38{
39 VBGLSFMAP map;
40 struct nls_table *nls;
41 int ttl;
42 int uid;
43 int gid;
44 int dmode;
45 int fmode;
46 int dmask;
47 int fmask;
48#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
49 struct backing_dev_info bdi;
50#endif
51};
52
53/* per-inode information */
54struct sf_inode_info
55{
56 /* which file */
57 SHFLSTRING *path;
58 /* some information was changed, update data on next revalidate */
59 int force_restat;
60 /* directory content changed, update the whole directory on next sf_getdent */
61 int force_reread;
62 /* file structure, only valid between open() and release() */
63 struct file *file;
64 /* handle valid if a file was created with sf_create_aux until it will
65 * be opened with sf_reg_open() */
66 SHFLHANDLE handle;
67};
68
69struct sf_dir_info
70{
71 struct list_head info_list;
72};
73
74struct sf_dir_buf
75{
76 size_t cEntries;
77 size_t cbFree;
78 size_t cbUsed;
79 void *buf;
80 struct list_head head;
81};
82
83struct sf_reg_info
84{
85 SHFLHANDLE handle;
86};
87
88/* globals */
89extern VBGLSFCLIENT client_handle;
90
91/* forward declarations */
92extern struct inode_operations sf_dir_iops;
93extern struct inode_operations sf_lnk_iops;
94extern struct inode_operations sf_reg_iops;
95extern struct file_operations sf_dir_fops;
96extern struct file_operations sf_reg_fops;
97extern struct dentry_operations sf_dentry_ops;
98extern struct address_space_operations sf_reg_aops;
99
100extern void sf_init_inode(struct sf_glob_info *sf_g, struct inode *inode,
101 PSHFLFSOBJINFO info);
102extern int sf_stat(const char *caller, struct sf_glob_info *sf_g,
103 SHFLSTRING *path, PSHFLFSOBJINFO result, int ok_to_fail);
104extern int sf_inode_revalidate(struct dentry *dentry);
105#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
106extern int sf_getattr(struct vfsmount *mnt, struct dentry *dentry,
107 struct kstat *kstat);
108extern int sf_setattr(struct dentry *dentry, struct iattr *iattr);
109#endif
110extern int sf_path_from_dentry(const char *caller, struct sf_glob_info *sf_g,
111 struct sf_inode_info *sf_i, struct dentry *dentry,
112 SHFLSTRING **result);
113extern int sf_nlscpy(struct sf_glob_info *sf_g,
114 char *name, size_t name_bound_len,
115 const unsigned char *utf8_name, size_t utf8_len);
116extern void sf_dir_info_free(struct sf_dir_info *p);
117extern void sf_dir_info_empty(struct sf_dir_info *p);
118extern struct sf_dir_info *sf_dir_info_alloc(void);
119extern int sf_dir_read_all(struct sf_glob_info *sf_g, struct sf_inode_info *sf_i,
120 struct sf_dir_info *sf_d, SHFLHANDLE handle);
121extern int sf_init_backing_dev(struct sf_glob_info *sf_g);
122extern void sf_done_backing_dev(struct sf_glob_info *sf_g);
123
124#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
125# define STRUCT_STATFS struct statfs
126#else
127# define STRUCT_STATFS struct kstatfs
128#endif
129int sf_get_volume_info(struct super_block *sb,STRUCT_STATFS *stat);
130
131#ifdef __cplusplus
132# define CMC_API __attribute__ ((cdecl, regparm (0)))
133#else
134# define CMC_API __attribute__ ((regparm (0)))
135#endif
136
137#define TRACE() LogFunc(("tracepoint\n"))
138
139/* Following casts are here to prevent assignment of void * to
140 pointers of arbitrary type */
141#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
142# define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->u.generic_sbp)
143# define SET_GLOB_INFO(sb, sf_g) (sb)->u.generic_sbp = sf_g
144#else
145# define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->s_fs_info)
146# define SET_GLOB_INFO(sb, sf_g) (sb)->s_fs_info = sf_g
147#endif
148
149#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || defined(KERNEL_FC6)
150/* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
151# define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->i_private)
152# define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
153#else
154/* vanilla kernel up to 2.6.18 */
155# define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->u.generic_ip)
156# define SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
157#endif
158
159#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
160# define GET_F_DENTRY(f) (f->f_path.dentry)
161#else
162# define GET_F_DENTRY(f) (f->f_dentry)
163#endif
164
165#endif
166
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