fuse_file_handle.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. struct hdfsConn;
  23. /**
  24. *
  25. * dfs_fh_struct is passed around for open files. Fuse provides a hook (the context)
  26. * for storing file specific data.
  27. *
  28. * 2 Types of information:
  29. * a) a read buffer for performance reasons since fuse is typically called on 4K chunks only
  30. * b) the hdfs fs handle
  31. *
  32. */
  33. typedef struct dfs_fh_struct {
  34. hdfsFile hdfsFH;
  35. struct hdfsConn *conn;
  36. char *buf;
  37. tSize bufferSize; //what is the size of the buffer we have
  38. off_t buffersStartOffset; //where the buffer starts in the file
  39. pthread_mutex_t mutex;
  40. } dfs_fh;
  41. #endif