file_utils.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*-------------------------------------------------------------------------
  2. *
  3. * Assorted utility functions to work on files.
  4. *
  5. *
  6. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  7. * Portions Copyright (c) 1994, Regents of the University of California
  8. *
  9. * src/include/common/file_utils.h
  10. *
  11. *-------------------------------------------------------------------------
  12. */
  13. #ifndef FILE_UTILS_H
  14. #define FILE_UTILS_H
  15. #include <dirent.h>
  16. typedef enum PGFileType
  17. {
  18. PGFILETYPE_ERROR,
  19. PGFILETYPE_UNKNOWN,
  20. PGFILETYPE_REG,
  21. PGFILETYPE_DIR,
  22. PGFILETYPE_LNK
  23. } PGFileType;
  24. #ifdef FRONTEND
  25. extern int fsync_fname(const char *fname, bool isdir);
  26. extern void fsync_pgdata(const char *pg_data, int serverVersion);
  27. extern void fsync_dir_recurse(const char *dir);
  28. extern int durable_rename(const char *oldfile, const char *newfile);
  29. extern int fsync_parent_path(const char *fname);
  30. #endif
  31. extern PGFileType get_dirent_type(const char *path,
  32. const struct dirent *de,
  33. bool look_through_symlinks,
  34. int elevel);
  35. #endif /* FILE_UTILS_H */