fuse_dfs.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 <syslog.h>
  26. #include <fuse.h>
  27. #include <fuse/fuse_opt.h>
  28. #include <sys/xattr.h>
  29. #include "config.h"
  30. //
  31. // Check if a path is in the mount option supplied protected paths.
  32. //
  33. int is_protected(const char *path);
  34. #undef INFO
  35. #define INFO(_fmt, ...) { \
  36. fprintf(stdout, "INFO %s:%d " _fmt "\n", \
  37. __FILE__, __LINE__, ## __VA_ARGS__); \
  38. syslog(LOG_INFO, "INFO %s:%d " _fmt "\n", \
  39. __FILE__, __LINE__, ## __VA_ARGS__); \
  40. }
  41. #undef DEBUG
  42. #define DEBUG(_fmt, ...) { \
  43. fprintf(stdout, "DEBUG %s:%d " _fmt "\n", \
  44. __FILE__, __LINE__, ## __VA_ARGS__); \
  45. syslog(LOG_DEBUG, "DEBUG %s:%d " _fmt "\n", \
  46. __FILE__, __LINE__, ## __VA_ARGS__); \
  47. }
  48. #undef ERROR
  49. #define ERROR(_fmt, ...) { \
  50. fprintf(stderr, "ERROR %s:%d " _fmt "\n", \
  51. __FILE__, __LINE__, ## __VA_ARGS__); \
  52. syslog(LOG_ERR, "ERROR %s:%d " _fmt "\n", \
  53. __FILE__, __LINE__, ## __VA_ARGS__); \
  54. }
  55. //#define DOTRACE
  56. #ifdef DOTRACE
  57. #define TRACE(x) { \
  58. DEBUG("TRACE %s", x); \
  59. }
  60. #define TRACE1(x,y) { \
  61. DEBUG("TRACE %s %s\n", x, y); \
  62. }
  63. #else
  64. #define TRACE(x) ;
  65. #define TRACE1(x,y) ;
  66. #endif
  67. #endif // __FUSE_DFS_H__