Archived
1
0
This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
winamp/Src/nde/android/vfs.h

68 lines
1.4 KiB
C
Raw Normal View History

2024-09-24 12:54:57 +00:00
#ifndef __NDE_VFS_H
#define __NDE_VFS_H
#include <foundation/types.h>
#include <stdio.h>
//#define NDE_ALLOW_NONCACHED
/*
#ifdef NDE_ALLOW_NONCACHED
#ifndef NDE_NOWIN32FILEIO
#error NDE_ALLOW_NONCACHED at least for now requires NDE_NOWIN32FILEIO
#endif
#endif
*/
#define VFILE_INC 65536
#define VFS_READ 1
#define VFS_WRITE 2
#define VFS_SEEKEOF 4
#define VFS_CREATE 8
#define VFS_NEWCONTENT 16
#define VFS_MUSTEXIST 32
typedef struct {
uint8_t *data;
unsigned long ptr;
unsigned long filesize;
unsigned long maxsize;
char *filename;
char mode;
int cached;
int dirty;
#ifdef NDE_ALLOW_NONCACHED
FILE *rfile;
#endif
FILE *lockFile;
char lockname[1024];
int locks;
} VFILE;
#ifdef __cplusplus
extern "C" {
#endif
VFILE *Vfnew(const char *fl, const char *mode, int Cached);
VFILE *Vfopen(VFILE *f, const char *fl, const char *mode, int Cached);
size_t Vfread(void *ptr, size_t size, VFILE *buf);
void Vfseek(VFILE *fl, long i, int whence);
unsigned long Vftell(VFILE *fl);
void Vfclose(VFILE *fl);
void Vfdestroy(VFILE *fl); // benski> TODO:
void Vfwrite(const void *ptr, size_t size, VFILE *f);
int Vfeof(VFILE *fl);
int Vsync(VFILE *fl); // 1 on error updating
int Vflock(VFILE *fl, bool is_sync=true); // returns 0 on failure
void Vfunlock(VFILE *fl, bool is_sync=true);
#ifdef __cplusplus
}
#endif
#endif