]> code.delx.au - refind/blob - filesystems/test/.svn/text-base/fsw_posix.h.svn-base
Misc. small changes.
[refind] / filesystems / test / .svn / text-base / fsw_posix.h.svn-base
1 /**
2 * \file fsw_posix.h
3 * POSIX user space host environment header.
4 */
5
6 /*-
7 * Copyright (c) 2006 Christoph Pfisterer
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are
11 * met:
12 *
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 *
16 * * Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the
19 * distribution.
20 *
21 * * Neither the name of Christoph Pfisterer nor the names of the
22 * contributors may be used to endorse or promote products derived
23 * from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37
38 #ifndef _FSW_POSIX_H_
39 #define _FSW_POSIX_H_
40
41 #include "fsw_core.h"
42
43 #include <fcntl.h>
44 #include <sys/types.h>
45 #include <sys/dir.h>
46
47
48 /**
49 * POSIX Host: Private per-volume structure.
50 */
51
52 struct fsw_posix_volume {
53 struct fsw_volume *vol; //!< FSW volume structure
54
55 int fd; //!< System file descriptor for data access
56
57 };
58
59 /**
60 * POSIX Host: Private structure for an open file.
61 */
62
63 struct fsw_posix_file {
64 struct fsw_posix_volume *pvol; //!< POSIX host volume structure
65
66 struct fsw_shandle shand; //!< FSW handle for this file
67
68 };
69
70 /**
71 * POSIX Host: Private structure for an open directory.
72 */
73
74 struct fsw_posix_dir {
75 struct fsw_posix_volume *pvol; //!< POSIX host volume structure
76
77 struct fsw_shandle shand; //!< FSW handle for this file
78
79 };
80
81
82 /* functions */
83
84 struct fsw_posix_volume * fsw_posix_mount(const char *path, struct fsw_fstype_table *fstype_table);
85 int fsw_posix_unmount(struct fsw_posix_volume *pvol);
86
87 struct fsw_posix_file * fsw_posix_open(struct fsw_posix_volume *pvol, const char *path, int flags, mode_t mode);
88 ssize_t fsw_posix_read(struct fsw_posix_file *file, void *buf, size_t nbytes);
89 off_t fsw_posix_lseek(struct fsw_posix_file *file, off_t offset, int whence);
90 int fsw_posix_close(struct fsw_posix_file *file);
91
92 struct fsw_posix_dir * fsw_posix_opendir(struct fsw_posix_volume *pvol, const char *path);
93 struct dirent * fsw_posix_readdir(struct fsw_posix_dir *dir);
94 void fsw_posix_rewinddir(struct fsw_posix_dir *dir);
95 int fsw_posix_closedir(struct fsw_posix_dir *dir);
96
97
98 #endif