razf.h: added RAZF_STRUCT_SIZE macro
[samtools.git] / razf.h
diff --git a/razf.h b/razf.h
index f7e5097687359d02cf5019a642435a25ba781811..d0f93ecc09869af0d355e7e5b1fce3e59a472b42 100644 (file)
--- a/razf.h
+++ b/razf.h
 #include <stdio.h>
 #include "zlib.h"
 
+#ifdef _USE_KNETFILE
+#include "knetfile.h"
+#endif
+
 #if ZLIB_VERNUM < 0x1221
 #define _RZ_READONLY
 struct _gz_header_s;
@@ -76,7 +80,14 @@ typedef struct RandomAccessZFile  {
        char mode; /* 'w' : write mode; 'r' : read mode */
        int file_type;
        /* plain file or rz file, razf_read support plain file as input too, in this case, razf_read work as buffered fread */
+#ifdef _USE_KNETFILE
+    union {
+        knetFile *fpr;
+        int fpw;
+    } x;
+#else
        int filedes; /* the file descriptor */
+#endif
        z_stream *stream;
        ZBlockIndex *index;
        int64_t in, out, end, src_end;
@@ -116,6 +127,8 @@ extern "C" {
        uint64_t razf_tell2(RAZF *rz);
        int64_t razf_seek2(RAZF *rz, uint64_t voffset, int where);
 
+#define RAZF_STRUCT_SIZE (sizeof(RAZF) + sizeof(z_stream) + (RZ_BUFFER_SIZE * 2) + sizeof(ZBlockIndex) + sizeof(gz_header) + 7)
+
 #ifdef __cplusplus
 }
 #endif