packvfs
diff src/pvfs.h @ 0:df5e9ee65a50
packvfs initial commit
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 02 Aug 2013 06:03:38 +0300 |
parents | |
children | a0b3b6682d92 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/pvfs.h Fri Aug 02 06:03:38 2013 +0300 1.3 @@ -0,0 +1,69 @@ 1.4 +#ifndef PVFS_H_ 1.5 +#define PVFS_H_ 1.6 + 1.7 +#include <stdio.h> 1.8 +#include <stdlib.h> 1.9 +#include <errno.h> 1.10 + 1.11 +typedef struct PVFS_FILE PVFS_FILE; 1.12 +typedef struct PVFS_DIR PVFS_DIR; 1.13 + 1.14 +struct pvfs_dirent { 1.15 + char d_name[256]; 1.16 +}; 1.17 + 1.18 +struct pvfs_stat { 1.19 + unsigned int st_mode; 1.20 + unsigned long st_size; 1.21 +}; 1.22 + 1.23 +extern int pvfs_errno; 1.24 + 1.25 +#ifdef __cplusplus 1.26 +extern "C" { 1.27 +#endif 1.28 + 1.29 +/* mount some target (which can be a directory or a pack filename) */ 1.30 +int pvfs_mount(const char *mntpoint, const char *target); 1.31 +int pvfs_umount(const char *mntpoint); 1.32 + 1.33 +int pvfs_chdir(const char *path); 1.34 +int pvfs_mkdir(const char *path, unsigned int mode); /* XXX mode is ignored */ 1.35 + 1.36 +PVFS_FILE *pvfs_fopen(const char *fname, const char *mode); 1.37 +int pvfs_fclose(PVFS_FILE *fp); 1.38 + 1.39 +int pvfs_fseek(PVFS_FILE *fp, long offset, int whence); 1.40 +long pvfs_ftell(PVFS_FILE *fp); 1.41 +void pvfs_rewind(PVFS_FILE *fp); 1.42 + 1.43 +size_t pvfs_fread(void *buf, size_t size, size_t nitems, PVFS_FILE *fp); 1.44 +size_t pvfs_write(void *buf, size_t size, size_t nitems, PVFS_FILE *fp); 1.45 + 1.46 +int pvfs_fgetc(PVFS_FILE *fp); 1.47 +int pvfs_fputc(int c, PVFS_FILE *fp); 1.48 + 1.49 +char *pvfs_fgets(char *buf, int size, PVFS_FILE *fp); 1.50 +int pvfs_fputs(char *buf, PVFS_FILE *fp); 1.51 + 1.52 +int pvfs_fscanf(PVFS_FILE *fp, const char *fmt, ...); 1.53 +int pvfs_vfscanf(PVFS_FILE *fp, const char *fmt, va_list ap); 1.54 +int pvfs_fprintf(PVFS_FILE *fp, const char *fmt, ...); 1.55 +int pvfs_vfprintf(PVFS_FILE *fp, const char *fmt, va_list ap); 1.56 + 1.57 +void pvfs_clearerr(PVFS_FILE *fp); 1.58 +int pvfs_feof(PVFS_FILE *fp); 1.59 +int pvfs_ferror(PVFS_FILE *fp); 1.60 + 1.61 +PVFS_DIR *pvfs_opendir(const char *dirname); 1.62 +int pvfs_closedir(PVFS_DIR *dir); 1.63 +struct pvfs_dirent *pvfs_readdir(PVFS_DIR *dir); 1.64 +void pvfs_rewinddir(PVFS_DIR *dir); 1.65 + 1.66 +int pvfs_stat(const char *path, struct pvfs_stat *buf); 1.67 + 1.68 +#ifdef __cplusplus 1.69 +} 1.70 +#endif 1.71 + 1.72 +#endif /* PVFS_H_ */