VirtualBox

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

Last change on this file since 77390 was 77303, checked in by vboxsync, 6 years ago

linux/vboxsf: Cleaned out the VBOXSF_USE_DEPRECATED_VBGL_INTERFACE #ifdefs. bugref:9172

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1/* $Id: vfsmod.h 77303 2019-02-13 14:49:11Z vboxsync $ */
2/** @file
3 * vboxsf - Linux Shared Folders VFS, internal header.
4 */
5
6/*
7 * Copyright (C) 2006-2019 Oracle Corporation
8 *
9 * Permission is hereby granted, free of charge, to any person
10 * obtaining a copy of this software and associated documentation
11 * files (the "Software"), to deal in the Software without
12 * restriction, including without limitation the rights to use,
13 * copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following
16 * conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
29 */
30
31#ifndef GA_INCLUDED_SRC_linux_sharedfolders_vfsmod_h
32#define GA_INCLUDED_SRC_linux_sharedfolders_vfsmod_h
33#ifndef RT_WITHOUT_PRAGMA_ONCE
34# pragma once
35#endif
36
37#define LOG_GROUP LOG_GROUP_SHARED_FOLDERS
38#include "the-linux-kernel.h"
39#include <VBox/log.h>
40
41#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
42# include <linux/backing-dev.h>
43#endif
44
45#include <VBox/VBoxGuestLibSharedFolders.h>
46#include <VBox/VBoxGuestLibSharedFoldersInline.h>
47#include "vbsfmount.h"
48
49#define DIR_BUFFER_SIZE (16*_1K)
50
51/* per-shared folder information */
52struct sf_glob_info {
53 VBGLSFMAP map;
54 struct nls_table *nls;
55 int ttl;
56 int uid;
57 int gid;
58 int dmode;
59 int fmode;
60 int dmask;
61 int fmask;
62 /** Maximum number of pages to allow in an I/O buffer with the host.
63 * This applies to read and write operations. */
64 uint32_t cMaxIoPages;
65#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
66 struct backing_dev_info bdi;
67#endif
68 char tag[32]; /**< Mount tag for VBoxService automounter. @since 6.0 */
69};
70
71/* per-inode information */
72struct sf_inode_info {
73 /* which file */
74 SHFLSTRING *path;
75 /* some information was changed, update data on next revalidate */
76 int force_restat;
77 /* directory content changed, update the whole directory on next sf_getdent */
78 int force_reread;
79 /* file structure, only valid between open() and release() */
80 struct file *file;
81 /* handle valid if a file was created with sf_create_aux until it will
82 * be opened with sf_reg_open() */
83 SHFLHANDLE handle;
84};
85
86struct sf_dir_info {
87 struct list_head info_list;
88};
89
90struct sf_dir_buf {
91 size_t cEntries;
92 size_t cbFree;
93 size_t cbUsed;
94 void *buf;
95 struct list_head head;
96};
97
98struct sf_reg_info {
99 SHFLHANDLE handle;
100};
101
102/* globals */
103extern VBGLSFCLIENT client_handle;
104
105/* forward declarations */
106extern struct inode_operations sf_dir_iops;
107extern struct inode_operations sf_lnk_iops;
108extern struct inode_operations sf_reg_iops;
109extern struct file_operations sf_dir_fops;
110extern struct file_operations sf_reg_fops;
111extern struct dentry_operations sf_dentry_ops;
112extern struct address_space_operations sf_reg_aops;
113
114extern void sf_init_inode(struct sf_glob_info *sf_g, struct inode *inode,
115 PSHFLFSOBJINFO info);
116extern int sf_stat(const char *caller, struct sf_glob_info *sf_g,
117 SHFLSTRING * path, PSHFLFSOBJINFO result, int ok_to_fail);
118extern int sf_inode_revalidate(struct dentry *dentry);
119#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
120# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
121extern int sf_getattr(const struct path *path, struct kstat *kstat,
122 u32 request_mask, unsigned int query_flags);
123# else
124extern int sf_getattr(struct vfsmount *mnt, struct dentry *dentry,
125 struct kstat *kstat);
126# endif
127extern int sf_setattr(struct dentry *dentry, struct iattr *iattr);
128#endif
129extern int sf_path_from_dentry(const char *caller, struct sf_glob_info *sf_g,
130 struct sf_inode_info *sf_i,
131 struct dentry *dentry, SHFLSTRING ** result);
132extern int sf_nlscpy(struct sf_glob_info *sf_g, char *name,
133 size_t name_bound_len, const unsigned char *utf8_name,
134 size_t utf8_len);
135extern void sf_dir_info_free(struct sf_dir_info *p);
136extern void sf_dir_info_empty(struct sf_dir_info *p);
137extern struct sf_dir_info *sf_dir_info_alloc(void);
138extern int sf_dir_read_all(struct sf_glob_info *sf_g,
139 struct sf_inode_info *sf_i, struct sf_dir_info *sf_d,
140 SHFLHANDLE handle);
141extern int sf_init_backing_dev(struct sf_glob_info *sf_g);
142extern void sf_done_backing_dev(struct sf_glob_info *sf_g);
143
144#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
145# define STRUCT_STATFS struct statfs
146#else
147# define STRUCT_STATFS struct kstatfs
148#endif
149int sf_get_volume_info(struct super_block *sb, STRUCT_STATFS * stat);
150
151#ifdef __cplusplus
152# define CMC_API __attribute__ ((cdecl, regparm (0)))
153#else
154# define CMC_API __attribute__ ((regparm (0)))
155#endif
156
157#define TRACE() LogFunc(("tracepoint\n"))
158
159/* Following casts are here to prevent assignment of void * to
160 pointers of arbitrary type */
161#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
162# define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->u.generic_sbp)
163# define SET_GLOB_INFO(sb, sf_g) (sb)->u.generic_sbp = sf_g
164#else
165# define GET_GLOB_INFO(sb) ((struct sf_glob_info *) (sb)->s_fs_info)
166# define SET_GLOB_INFO(sb, sf_g) (sb)->s_fs_info = sf_g
167#endif
168
169#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19) || defined(KERNEL_FC6)
170/* FC6 kernel 2.6.18, vanilla kernel 2.6.19+ */
171# define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->i_private)
172# define SET_INODE_INFO(i, sf_i) (i)->i_private = sf_i
173#else
174/* vanilla kernel up to 2.6.18 */
175# define GET_INODE_INFO(i) ((struct sf_inode_info *) (i)->u.generic_ip)
176# define SET_INODE_INFO(i, sf_i) (i)->u.generic_ip = sf_i
177#endif
178
179#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
180# define GET_F_DENTRY(f) (f->f_path.dentry)
181#else
182# define GET_F_DENTRY(f) (f->f_dentry)
183#endif
184
185#endif /* !GA_INCLUDED_SRC_linux_sharedfolders_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