fuse_dfs.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. #ifndef __FUSE_DFS_H__
  19. #define __FUSE_DFS_H__
  20. #define FUSE_USE_VERSION 26
  21. #include <stdio.h>
  22. #include <string.h>
  23. #include <errno.h>
  24. #include <assert.h>
  25. #include <strings.h>
  26. #include <syslog.h>
  27. #include <fuse.h>
  28. #include <fuse/fuse_opt.h>
  29. #include <sys/xattr.h>
  30. #include "config.h"
  31. //
  32. // Check if a path is in the mount option supplied protected paths.
  33. //
  34. int is_protected(const char *path);
  35. #undef INFO
  36. #define INFO(_fmt, ...) { \
  37. fprintf(stdout, "INFO %s:%d " _fmt "\n", \
  38. __FILE__, __LINE__, ## __VA_ARGS__); \
  39. syslog(LOG_INFO, "INFO %s:%d " _fmt "\n", \
  40. __FILE__, __LINE__, ## __VA_ARGS__); \
  41. }
  42. #undef DEBUG
  43. #define DEBUG(_fmt, ...) { \
  44. fprintf(stdout, "DEBUG %s:%d " _fmt "\n", \
  45. __FILE__, __LINE__, ## __VA_ARGS__); \
  46. syslog(LOG_DEBUG, "DEBUG %s:%d " _fmt "\n", \
  47. __FILE__, __LINE__, ## __VA_ARGS__); \
  48. }
  49. #undef ERROR
  50. #define ERROR(_fmt, ...) { \
  51. fprintf(stderr, "ERROR %s:%d " _fmt "\n", \
  52. __FILE__, __LINE__, ## __VA_ARGS__); \
  53. syslog(LOG_ERR, "ERROR %s:%d " _fmt "\n", \
  54. __FILE__, __LINE__, ## __VA_ARGS__); \
  55. }
  56. //#define DOTRACE
  57. #ifdef DOTRACE
  58. #define TRACE(x) { \
  59. DEBUG("TRACE %s", x); \
  60. }
  61. #define TRACE1(x,y) { \
  62. DEBUG("TRACE %s %s\n", x, y); \
  63. }
  64. #else
  65. #define TRACE(x) ;
  66. #define TRACE1(x,y) ;
  67. #endif
  68. #endif // __FUSE_DFS_H__