VirtualBox

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

Last change on this file since 70501 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

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