csync_exclude.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * libcsync -- a library to sync a directory with another
  3. *
  4. * Copyright (c) 2008-2013 by Andreas Schneider <asn@cryptomilk.org>
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with this library; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef _CSYNC_EXCLUDE_H
  21. #define _CSYNC_EXCLUDE_H
  22. enum csync_exclude_type_e {
  23. CSYNC_NOT_EXCLUDED = 0,
  24. CSYNC_FILE_SILENTLY_EXCLUDED,
  25. CSYNC_FILE_EXCLUDE_AND_REMOVE,
  26. CSYNC_FILE_EXCLUDE_LIST,
  27. CSYNC_FILE_EXCLUDE_INVALID_CHAR,
  28. CSYNC_FILE_EXCLUDE_TRAILING_SPACE,
  29. CSYNC_FILE_EXCLUDE_LONG_FILENAME,
  30. CSYNC_FILE_EXCLUDE_HIDDEN,
  31. CSYNC_FILE_EXCLUDE_STAT_FAILED
  32. };
  33. typedef enum csync_exclude_type_e CSYNC_EXCLUDE_TYPE;
  34. #ifdef WITH_UNIT_TESTING
  35. int _csync_exclude_add(c_strlist_t **inList, const char *string);
  36. #endif
  37. /**
  38. * @brief Load exclude list
  39. *
  40. * @param ctx The context of the synchronizer.
  41. * @param fname The filename to load.
  42. *
  43. * @return 0 on success, -1 if an error occurred with errno set.
  44. */
  45. int csync_exclude_load(const char *fname, c_strlist_t **list);
  46. /**
  47. * @brief Check if the given path should be excluded in a traversal situation.
  48. *
  49. * It does only part of the work that csync_excluded does because it's assumed
  50. * that all leading directories have been run through csync_excluded_traversal()
  51. * before. This can be significantly faster.
  52. *
  53. * That means for '/foo/bar/file' only ('/foo/bar/file', 'file') is checked
  54. * against the exclude patterns.
  55. *
  56. * @param ctx The synchronizer context.
  57. * @param path The patch to check.
  58. *
  59. * @return 2 if excluded and needs cleanup, 1 if excluded, 0 if not.
  60. */
  61. CSYNC_EXCLUDE_TYPE csync_excluded_traversal(c_strlist_t *excludes, const char *path, int filetype);
  62. /**
  63. * @brief csync_excluded_no_ctx
  64. * @param excludes
  65. * @param path
  66. * @param filetype
  67. * @return
  68. */
  69. CSYNC_EXCLUDE_TYPE csync_excluded_no_ctx(c_strlist_t *excludes, const char *path, int filetype);
  70. #endif /* _CSYNC_EXCLUDE_H */
  71. /**
  72. * @brief Checks if filename is considered reserved by Windows
  73. * @param file_name filename
  74. * @return true if file is reserved, false otherwise
  75. */
  76. bool csync_is_windows_reserved_word(const char *file_name);
  77. /* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */