VirtualBox

source: vbox/trunk/src/VBox/ImageMounter/vboximg-mount/fuse.h@ 106743

Last change on this file since 106743 was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/** @file
2 * Module to dynamically load libfuse/libosxfuse and load all symbols which are needed by
3 * vboximg-mount.
4 */
5
6/*
7 * Copyright (C) 2019-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 * --------------------------------------------------------------------
27 *
28 * This code is based on and contains parts of:
29 *
30 * libfuse
31 *
32 * FUSE: Filesystem in Userspace
33 * Copyright (C) 2001-2007 Miklos Szeredi <miklos@szeredi.hu>
34 *
35 * This program can be distributed under the terms of the GNU LGPLv2.
36 * See the file COPYING.LIB.
37 */
38
39#ifndef VBOX_INCLUDED_SRC_vboximg_mount_fuse_h
40#define VBOX_INCLUDED_SRC_vboximg_mount_fuse_h
41#ifndef RT_WITHOUT_PRAGMA_ONCE
42# pragma once
43#endif
44
45#include <iprt/types.h>
46#include <iprt/stdarg.h>
47
48RT_C_DECLS_BEGIN
49
50/* Forward declaration of stat buffer. */
51struct stat;
52
53/**
54 * Fuse option structure.
55 */
56typedef struct fuse_opt
57{
58 /** Argument template with optional parameter formatting. */
59 const char *pszTempl;
60 /** Offset where the parameter is stored inside the data struct passed to fuse_opt_parse(). */
61 unsigned long uOffset;
62 /** The value to set the variable to if the template has no argument format. */
63 int uVal;
64} fuse_opt;
65
66#define FUSE_OPT_KEY(templ, key) { templ, -1U, key }
67#define FUSE_OPT_END { NULL, 0, 0 }
68#define FUSE_OPT_KEY_NONOPT -2
69
70/**
71 * Fuse argument vector.
72 */
73typedef struct fuse_args
74{
75 int argc;
76 char **argv;
77 int allocated;
78} fuse_args;
79
80#define FUSE_ARGS_INIT(argc, argv) { argc, argv, 0 }
81
82
83/**
84 * Fuse file info structure - for us only the fh member is of interest for now.
85 */
86typedef struct fuse_file_info
87{
88 int flags;
89 unsigned long fh_old;
90 int writepage;
91 unsigned int oth_flags;
92 uint64_t fh;
93 uint64_t lock_owner;
94} fuse_file_info;
95
96/** Option processing function. */
97typedef int (*fuse_opt_proc_t)(void *data, const char *arg, int key, struct fuse_args *outargs);
98
99/** Directory entry filler function. */
100typedef int (*fuse_fill_dir_t) (void *buf, const char *name, const struct stat *stbuf, off_t off);
101
102
103/**
104 * Fuse FS callback table implementing the filesystem functionality.
105 *
106 * Only required methods are filled out, others are stubbed (change as required).
107 */
108typedef struct fuse_operations
109{
110 int (*getattr) (const char *pszPath, struct stat *pStatBuf);
111 int (*readlink) (const char *pszPath, char *pbBuf, size_t cbBuf);
112 PFNRT getdir;
113 PFNRT mknod;
114 PFNRT mkdir;
115 PFNRT unlink;
116 PFNRT rmdir;
117 PFNRT symlink;
118 PFNRT rename;
119 PFNRT link;
120 PFNRT chmod;
121 PFNRT chown;
122 PFNRT truncate;
123 PFNRT utime;
124 int (*open) (const char *pszPath, struct fuse_file_info *pInfo);
125 int (*read) (const char *pszPath, char *pbBuf, size_t cbBuf, off_t off, struct fuse_file_info *pInfo);
126 int (*write) (const char *pszPath, const char *pbBuf, size_t cbBuf, off_t off, struct fuse_file_info *pInfo);
127 PFNRT statfs;
128 PFNRT flush;
129 int (*release) (const char *pszPath, struct fuse_file_info *pInfo);
130 PFNRT fsync;
131 PFNRT setxattr; /* OSXFuse has a different parameter layout. */
132 PFNRT getxattr; /* OSXFuse has a different parameter layout. */
133 PFNRT listxattr;
134 PFNRT removexattr;
135 int (*opendir) (const char *pszPath, struct fuse_file_info *pInfo);
136 int (*readdir) (const char *pszPath, void *pvBuf, fuse_fill_dir_t pfnFiller, off_t offset, struct fuse_file_info *pInfo);
137 PFNRT releasedir;
138 PFNRT fsyncdir;
139 PFNRT init;
140 PFNRT destroy;
141 PFNRT access;
142 PFNRT create;
143 PFNRT ftruncate;
144 PFNRT fgettatr;
145 PFNRT lock;
146 PFNRT utimens;
147 PFNRT bmap;
148 unsigned int flag_null_path_ok: 1;
149 unsigned int flag_nopath: 1;
150 unsigned int flag_utime_omit_ok: 1;
151 unsigned int flag_reserved: 20;
152 PFNRT ioctl;
153 PFNRT poll;
154 PFNRT write_buf;
155 PFNRT read_buf;
156 PFNRT flock;
157 PFNRT fallocate;
158#ifdef RT_OS_DARWIN
159 PFNRT rsvd00;
160 PFNRT rsvd01;
161 PFNRT rsvd02;
162 PFNRT statfs_x;
163 PFNRT setvolname;
164 PFNRT exchange;
165 PFNRT getxtimes;
166 PFNRT setbkuptime;
167 PFNRT setchgtime;
168 PFNRT setcrtime;
169 PFNRT chflags;
170 PFNRT setattr_x;
171 PFNRT fsetattr_x;
172#endif
173} fuse_operations;
174
175/* Declarations of the functions that we need from libfuse */
176#define VBOX_FUSE_GENERATE_HEADER
177
178#include "fuse-calls.h"
179
180#undef VBOX_FUSE_GENERATE_HEADER
181
182RT_C_DECLS_END
183
184#endif /* !VBOX_INCLUDED_SRC_vboximg_mount_fuse_h */
185
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