1 | /* $Id: vboxfs_prov.h 28800 2010-04-27 08:22:32Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox File System for Solaris Guests, provider header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2009-2010 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___VBoxFS_prov_Solaris_h
|
---|
19 | #define ___VBoxFS_prov_Solaris_h
|
---|
20 |
|
---|
21 | #ifdef __cplusplus
|
---|
22 | extern "C" {
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | /*
|
---|
26 | * These are the provider interfaces used by sffs to access the underlying
|
---|
27 | * shared file system.
|
---|
28 | */
|
---|
29 | #define SFPROV_VERSION 1
|
---|
30 |
|
---|
31 | /*
|
---|
32 | * Initialization and termination.
|
---|
33 | * sfprov_connect() is called once before any other interfaces and returns
|
---|
34 | * a handle used in further calls. The argument should be SFPROV_VERSION
|
---|
35 | * from above. On failure it returns a NULL pointer.
|
---|
36 | *
|
---|
37 | * sfprov_disconnect() must only be called after all sf file systems have been
|
---|
38 | * unmounted.
|
---|
39 | */
|
---|
40 | typedef struct sfp_connection sfp_connection_t;
|
---|
41 |
|
---|
42 | extern sfp_connection_t *sfprov_connect(int);
|
---|
43 | extern void sfprov_disconnect(sfp_connection_t *);
|
---|
44 |
|
---|
45 |
|
---|
46 | /*
|
---|
47 | * Mount / Unmount a shared folder.
|
---|
48 | *
|
---|
49 | * sfprov_mount() takes as input the connection pointer and the name of
|
---|
50 | * the shared folder. On success, it returns zero and supplies an
|
---|
51 | * sfp_mount_t handle. On failure it returns any relevant errno value.
|
---|
52 | *
|
---|
53 | * sfprov_unmount() unmounts the mounted file system. It returns 0 on
|
---|
54 | * success and any relevant errno on failure.
|
---|
55 | */
|
---|
56 | typedef struct sfp_mount sfp_mount_t;
|
---|
57 |
|
---|
58 | extern int sfprov_mount(sfp_connection_t *, char *, sfp_mount_t **);
|
---|
59 | extern int sfprov_unmount(sfp_mount_t *);
|
---|
60 |
|
---|
61 | /*
|
---|
62 | * query information about a mounted file system
|
---|
63 | */
|
---|
64 | extern int sfprov_get_blksize(sfp_mount_t *, uint64_t *);
|
---|
65 | extern int sfprov_get_blksused(sfp_mount_t *, uint64_t *);
|
---|
66 | extern int sfprov_get_blksavail(sfp_mount_t *, uint64_t *);
|
---|
67 | extern int sfprov_get_maxnamesize(sfp_mount_t *, uint32_t *);
|
---|
68 | extern int sfprov_get_readonly(sfp_mount_t *, uint32_t *);
|
---|
69 |
|
---|
70 | /*
|
---|
71 | * File operations: open/close/read/write/etc.
|
---|
72 | *
|
---|
73 | * open/create can return any relevant errno, however ENOENT
|
---|
74 | * generally means that the host file didn't exist.
|
---|
75 | */
|
---|
76 | typedef struct sfp_file sfp_file_t;
|
---|
77 |
|
---|
78 | extern int sfprov_create(sfp_mount_t *, char *path, sfp_file_t **fp);
|
---|
79 | extern int sfprov_open(sfp_mount_t *, char *path, sfp_file_t **fp);
|
---|
80 | extern int sfprov_close(sfp_file_t *fp);
|
---|
81 | extern int sfprov_read(sfp_file_t *, char * buffer, uint64_t offset,
|
---|
82 | uint32_t *numbytes);
|
---|
83 | extern int sfprov_write(sfp_file_t *, char * buffer, uint64_t offset,
|
---|
84 | uint32_t *numbytes);
|
---|
85 |
|
---|
86 |
|
---|
87 | /*
|
---|
88 | * get information about a file (or directory) using pathname
|
---|
89 | */
|
---|
90 | extern int sfprov_get_mode(sfp_mount_t *, char *, mode_t *);
|
---|
91 | extern int sfprov_get_size(sfp_mount_t *, char *, uint64_t *);
|
---|
92 | extern int sfprov_get_atime(sfp_mount_t *, char *, timestruc_t *);
|
---|
93 | extern int sfprov_get_mtime(sfp_mount_t *, char *, timestruc_t *);
|
---|
94 | extern int sfprov_get_ctime(sfp_mount_t *, char *, timestruc_t *);
|
---|
95 |
|
---|
96 |
|
---|
97 | /*
|
---|
98 | * File/Directory operations
|
---|
99 | */
|
---|
100 | extern int sfprov_trunc(sfp_mount_t *, char *);
|
---|
101 | extern int sfprov_remove(sfp_mount_t *, char *path);
|
---|
102 | extern int sfprov_mkdir(sfp_mount_t *, char *path, sfp_file_t **fp);
|
---|
103 | extern int sfprov_rmdir(sfp_mount_t *, char *path);
|
---|
104 | extern int sfprov_rename(sfp_mount_t *, char *from, char *to, uint_t is_dir);
|
---|
105 |
|
---|
106 | /*
|
---|
107 | * Read directory entries.
|
---|
108 | */
|
---|
109 | extern int sfprov_readdir(sfp_mount_t *mnt, char *path, void **buffer,
|
---|
110 | size_t *buffersize, uint32_t *nents);
|
---|
111 |
|
---|
112 | #ifdef __cplusplus
|
---|
113 | }
|
---|
114 | #endif
|
---|
115 |
|
---|
116 | #endif /* !___VBoxFS_prov_Solaris_h */
|
---|