| /* ============================================================================= |
| * Copyright (c) 2010 Actifio Inc. All Rights Reserved |
| */ |
| |
| #ifndef _FC_BITMAP_H |
| #define _FC_BITMAP_H |
| |
| /* |
| * base path location |
| */ |
| #define FC_BITMAP_DIR_PATH "/act/pg/omd" |
| |
| /* |
| * File Magic includes version tick in 3rd byte. |
| * MQ bitmap header contains version tick in 4th byte |
| */ |
| #define FC_BITMAP_MAGIC 0x41430100 /* 'A' 'C' 1 0 */ |
| #define FC_BITMAP_MQ_MAGIC 0x46434201 /* 'F' 'C' 'B' 1 */ |
| |
| /* |
| * the offset to the MQ metadata, then |
| * the offset to the data itself. |
| */ |
| #define FC_BITMAP_MQ_HDR_OFFSET 256 |
| #define FC_BITMAP_BITMAP_OFFSET 512 |
| |
| /* flags field */ |
| #define FC_BITMAP_COMPOSED 0x1 /* internal composition file */ |
| #define FC_BITMAP_RETRIEVED 0x2 /* bitmap retrieved from MQ */ |
| #define FC_BITMAP_IS_HC 0x4 /* This is a heavy weight clone node */ |
| #define FC_BITMAP_COUNT_PRESENT 0x8 /* This field was added in 5.1, so its not present in earlier bitmaps */ |
| |
| #pragma pack(push) /* push current alignment to stack */ |
| #pragma pack(1) /* align to 1 byte boundary for disk output */ |
| |
| /* |
| * on disk structure of the header. Makes 256 bytes |
| */ |
| typedef struct _fc_bitmap_hdr { |
| uint8_t magic[4]; /* magic header A C 1 0 */ |
| uint8_t vuid[16]; /* src Vdisk UID */ |
| char vdname[16]; /* src Vdisk name */ |
| char fcname[16]; /* target Vdisk name */ |
| char fcmap[16]; /* src-target FC map */ |
| char fchint[16]; /* prior target in list */ |
| struct timeval stime; /* start of this FC */ |
| struct timeval etime; /* "end": bitmap dumped */ |
| uint32_t fcmapid; /* ID for above FC map */ |
| char ddname[80]; /* Dedup hint passed in */ |
| uint32_t flags; /* Option flags */ |
| uint64_t bitcount; /* # bits set in map. Valid only if FC_BITMAP_COUNT_PRESENT is set */ |
| |
| uint64_t compressed_size; /* compressed size for holemap files, not valid for bitmap files */ |
| uint8_t is_compressed; /* 1 : compressed, 0 : uncompressed */ |
| |
| uint8_t reserved[35]; |
| } fc_bitmap_hdr_t; |
| |
| // If its a heavy wieight clone its a lot like a _fc_bitmap_hdr |
| // The bitmap read and write routines can read and write these |
| // because the interesting fields are alligned identically. |
| // One of our goals was to allow the easy conversion of a fc-xxx file to a hc-xxx file. |
| // Its possible this is a maintenace issue down the read in |
| // which case separate routines to read and write should be written. |
| // |
| // This is implicitly a union with fc_bitmap_hdr_t. |
| typedef struct _hc_bitmap_hdr { |
| uint8_t magic[4]; /* magic header A C 1 0 */ |
| uint8_t vuid[16]; /* src Vdisk UID. Yourself */ |
| char vdname[16]; /* src Vdisk nam. Yourself vm-nnnnnnnnnnnn */ |
| char fcname[16]; /* target Vdisk name Yourself hc-nnnnnnnnnnn */ |
| char fcmap[16]; /* src-target FC map: 0, or INVALID_BITMAP, or EMPTY_BITMAP */ |
| |
| char unused_fchint[16]; /* prior target in list */ |
| struct timeval unused_stime;/* start of this FC */ |
| struct timeval unused_etime;/* "end": bitmap dumped */ |
| uint32_t unused_fcmapid; /* Must be INVALID_FCMAPID */ |
| |
| uint8_t hc_parent_vuid[16]; |
| char hc_parent_fcname[16]; |
| char unused_ddname[80-32]; /* Dedup hint passed in */ |
| |
| uint32_t flags; /* Option flags */ |
| uint8_t reserved[52]; |
| } hc_bitmap_hdr_t; |
| /* |
| * The bitmap metadata as returned from the call, |
| * with additional magic. |
| */ |
| typedef struct _fc_bitmap_mq_hdr { |
| uint8_t bitmap_mq_magic[4]; |
| uint64_t vdisk_size_lbas; // in the case of an hc- node, these only need to be populated if a real map is present. In which case they are populated from the source bitmap which has them. |
| uint32_t grain_size_lbas; |
| uint64_t bitmap_size_bytes; |
| } fc_bitmap_mq_hdr_t; |
| |
| #if 0 |
| typedef struct _fc_bitmap_file_hdr { |
| fc_bitmap_hdr_t file_hdr; |
| fc_bitmap_mq_hdr_t svc_hdr; |
| uint8_t reserved[232]; |
| } fc_bitmap_file_hdr_t; |
| #endif |
| |
| #pragma pack(pop) /* restore previous */ |
| |
| #endif /* _FC_BITMAP_H */ |