VirtualBox

source: vbox/trunk/src/VBox/Additions/solaris/SharedFolders/vboxfs_prov.h@ 101359

Last change on this file since 101359 was 98103, checked in by vboxsync, 2 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 6.2 KB
Line 
1/* $Id: vboxfs_prov.h 98103 2023-01-17 14:15:46Z vboxsync $ */
2/** @file
3 * VirtualBox File System for Solaris Guests, provider header.
4 * Portions contributed by: Ronald.
5 */
6
7/*
8 * Copyright (C) 2009-2023 Oracle and/or its affiliates.
9 *
10 * This file is part of VirtualBox base platform packages, as
11 * available from https://www.virtualbox.org.
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation, in version 3 of the
16 * License.
17 *
18 * This program is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, see <https://www.gnu.org/licenses>.
25 *
26 * The contents of this file may alternatively be used under the terms
27 * of the Common Development and Distribution License Version 1.0
28 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
29 * in the VirtualBox distribution, in which case the provisions of the
30 * CDDL are applicable instead of those of the GPL.
31 *
32 * You may elect to license modified versions of this file under the
33 * terms and conditions of either the GPL or the CDDL or both.
34 *
35 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
36 */
37
38#ifndef GA_INCLUDED_SRC_solaris_SharedFolders_vboxfs_prov_h
39#define GA_INCLUDED_SRC_solaris_SharedFolders_vboxfs_prov_h
40#ifndef RT_WITHOUT_PRAGMA_ONCE
41# pragma once
42#endif
43
44#include <VBox/VBoxGuestLibSharedFolders.h>
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50
51/*
52 * These are the provider interfaces used by sffs to access the underlying
53 * shared file system.
54 */
55#define SFPROV_VERSION 1
56
57/*
58 * Initialization and termination.
59 * sfprov_connect() is called once before any other interfaces and returns
60 * a handle used in further calls. The argument should be SFPROV_VERSION
61 * from above. On failure it returns a NULL pointer.
62 *
63 * sfprov_disconnect() must only be called after all sf file systems have been
64 * unmounted.
65 */
66typedef struct sfp_connection sfp_connection_t;
67
68extern sfp_connection_t *sfprov_connect(int);
69extern void sfprov_disconnect(sfp_connection_t *);
70
71
72/*
73 * Mount / Unmount a shared folder.
74 *
75 * sfprov_mount() takes as input the connection pointer and the name of
76 * the shared folder. On success, it returns zero and supplies an
77 * sfp_mount_t handle. On failure it returns any relevant errno value.
78 *
79 * sfprov_unmount() unmounts the mounted file system. It returns 0 on
80 * success and any relevant errno on failure.
81 *
82 * spf_mount_t is the representation of an active mount point.
83 */
84typedef struct spf_mount_t {
85 VBGLSFMAP map; /**< guest<->host mapping */
86 uid_t sf_uid; /**< owner of the mount point */
87 gid_t sf_gid; /**< group of the mount point */
88 mode_t sf_dmode; /**< mode of all directories if != ~0U */
89 mode_t sf_fmode; /**< mode of all files if != ~0U */
90 mode_t sf_dmask; /**< mask of all directories */
91 mode_t sf_fmask; /**< mask of all files */
92} sfp_mount_t;
93
94extern int sfprov_mount(sfp_connection_t *, char *, sfp_mount_t **);
95extern int sfprov_unmount(sfp_mount_t *);
96
97/*
98 * query information about a mounted file system
99 */
100typedef struct sffs_fsinfo {
101 uint64_t blksize;
102 uint64_t blksused;
103 uint64_t blksavail;
104 uint32_t maxnamesize;
105 uint32_t readonly;
106} sffs_fsinfo_t;
107
108extern int sfprov_get_fsinfo(sfp_mount_t *, sffs_fsinfo_t *);
109
110/*
111 * File operations: open/close/read/write/etc.
112 *
113 * open/create can return any relevant errno, however ENOENT
114 * generally means that the host file didn't exist.
115 */
116typedef struct sffs_stat {
117 mode_t sf_mode;
118 off_t sf_size;
119 off_t sf_alloc;
120 timestruc_t sf_atime;
121 timestruc_t sf_mtime;
122 timestruc_t sf_ctime;
123} sffs_stat_t;
124
125typedef struct sfp_file sfp_file_t;
126
127extern int sfprov_create(sfp_mount_t *, char *path, mode_t mode,
128 sfp_file_t **fp, sffs_stat_t *stat);
129extern int sfprov_diropen(sfp_mount_t *mnt, char *path, sfp_file_t **fp);
130extern int sfprov_open(sfp_mount_t *, char *path, sfp_file_t **fp, int flag);
131extern int sfprov_close(sfp_file_t *fp);
132extern int sfprov_read(sfp_file_t *, char * buffer, uint64_t offset,
133 uint32_t *numbytes);
134extern int sfprov_write(sfp_file_t *, char * buffer, uint64_t offset,
135 uint32_t *numbytes);
136extern int sfprov_fsync(sfp_file_t *fp);
137
138
139/*
140 * get/set information about a file (or directory) using pathname
141 */
142extern int sfprov_get_mode(sfp_mount_t *, char *, mode_t *);
143extern int sfprov_get_size(sfp_mount_t *, char *, uint64_t *);
144extern int sfprov_get_atime(sfp_mount_t *, char *, timestruc_t *);
145extern int sfprov_get_mtime(sfp_mount_t *, char *, timestruc_t *);
146extern int sfprov_get_ctime(sfp_mount_t *, char *, timestruc_t *);
147extern int sfprov_get_attr(sfp_mount_t *, char *, sffs_stat_t *);
148extern int sfprov_set_attr(sfp_mount_t *, char *, uint_t, mode_t,
149 timestruc_t, timestruc_t, timestruc_t);
150extern int sfprov_set_size(sfp_mount_t *, char *, uint64_t);
151
152
153/*
154 * File/Directory operations
155 */
156extern int sfprov_remove(sfp_mount_t *, char *path, uint_t is_link);
157extern int sfprov_mkdir(sfp_mount_t *, char *path, mode_t mode,
158 sfp_file_t **fp, sffs_stat_t *stat);
159extern int sfprov_rmdir(sfp_mount_t *, char *path);
160extern int sfprov_rename(sfp_mount_t *, char *from, char *to, uint_t is_dir);
161
162
163/*
164 * Symbolic link operations
165 */
166extern int sfprov_set_show_symlinks(void);
167extern int sfprov_readlink(sfp_mount_t *, char *path, char *target,
168 size_t tgt_size);
169extern int sfprov_symlink(sfp_mount_t *, char *linkname, char *target,
170 sffs_stat_t *stat);
171
172
173/*
174 * Read directory entries.
175 */
176/*
177 * a singly linked list of buffers, each containing an array of stat's+dirent's.
178 * sf_len is length of the sf_entries array, in bytes.
179 */
180typedef struct sffs_dirents {
181 struct sffs_dirents *sf_next;
182 len_t sf_len;
183 struct sffs_dirent {
184 sffs_stat_t sf_stat;
185 dirent64_t sf_entry; /* this is variable length */
186 } sf_entries[1];
187} sffs_dirents_t;
188
189#define SFFS_DIRENTS_SIZE 8192
190#define SFFS_DIRENTS_OFF (offsetof(sffs_dirents_t, sf_entries[0]))
191
192extern int sfprov_readdir(sfp_mount_t *mnt, char *path,
193 sffs_dirents_t **dirents, int flag);
194
195#ifdef __cplusplus
196}
197#endif
198
199#endif /* !GA_INCLUDED_SRC_solaris_SharedFolders_vboxfs_prov_h */
200
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