summaryrefslogtreecommitdiffstats
path: root/src/server/image.h
diff options
context:
space:
mode:
authorsr2013-07-11 19:43:24 +0200
committersr2013-07-11 19:43:24 +0200
commitf10e60d3c16252cd448cc394ee2eb324e8a45572 (patch)
tree2d5ba7fcd0b38daf4cbd31251ee94b76d4430414 /src/server/image.h
parentRewrite in progres.... (diff)
downloaddnbd3-f10e60d3c16252cd448cc394ee2eb324e8a45572.tar.gz
dnbd3-f10e60d3c16252cd448cc394ee2eb324e8a45572.tar.xz
dnbd3-f10e60d3c16252cd448cc394ee2eb324e8a45572.zip
Rewrite still in progres....
Diffstat (limited to 'src/server/image.h')
-rw-r--r--src/server/image.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/server/image.h b/src/server/image.h
index 6eb2b15..a27125b 100644
--- a/src/server/image.h
+++ b/src/server/image.h
@@ -1,7 +1,32 @@
#ifndef _IMAGE_H_
#define _IMAGE_H_
-#include "server.h"
+
+typedef struct
+{
+ int fd;
+} dnbd3_connection_t;
+
+/**
+ * Image struct. An image path could be something like
+ * /mnt/images/rz/zfs/Windows7 ZfS.vmdk.1
+ * and the lower_name would then be
+ * rz/zfs/windows7 zfs.vmdk
+ */
+typedef struct
+{
+ char *path; // absolute path of the image
+ char *lower_name; // relative path, all lowercase, minus revision ID
+ uint8_t *cache_map; // cache map telling which parts are locally cached, NULL if complete
+ uint32_t *crc32; // list of crc32 checksums for each 16MiB block in image
+ dnbd3_connection_t *uplink; // pointer to a server connection
+ uint64_t filesize; // size of image
+ int rid; // revision of image
+ int users; // clients currently using this image
+ time_t atime; // last access time
+ char working; // TRUE if image exists and completeness is == 100% or a working upstream proxy is connected
+ pthread_spinlock_t lock;
+} dnbd3_image_t;
int image_is_complete(dnbd3_image_t *image);