34#include <YapEncoding.h>
41 struct timespec st_atimespec;
42 struct timespec st_mtimespec;
43 struct timespec st_ctimespec;
44 struct timespec st_birthtimespec;
52typedef enum vfs_flags {
57 VFS_HAS_PREFIX = 0x10,
58 VFS_HAS_SUFFIX = 0x20,
59 VFS_HAS_FUNCTION = 0x40
80 bool (*chDir)(
struct vfs *me,
const char *s);
82 void *(*open)(
struct vfs *,
const char *fname,
94 int64_t (*
seek)(
int sno, int64_t offset,
96 void *(*opendir)(
struct vfs *,
98 const char *(*nextdir)(
111 int (*writers)(
int ch,
int sno);
118extern VFS_t *GLOBAL_VFS;
120extern void init_android_stream(
void);
122extern void Yap_InitStdStream(
int sno,
unsigned int flags, FILE *file,
125static inline VFS_t *vfs_owner(
const char *fname) {
126 VFS_t *me = GLOBAL_VFS;
128 size_t sz0 = strlen(fname), sz;
132 if ((me->
vflags & VFS_HAS_PREFIX) && p) {
133 if (strstr(fname,me->
prefix)==fname)
136 if (me->
vflags & VFS_HAS_SUFFIX && (sz = strlen(me->suffix)) &&
137 (d = (sz0 - sz)) >= 0 && strcmp(fname + d, me->suffix) == 0) {
bool(* stat)(struct vfs *, const char *s, vfs_stat *)
close access a directory object
int64_t(* seek)(int sno, int64_t offset, int whence)
flush a stream
bool(* close)(int sno)
open an object
YAP_Term(* parsers)(int sno)
default file encoded
const char * prefix
the main flags describing the operation of the Fs
bool(* exists)(struct vfs *, const char *s)
verify whether is directory
void * priv
VFS dep endent area.
int(* peek_char)(int sno)
get an octet from the stream
int(* put_char)(int sno, int ch)
unget an octet from the stream
bool(* chdir)(struct vfs *, const char *s)
verify whether a file exists
int(* get_wchar)(int sno)
get an octet from the stream
int(* peek_wchar)(int sno)
unget an octet from the stream
void(* flush)(int sno)
output a character to the stream
int(* get_char)(int sno)
close the object
uintptr_t vflags
A text that explains the file system.
int(* put_wchar)(int sno, int ch)
output an octet to the stream
bool(* isdir)(struct vfs *, const char *s)
obtain size, age, permissions of a file
bool(* closedir)(void *d)
walk to the next entry in a directory object
encoding_t enc
set working directory (may be virtual)