libfstools.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2014 John Crispin <blogic@openwrt.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License version 2.1
  6. * as published by the Free Software Foundation
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #ifndef _FS_STATE_H__
  14. #define _FS_STATE_H__
  15. #include <libubox/list.h>
  16. #include <libubox/blob.h>
  17. #include <libubox/ulog.h>
  18. #include <libubox/utils.h>
  19. struct volume;
  20. enum {
  21. FS_NONE,
  22. FS_SNAPSHOT,
  23. FS_JFFS2,
  24. FS_DEADCODE,
  25. FS_UBIFS,
  26. FS_F2FS,
  27. FS_EXT4,
  28. };
  29. enum fs_state {
  30. FS_STATE_UNKNOWN,
  31. FS_STATE_PENDING,
  32. FS_STATE_READY,
  33. __FS_STATE_LAST = FS_STATE_READY,
  34. };
  35. extern char const *extroot_prefix;
  36. extern int mount_extroot(void);
  37. extern int mount_snapshot(struct volume *v);
  38. extern int mount_overlay(struct volume *v);
  39. extern int mount_move(char *oldroot, char *newroot, char *dir);
  40. extern int pivot(char *new, char *old);
  41. extern int fopivot(char *rw_root, char *ro_root);
  42. extern int ramoverlay(void);
  43. extern int find_overlay_mount(char *overlay);
  44. extern char* find_mount(char *mp);
  45. extern char* find_mount_point(char *block, int root_only);
  46. extern int find_filesystem(char *fs);
  47. extern int jffs2_switch(struct volume *v);
  48. extern int handle_whiteout(const char *dir);
  49. extern void foreachdir(const char *dir, int (*cb)(const char*));
  50. extern void overlay_delete(const char *dir, bool keep_sysupgrade);
  51. enum fs_state fs_state_get(const char *dir);
  52. int fs_state_set(const char *dir, enum fs_state state);
  53. #endif