You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.0 KiB

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