2014-05-13 00:41:46 +08:00
|
|
|
/*
|
2016-01-15 05:50:22 +08:00
|
|
|
Copyright (c) 2016, Antonio SJ Musumeci <trapexit@spawn.link>
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
2014-05-13 00:41:46 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __FS_HPP__
|
|
|
|
#define __FS_HPP__
|
|
|
|
|
2016-07-11 00:44:29 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2014-05-13 00:41:46 +08:00
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
2015-06-23 11:22:51 +08:00
|
|
|
|
2014-05-13 00:41:46 +08:00
|
|
|
namespace fs
|
|
|
|
{
|
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
|
|
|
|
2016-02-19 07:48:11 +08:00
|
|
|
bool exists(const string &path,
|
|
|
|
struct stat &st);
|
|
|
|
bool exists(const string &path);
|
|
|
|
|
2016-03-01 11:58:13 +08:00
|
|
|
bool info(const string &path,
|
|
|
|
bool &readonly,
|
2016-07-11 00:44:29 +08:00
|
|
|
uint64_t &spaceavail,
|
|
|
|
uint64_t &spaceused);
|
2016-03-01 11:58:13 +08:00
|
|
|
|
|
|
|
bool readonly(const string &path);
|
2016-02-19 07:48:11 +08:00
|
|
|
|
2016-03-01 11:58:13 +08:00
|
|
|
bool spaceavail(const string &path,
|
2016-07-11 00:44:29 +08:00
|
|
|
uint64_t &spaceavail);
|
2016-02-29 20:00:35 +08:00
|
|
|
|
2016-05-08 02:05:38 +08:00
|
|
|
bool spaceused(const string &path,
|
2016-07-11 00:44:29 +08:00
|
|
|
uint64_t &spaceavail);
|
2016-05-08 02:05:38 +08:00
|
|
|
|
2015-02-08 07:27:47 +08:00
|
|
|
void findallfiles(const vector<string> &srcmounts,
|
2016-01-30 05:54:39 +08:00
|
|
|
const char *fusepath,
|
2015-02-08 07:27:47 +08:00
|
|
|
vector<string> &paths);
|
|
|
|
|
2015-09-16 06:49:18 +08:00
|
|
|
int findonfs(const vector<string> &srcmounts,
|
2016-01-30 05:54:39 +08:00
|
|
|
const char *fusepath,
|
2015-09-16 06:49:18 +08:00
|
|
|
const int fd,
|
|
|
|
string &basepath);
|
2014-05-28 09:21:45 +08:00
|
|
|
|
2014-08-04 03:50:28 +08:00
|
|
|
void glob(const vector<string> &patterns,
|
|
|
|
vector<string> &strs);
|
2015-09-07 06:24:36 +08:00
|
|
|
|
|
|
|
void realpathize(vector<string> &strs);
|
2015-09-16 06:49:18 +08:00
|
|
|
|
|
|
|
int getfl(const int fd);
|
|
|
|
|
|
|
|
int mfs(const vector<string> &srcs,
|
2016-07-11 00:44:29 +08:00
|
|
|
const uint64_t minfreespace,
|
2015-09-16 06:49:18 +08:00
|
|
|
string &path);
|
2014-05-13 00:41:46 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __FS_HPP__
|