fuse_file_handle.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_FILE_HANDLE_H__
  19. #define __FUSE_FILE_HANDLE_H__
  20. #include <hdfs.h>
  21. #include <pthread.h>
  22. /**
  23. *
  24. * dfs_fh_struct is passed around for open files. Fuse provides a hook (the context)
  25. * for storing file specific data.
  26. *
  27. * 2 Types of information:
  28. * a) a read buffer for performance reasons since fuse is typically called on 4K chunks only
  29. * b) the hdfs fs handle
  30. *
  31. */
  32. typedef struct dfs_fh_struct {
  33. hdfsFile hdfsFH;
  34. char *buf;
  35. tSize bufferSize; //what is the size of the buffer we have
  36. off_t buffersStartOffset; //where the buffer starts in the file
  37. hdfsFS fs; // for reads/writes need to access as the real user
  38. pthread_mutex_t mutex;
  39. } dfs_fh;
  40. #endif