ShingledFS 2.0
SMR-AwareFUSE-basedFileSystem
|
00001 00010 #ifndef __BUFFERCACHE_H_ 00011 #define __BUFFERCACHE_H_ 00012 00013 #include <pthread.h> 00014 00015 00016 00017 /* ====================== */ 00018 /* -- Type Definitions -- */ 00019 /* ====================== */ 00020 00024 typedef enum { 00025 ST_LOADING, 00026 ST_LOADED, 00027 ST_STORING, 00028 ST_STORED 00029 }bc_state_t; 00030 00031 00035 typedef enum { 00036 OP_LOAD, 00037 OP_STORE 00038 }bc_operation_t; 00039 00040 00077 typedef struct bc_file{ 00078 char path[PATH_MAX]; 00079 int inode; 00080 int fd; 00081 int fd_xattr; 00082 int deleted; 00083 int ref_count; 00084 int dirty; 00085 bc_state_t state; 00086 00087 pthread_mutex_t mutex; 00088 pthread_cond_t condvar; 00089 00090 struct bc_file *prev; 00091 struct bc_file *next; 00092 }bc_file_t; 00093 00094 00102 typedef struct bc_request{ 00103 bc_file_t *file; 00104 bc_operation_t op; 00105 00106 struct bc_request *next; 00107 } bc_request_t; 00108 00109 00110 00111 /* ========================= */ 00112 /* -- Function Prototypes -- */ 00113 /* ========================= */ 00114 00115 void bc_init(size_t cache_size); 00116 bc_file_t *bc_open(const char *path); 00117 void bc_close(bc_file_t *file); 00118 int bc_unlink(const char *path); 00119 int bc_rename(const char *path, const char *path_new); 00120 void bc_clean(); 00121 void bc_generate_tmpFS_path(char *path_out, const char *path_in); 00122 bc_file_t *bc_file_search_path(const char *path); 00123 void bc_clean(); 00124 00125 00126 00127 #endif /* __BUFFERCACHE_H_ */