summaryrefslogtreecommitdiffstats
path: root/src/fuse/cow.h
diff options
context:
space:
mode:
authorMichael Scherle2018-11-02 13:13:09 +0100
committerMichael Scherle2018-11-02 13:13:09 +0100
commit011d4e6ff76c76fa7c49540282dee0bafef54fac (patch)
treeac536daa70619f473d7b92854332d8dc7f84f8fb /src/fuse/cow.h
parentFixes and also included the Image merging programm (diff)
downloaddnbd3-011d4e6ff76c76fa7c49540282dee0bafef54fac.tar.gz
dnbd3-011d4e6ff76c76fa7c49540282dee0bafef54fac.tar.xz
dnbd3-011d4e6ff76c76fa7c49540282dee0bafef54fac.zip
cleaned up code and added improvements
- cleaned up code - using fixed size type variables in file - using types.h fixup macros - replaced write/read with pwrite/pread (except for 2 occurrences) - added create fuse callback
Diffstat (limited to 'src/fuse/cow.h')
-rw-r--r--src/fuse/cow.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/fuse/cow.h b/src/fuse/cow.h
index 298ce4e..7f2c6bb 100644
--- a/src/fuse/cow.h
+++ b/src/fuse/cow.h
@@ -2,7 +2,7 @@
* cow.h
*
* Created on: 22.08.2018
- * Author: michael
+ * Author: Michael Scherle
*/
#ifndef COW_H_
@@ -22,20 +22,29 @@ typedef struct cow_request{
struct cow_request *dependencies[6];
struct cow_request *myDependencies[6];
dnbd3_signal_t* signal;
-}cow_request;
+} cow_request;
-bool create_cow_file(char *cow_path, char *image_Name,uint64_t imageSize);
+typedef struct {
+ uint32_t version;
+ uint64_t imageSize;
+ uint32_t nameLenght;
+ uint32_t pageSize;
+} cow_metadata;
+
+
+bool cow_createFile(char *cow_path, char *image_Name,uint64_t imageSize);
bool createBigBlock(unsigned long id);
+int cow_read(char *buf, size_t size, off_t offset);
+uint64_t cow_loadFile( char *cow_path, uint64_t imageSize );
+
+int readBigBlock(long bigBlockId ,char *buf,size_t size, off_t offset);
void onClose();
cow_request getAccess(off_t offset,size_t size);
void closeAcccess(cow_request *request);
int write_cow(const char *data, size_t size, off_t offset);
-
int writeToBigBlock(unsigned long bigBlockId,const char *data, off_t offset,size_t size);
int getSmallBlockId(off_t offset);
-int cow_read(char *buf, size_t size, off_t offset);
-int readBigBlock(long bigBlockId ,char *buf,size_t size, off_t offset);
-void test();
+void test();
#endif /* COW_H_ */