2019-11-24 14:20:08 +01:00
|
|
|
/*
|
|
|
|
|
|
|
|
Copyright (C) 2008 Joseph Jordan <joe.ftpii@psychlaw.com.au>
|
|
|
|
This work is derived from Daniel Ehlers' <danielehlers@mindeye.net> srg_vrt branch.
|
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied warranty.
|
|
|
|
In no event will the authors be held liable for any damages arising from
|
|
|
|
the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1.The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software in a
|
|
|
|
product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
|
|
|
|
2.Altered source versions must be plainly marked as such, and must not be
|
|
|
|
misrepresented as being the original software.
|
|
|
|
|
|
|
|
3.This notice may not be removed or altered from any source distribution.
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifndef _VRT_H_
|
|
|
|
#define _VRT_H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2022-02-04 14:33:59 +01:00
|
|
|
extern "C" {
|
2019-11-24 14:20:08 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/dirent.h>
|
|
|
|
|
2021-09-24 19:49:11 +02:00
|
|
|
typedef struct {
|
|
|
|
DIR *dir;
|
|
|
|
char *path;
|
|
|
|
uint8_t virt_root;
|
|
|
|
uint8_t virtual_fs;
|
|
|
|
uint8_t virtual_fs_vol;
|
2019-11-24 14:20:08 +01:00
|
|
|
} DIR_P;
|
|
|
|
|
|
|
|
char *to_real_path(char *virtual_cwd, char *virtual_path);
|
|
|
|
|
|
|
|
FILE *vrt_fopen(char *cwd, char *path, char *mode);
|
2021-09-24 19:49:11 +02:00
|
|
|
|
2019-11-24 14:20:08 +01:00
|
|
|
int vrt_stat(char *cwd, char *path, struct stat *st);
|
2021-09-24 19:49:11 +02:00
|
|
|
|
2019-11-24 14:20:08 +01:00
|
|
|
int vrt_chdir(char *cwd, char *path);
|
2021-09-24 19:49:11 +02:00
|
|
|
|
2019-11-24 14:20:08 +01:00
|
|
|
int vrt_unlink(char *cwd, char *path);
|
2021-09-24 19:49:11 +02:00
|
|
|
|
2019-11-24 14:20:08 +01:00
|
|
|
int vrt_mkdir(char *cwd, char *path, mode_t mode);
|
2021-09-24 19:49:11 +02:00
|
|
|
|
2019-11-24 14:20:08 +01:00
|
|
|
int vrt_rename(char *cwd, char *from_path, char *to_path);
|
2021-09-24 19:49:11 +02:00
|
|
|
|
2019-11-24 14:20:08 +01:00
|
|
|
DIR_P *vrt_opendir(char *cwd, char *path);
|
2021-09-24 19:49:11 +02:00
|
|
|
|
2019-11-24 14:20:08 +01:00
|
|
|
struct dirent *vrt_readdir(DIR_P *iter);
|
2021-09-24 19:49:11 +02:00
|
|
|
|
2019-11-24 14:20:08 +01:00
|
|
|
int vrt_closedir(DIR_P *iter);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _VRT_H_ */
|