1 | /* $Id: vboxfs_prov.h 30417 2010-06-24 10:58:25Z 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.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 |
|
---|
19 | #ifndef ___VBoxFS_prov_Solaris_h
|
---|
20 | #define ___VBoxFS_prov_Solaris_h
|
---|
21 |
|
---|
22 | #ifdef __cplusplus
|
---|
23 | extern "C" {
|
---|
24 | #endif
|
---|
25 |
|
---|
26 | /*
|
---|
27 | * These are the provider interfaces used by sffs to access the underlying
|
---|
28 | * shared file system.
|
---|
29 | */
|
---|
30 | #define SFPROV_VERSION 1
|
---|
31 |
|
---|
32 | /*
|
---|
33 | * Initialization and termination.
|
---|
34 | * sfprov_connect() is called once before any other interfaces and returns
|
---|
35 | * a handle used in further calls. The argument should be SFPROV_VERSION
|
---|
36 | * from above. On failure it returns a NULL pointer.
|
---|
37 | *
|
---|
38 | * sfprov_disconnect() must only be called after all sf file systems have been
|
---|
39 | * unmounted.
|
---|
40 | */
|
---|
41 | typedef struct sfp_connection sfp_connection_t;
|
---|
42 |
|
---|
43 | extern sfp_connection_t *sfprov_connect(int);
|
---|
44 | extern void sfprov_disconnect(sfp_connection_t *);
|
---|
45 |
|
---|
46 |
|
---|
47 | /*
|
---|
48 | * Mount / Unmount a shared folder.
|
---|
49 | *
|
---|
50 | * sfprov_mount() takes as input the connection pointer and the name of
|
---|
51 | * the shared folder. On success, it returns zero and supplies an
|
---|
52 | * sfp_mount_t handle. On failure it returns any relevant errno value.
|
---|
53 | *
|
---|
54 | * sfprov_unmount() unmounts the mounted file system. It returns 0 on
|
---|
55 | * success and any relevant errno on failure.
|
---|
56 | */
|
---|
57 | typedef struct sfp_mount sfp_mount_t;
|
---|
58 |
|
---|
59 | extern int sfprov_mount(sfp_connection_t *, char *, sfp_mount_t **);
|
---|
60 | extern int sfprov_unmount(sfp_mount_t *);
|
---|
61 |
|
---|
62 | /*
|
---|
63 | * query information about a mounted file system
|
---|
64 | */
|
---|
65 | extern int sfprov_get_blksize(sfp_mount_t *, uint64_t *);
|
---|
66 | extern int sfprov_get_blksused(sfp_mount_t *, uint64_t *);
|
---|
67 | extern int sfprov_get_blksavail(sfp_mount_t *, uint64_t *);
|
---|
68 | extern int sfprov_get_maxnamesize(sfp_mount_t *, uint32_t *);
|
---|
69 | extern int sfprov_get_readonly(sfp_mount_t *, uint32_t *);
|
---|
70 |
|
---|
71 | /*
|
---|
72 | * File operations: open/close/read/write/etc.
|
---|
73 | *
|
---|
74 | * open/create can return any relevant errno, however ENOENT
|
---|
75 | * generally means that the host file didn't exist.
|
---|
76 | */
|
---|
77 | typedef struct sfp_file sfp_file_t;
|
---|
78 |
|
---|
79 | extern int sfprov_create(sfp_mount_t *, char *path, sfp_file_t **fp);
|
---|
80 | extern int sfprov_open(sfp_mount_t *, char *path, sfp_file_t **fp);
|
---|
81 | extern int sfprov_close(sfp_file_t *fp);
|
---|
82 | extern int sfprov_read(sfp_file_t *, char * buffer, uint64_t offset,
|
---|
83 | uint32_t *numbytes);
|
---|
84 | extern int sfprov_write(sfp_file_t *, char * buffer, uint64_t offset,
|
---|
85 | uint32_t *numbytes);
|
---|
86 |
|
---|
87 |
|
---|
88 | /*
|
---|
89 | * get/set information about a file (or directory) using pathname
|
---|
90 | */
|
---|
91 | extern int sfprov_get_mode(sfp_mount_t *, char *, mode_t *);
|
---|
92 | extern int sfprov_get_size(sfp_mount_t *, char *, uint64_t *);
|
---|
93 | extern int sfprov_get_atime(sfp_mount_t *, char *, timestruc_t *);
|
---|
94 | extern int sfprov_get_mtime(sfp_mount_t *, char *, timestruc_t *);
|
---|
95 | extern int sfprov_get_ctime(sfp_mount_t *, char *, timestruc_t *);
|
---|
96 | extern int sfprov_set_attr(sfp_mount_t *, char *, uint_t, mode_t,
|
---|
97 | timestruc_t, timestruc_t, timestruc_t);
|
---|
98 | extern int sfprov_set_size(sfp_mount_t *, char *, uint64_t);
|
---|
99 |
|
---|
100 |
|
---|
101 | /*
|
---|
102 | * File/Directory operations
|
---|
103 | */
|
---|
104 | extern int sfprov_trunc(sfp_mount_t *, char *);
|
---|
105 | extern int sfprov_remove(sfp_mount_t *, char *path);
|
---|
106 | extern int sfprov_mkdir(sfp_mount_t *, char *path, sfp_file_t **fp);
|
---|
107 | extern int sfprov_rmdir(sfp_mount_t *, char *path);
|
---|
108 | extern int sfprov_rename(sfp_mount_t *, char *from, char *to, uint_t is_dir);
|
---|
109 |
|
---|
110 | /*
|
---|
111 | * Read directory entries.
|
---|
112 | */
|
---|
113 | extern int sfprov_readdir(sfp_mount_t *mnt, char *path, void **buffer,
|
---|
114 | size_t *buffersize, uint32_t *nents);
|
---|
115 |
|
---|
116 | #ifdef __cplusplus
|
---|
117 | }
|
---|
118 | #endif
|
---|
119 |
|
---|
120 | #endif /* !___VBoxFS_prov_Solaris_h */
|
---|