summaryrefslogtreecommitdiffstats
path: root/src/server/image.h
diff options
context:
space:
mode:
authorSimon Rettberg2018-07-04 14:39:43 +0200
committerSimon Rettberg2018-07-04 14:39:43 +0200
commit053ca3b9a9601467d5ce30c56c3cea078c897f57 (patch)
tree29b60273e13684bb98b1badcd784b6f2b2e4d0f4 /src/server/image.h
parent[SERVER] cmake: Add config option for extra compiler opptions (diff)
downloaddnbd3-053ca3b9a9601467d5ce30c56c3cea078c897f57.tar.gz
dnbd3-053ca3b9a9601467d5ce30c56c3cea078c897f57.tar.xz
dnbd3-053ca3b9a9601467d5ce30c56c3cea078c897f57.zip
[SERVER] Refactor uplink/cache handling, improve crc checking
The cacheFd is now moved to the uplink data structure and will only be handled by the uplink thread. The integrity checker now supports checking all blocks of an image. This will be triggered automatically whenever a check for a single block failed. Also, if a crc check on startup fails, the image won't be discarded anymore, but rather a full check will be initiated. Furthermore, when calling image_updateCacheMap() on an image that was previously complete, the cache map will now be re-initialized, and a new uplink connection created.
Diffstat (limited to 'src/server/image.h')
-rw-r--r--src/server/image.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/server/image.h b/src/server/image.h
index dd8b818..4668eff 100644
--- a/src/server/image.h
+++ b/src/server/image.h
@@ -9,14 +9,12 @@ void image_serverStartup();
bool image_isComplete(dnbd3_image_t *image);
+bool image_isHashBlockComplete(const uint8_t * const cacheMap, const uint64_t block, const uint64_t fileSize);
+
void image_updateCachemap(dnbd3_image_t *image, uint64_t start, uint64_t end, const bool set);
void image_markComplete(dnbd3_image_t *image);
-void image_saveAllCacheMaps();
-
-bool image_saveCacheMap(dnbd3_image_t *image);
-
bool image_ensureOpen(dnbd3_image_t *image);
dnbd3_image_t* image_get(char *name, uint16_t revision, bool checkIfWorking);