VirtualBox

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

最後變更 在這個檔案從39278是 39278,由 vboxsync 提交於 13 年 前

Additions/solaris/SharedFolders: Consolidate volinfo calls into one fsinfo.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Id
檔案大小: 5.2 KB
 
1/* $Id: vboxfs_prov.h 39278 2011-11-11 17:05:17Z vboxsync $ */
2/** @file
3 * VirtualBox File System for Solaris Guests, provider header.
4 * Portions contributed by: Ronald.
5 */
6
7/*
8 * Copyright (C) 2009-2010 Oracle Corporation
9 *
10 * This file is part of VirtualBox Open Source Edition (OSE), as
11 * available from http://www.alldomusa.eu.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#ifdef __cplusplus
32extern "C" {
33#endif
34
35/*
36 * These are the provider interfaces used by sffs to access the underlying
37 * shared file system.
38 */
39#define SFPROV_VERSION 1
40
41/*
42 * Initialization and termination.
43 * sfprov_connect() is called once before any other interfaces and returns
44 * a handle used in further calls. The argument should be SFPROV_VERSION
45 * from above. On failure it returns a NULL pointer.
46 *
47 * sfprov_disconnect() must only be called after all sf file systems have been
48 * unmounted.
49 */
50typedef struct sfp_connection sfp_connection_t;
51
52extern sfp_connection_t *sfprov_connect(int);
53extern void sfprov_disconnect(sfp_connection_t *);
54
55
56/*
57 * Mount / Unmount a shared folder.
58 *
59 * sfprov_mount() takes as input the connection pointer and the name of
60 * the shared folder. On success, it returns zero and supplies an
61 * sfp_mount_t handle. On failure it returns any relevant errno value.
62 *
63 * sfprov_unmount() unmounts the mounted file system. It returns 0 on
64 * success and any relevant errno on failure.
65 */
66typedef struct sfp_mount sfp_mount_t;
67
68extern int sfprov_mount(sfp_connection_t *, char *, sfp_mount_t **);
69extern int sfprov_unmount(sfp_mount_t *);
70
71/*
72 * query information about a mounted file system
73 */
74typedef struct sffs_fsinfo {
75 uint64_t blksize;
76 uint64_t blksused;
77 uint64_t blksavail;
78 uint32_t maxnamesize;
79 uint32_t readonly;
80} sffs_fsinfo_t;
81
82extern int sfprov_get_fsinfo(sfp_mount_t *, sffs_fsinfo_t *);
83
84/*
85 * File operations: open/close/read/write/etc.
86 *
87 * open/create can return any relevant errno, however ENOENT
88 * generally means that the host file didn't exist.
89 */
90typedef struct sfp_file sfp_file_t;
91
92extern int sfprov_create(sfp_mount_t *, char *path, sfp_file_t **fp);
93extern int sfprov_open(sfp_mount_t *, char *path, sfp_file_t **fp);
94extern int sfprov_close(sfp_file_t *fp);
95extern int sfprov_read(sfp_file_t *, char * buffer, uint64_t offset,
96 uint32_t *numbytes);
97extern int sfprov_write(sfp_file_t *, char * buffer, uint64_t offset,
98 uint32_t *numbytes);
99extern int sfprov_fsync(sfp_file_t *fp);
100
101
102/*
103 * get/set information about a file (or directory) using pathname
104 */
105typedef struct sffs_stat {
106 mode_t sf_mode;
107 off_t sf_size;
108 off_t sf_alloc;
109 timestruc_t sf_atime;
110 timestruc_t sf_mtime;
111 timestruc_t sf_ctime;
112} sffs_stat_t;
113
114extern int sfprov_get_mode(sfp_mount_t *, char *, mode_t *);
115extern int sfprov_get_size(sfp_mount_t *, char *, uint64_t *);
116extern int sfprov_get_atime(sfp_mount_t *, char *, timestruc_t *);
117extern int sfprov_get_mtime(sfp_mount_t *, char *, timestruc_t *);
118extern int sfprov_get_ctime(sfp_mount_t *, char *, timestruc_t *);
119extern int sfprov_get_attr(sfp_mount_t *, char *, sffs_stat_t *);
120extern int sfprov_set_attr(sfp_mount_t *, char *, uint_t, mode_t,
121 timestruc_t, timestruc_t, timestruc_t);
122extern int sfprov_set_size(sfp_mount_t *, char *, uint64_t);
123
124
125/*
126 * File/Directory operations
127 */
128extern int sfprov_trunc(sfp_mount_t *, char *);
129extern int sfprov_remove(sfp_mount_t *, char *path, uint_t is_link);
130extern int sfprov_mkdir(sfp_mount_t *, char *path, sfp_file_t **fp);
131extern int sfprov_rmdir(sfp_mount_t *, char *path);
132extern int sfprov_rename(sfp_mount_t *, char *from, char *to, uint_t is_dir);
133
134
135/*
136 * Symbolic link operations
137 */
138extern int sfprov_set_show_symlinks(void);
139extern int sfprov_readlink(sfp_mount_t *, char *path, char *target,
140 size_t tgt_size);
141extern int sfprov_symlink(sfp_mount_t *, char *linkname, char *target,
142 sffs_stat_t *stat);
143
144
145/*
146 * Read directory entries.
147 */
148/*
149 * a singly linked list of buffers, each containing an array of stat's+dirent's.
150 * sf_len is length of the sf_entries array, in bytes.
151 */
152typedef struct sffs_dirents {
153 struct sffs_dirents *sf_next;
154 len_t sf_len;
155 struct sffs_dirent {
156 sffs_stat_t sf_stat;
157 dirent64_t sf_entry; /* this is variable length */
158 } sf_entries[1];
159} sffs_dirents_t;
160
161#define SFFS_DIRENTS_SIZE 8192
162#define SFFS_DIRENTS_OFF (offsetof(sffs_dirents_t, sf_entries[0]))
163
164extern int sfprov_readdir(sfp_mount_t *mnt, char *path,
165 sffs_dirents_t **dirents);
166
167#ifdef __cplusplus
168}
169#endif
170
171#endif /* !___VBoxFS_prov_Solaris_h */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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