]>
code.delx.au - refind/blob - filesystems/test/fsw_posix.h
3 * POSIX user space host environment header.
7 * Copyright (c) 2006 Christoph Pfisterer
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
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
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.
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.
44 #include <sys/types.h>
49 * POSIX Host: Private per-volume structure.
52 struct fsw_posix_volume
{
53 struct fsw_volume
*vol
; //!< FSW volume structure
55 int fd
; //!< System file descriptor for data access
60 * POSIX Host: Private structure for an open file.
63 struct fsw_posix_file
{
64 struct fsw_posix_volume
*pvol
; //!< POSIX host volume structure
66 struct fsw_shandle shand
; //!< FSW handle for this file
71 * POSIX Host: Private structure for an open directory.
74 struct fsw_posix_dir
{
75 struct fsw_posix_volume
*pvol
; //!< POSIX host volume structure
77 struct fsw_shandle shand
; //!< FSW handle for this file
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
);
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
);
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
);