packvfs
view src/pvfs.h @ 3:ef6c1472607f
jesus fucking christ that was easy... written a test prog "zipcat" to try out
zlib's contrib library "minizip", to list and read files out of zip archives
directly...
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 04 Nov 2013 06:46:17 +0200 |
parents | df5e9ee65a50 |
children |
line source
1 #ifndef PVFS_H_
2 #define PVFS_H_
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <errno.h>
8 typedef struct PVFS_FILE PVFS_FILE;
9 typedef struct PVFS_DIR PVFS_DIR;
11 struct pvfs_dirent {
12 char d_name[256];
13 };
15 struct pvfs_stat {
16 unsigned int st_mode;
17 unsigned long st_size;
18 };
20 extern int pvfs_errno;
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
26 /* mount some target (which can be a directory or a pack filename) */
27 int pvfs_mount(const char *mntpoint, const char *target);
28 int pvfs_umount(const char *mntpoint);
30 int pvfs_chdir(const char *path);
31 int pvfs_mkdir(const char *path, unsigned int mode); /* XXX mode is ignored */
33 PVFS_FILE *pvfs_fopen(const char *fname, const char *mode);
34 int pvfs_fclose(PVFS_FILE *fp);
36 int pvfs_fseek(PVFS_FILE *fp, long offset, int whence);
37 long pvfs_ftell(PVFS_FILE *fp);
38 void pvfs_rewind(PVFS_FILE *fp);
40 size_t pvfs_fread(void *buf, size_t size, size_t nitems, PVFS_FILE *fp);
41 size_t pvfs_fwrite(void *buf, size_t size, size_t nitems, PVFS_FILE *fp);
43 int pvfs_fgetc(PVFS_FILE *fp);
44 int pvfs_fputc(int c, PVFS_FILE *fp);
46 char *pvfs_fgets(char *buf, int size, PVFS_FILE *fp);
47 int pvfs_fputs(char *buf, PVFS_FILE *fp);
49 int pvfs_fscanf(PVFS_FILE *fp, const char *fmt, ...);
50 int pvfs_vfscanf(PVFS_FILE *fp, const char *fmt, va_list ap);
51 int pvfs_fprintf(PVFS_FILE *fp, const char *fmt, ...);
52 int pvfs_vfprintf(PVFS_FILE *fp, const char *fmt, va_list ap);
54 void pvfs_clearerr(PVFS_FILE *fp);
55 int pvfs_feof(PVFS_FILE *fp);
56 int pvfs_ferror(PVFS_FILE *fp);
58 PVFS_DIR *pvfs_opendir(const char *dirname);
59 int pvfs_closedir(PVFS_DIR *dir);
60 struct pvfs_dirent *pvfs_readdir(PVFS_DIR *dir);
61 void pvfs_rewinddir(PVFS_DIR *dir);
63 int pvfs_stat(const char *path, struct pvfs_stat *buf);
65 #ifdef __cplusplus
66 }
67 #endif
69 #endif /* PVFS_H_ */