VirtualBox

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

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

SharedFolders/linux: Don't close an inode for a regular file after it was created with sf_create(). We assume that this inode will be opened with sf_reg_open() and later closed with sf_reg_close(). Fixes copying of read-only files on shared folders.

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

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette