1 #ifndef __ARC_FILEACCESS_H__ 2 #define __ARC_FILEACCESS_H__ 50 bool fa_mkdir(
const std::string& path, mode_t mode);
57 bool fa_mkdirp(
const std::string& path, mode_t mode);
62 bool fa_link(
const std::string& oldpath,
const std::string& newpath);
67 bool fa_softlink(
const std::string& oldpath,
const std::string& newpath);
74 bool fa_copy(
const std::string& oldpath,
const std::string& newpath, mode_t mode);
79 bool fa_rename(
const std::string& oldpath,
const std::string& newpath);
84 bool fa_chmod(
const std::string& path,mode_t mode);
89 bool fa_stat(
const std::string& path,
struct stat& st);
94 bool fa_lstat(
const std::string& path,
struct stat& st);
114 bool fa_readlink(
const std::string& path, std::string& linkpath);
129 bool fa_rmdir(
const std::string& path);
156 bool fa_open(
const std::string& path,
int flags, mode_t mode);
169 bool fa_mkstemp(std::string& path, mode_t mode);
174 off_t
fa_lseek(off_t offset,
int whence);
179 ssize_t
fa_read(
void* buf,
size_t size);
184 ssize_t
fa_write(
const void* buf,
size_t size);
189 ssize_t
fa_pread(
void* buf,
size_t size,off_t offset);
194 ssize_t
fa_pwrite(
const void* buf,
size_t size,off_t offset);
198 operator bool(
void) {
return (file_access_ != NULL); };
200 bool operator!(
void) {
return (file_access_ == NULL); };
241 void SetMin(
unsigned int val);
243 void SetMax(
unsigned int val);
248 std::list<FileAccess*> fas_;
249 void KeepRange(
void);
254 #endif // __ARC_FILEACCESS_H__ ssize_t fa_read(void *buf, size_t size)
Read from open file.
Arc namespace contains all core ARC classes.
Definition: ArcConfig.h:11
bool fa_lstat(const std::string &path, struct stat &st)
Stat symbolic link or file.
bool fa_open(const std::string &path, int flags, mode_t mode)
Open file. Only one file may be open at a time.
ssize_t fa_pread(void *buf, size_t size, off_t offset)
Read from open file at specified offset.
bool fa_rmdir(const std::string &path)
Remove directory (if empty).
bool fa_close(void)
Close open file.
static void testtune(void)
Special method for using in unit tests.
bool fa_mkstemp(std::string &path, mode_t mode)
Open new temporary file for writing.
off_t fa_lseek(off_t offset, int whence)
Change current position in open file.
FileAccess(void)
New FileAccess object.
void Release(FileAccess *fa)
Returns object into container.
bool ping(void)
Check if communication with proxy works.
bool fa_readlink(const std::string &path, std::string &linkpath)
Read content of symbolic link.
FileAccess * Acquire(void)
Get object from container.
~FileAccessContainer(void)
Destroys container and all stored objects.
bool fa_chmod(const std::string &path, mode_t mode)
Change mode of filesystem object.
static FileAccess * Acquire(void)
Constructor which takes already existing object from global cache.
static void Release(FileAccess *fa)
Destructor which returns object into global cache.
bool fa_link(const std::string &oldpath, const std::string &newpath)
Create hard link.
bool fa_readdir(std::string &name)
Read relative name of object in open directory.
bool fa_rename(const std::string &oldpath, const std::string &newpath)
Rename file.
bool fa_unlink(const std::string &path)
Remove file.
ssize_t fa_pwrite(const void *buf, size_t size, off_t offset)
Write to open file at specified offset.
bool fa_mkdirp(const std::string &path, mode_t mode)
Make a directory and assign it specified mode.
bool fa_setuid(int uid, int gid)
Modify user uid and gid.
bool operator!(void)
Returns true if this instance is not in useful condition.
Definition: FileAccess.h:200
Container for shared FileAccess objects.
Definition: FileAccess.h:223
FileAccessContainer(void)
Creates container with number of stored objects between 1 and 10.
~FileAccess(void)
Shuts down any spawned executable.
int geterrno()
Get errno of last operation. Every operation resets errno.
Definition: FileAccess.h:196
bool fa_ftruncate(off_t length)
Truncate open file.
bool fa_rmdirr(const std::string &path)
Remove directory recursively.
bool fa_fstat(struct stat &st)
Stat open file.
void SetMin(unsigned int val)
Adjust minimal number of stored objects.
Defines interface for accessing filesystems.
Definition: FileAccess.h:27
void SetMax(unsigned int val)
Adjust maximal number of stored objects.
bool fa_stat(const std::string &path, struct stat &st)
Stat file.
bool fa_softlink(const std::string &oldpath, const std::string &newpath)
Create symbolic (aka soft) link.
bool fa_copy(const std::string &oldpath, const std::string &newpath, mode_t mode)
Copy file to new location.
bool fa_remove(const std::string &path)
Remove file system object.
bool fa_closedir(void)
Close open directory.
ssize_t fa_write(const void *buf, size_t size)
Write to open file.
bool fa_mkdir(const std::string &path, mode_t mode)
Make a directory and assign it specified mode.
bool fa_opendir(const std::string &path)
Open directory.
This class runs an external executable.
Definition: Run.h:19
off_t fa_fallocate(off_t length)
Allocate disk space for open file.