*/
struct lafs_dev {
char idtag[16]; /* LaFS-DeviceBlock */
- char version[16]; /* number space options */
u8 uuid[16];
u32 checksum;
u32 seq;
+ u32 version; /* LAFS_DEV_VERS == 1 */
+ u32 pad0;
u64 ctime;
u64 start, size; /* in array address space (array block)*/
u32 segment_offset; /* offset of first segment (device byte) */
u32 segment_count;
u32 usage_inum; /* inum of segment usage file */
- u32 level;
+ char options[512]; /* Space separated, nul terminated, Cap for
+ * read-only-if-you-don't-understand
+ */
} __attribute__((packed));
-#define LAFS_DEVBLK_SIZE 1024
+#define LAFS_DEVBLK_SIZE 1024
+#define LAFS_DEV_VERS 1
struct lafs_state {
char idtag[16]; /* LaFS-State-Block */
- char version[16]; /* number space options */
+ u8 uuid[16];
+ u8 alt_uuid[16]; /* allows sharing of read-only devices
+ * between arrays
+ */
u32 checksum;
+ u32 version; /* LAFS_STATE_VERS */
u32 seq;
- u8 uuid[16];
- u32 levels;
+ u32 alt_seq; /* seq number of the alt_uuid devices */
u32 devices;
+ u32 pad0;
+
u32 nonlog_offset; /* offset into above segment of next non-logged
* block to allocate
*/
u16 nextyouth;
u32 maxsnapshot;
+ u64 inconsistencies;/* bit set of discovered inconsistency types.
+ * If any unknown bits are set, an fsck is needed
+ * for writing.
+ * If known bits are set, behaviour is dependant
+ * on those bits.
+ */
+
u64 checkpointcluster; /* (array block) */
+ char options[512]; /* Spare separated, nul terminated. */
u64 root_inodes[0]; /* (array block) */
} __attribute__((packed));
+#define LAFS_STATE_VERS 1
struct descriptor {
u32 block_num; /* (file block) */
#define HASH_BITS 8
struct lafs {
- char version[16];
uint8_t uuid[16];
uint32_t seq;
int devices;
/* This are only used between loading from storage
* and including in the array
*/
- char version[16];
uint8_t uuid[16];
int blockbits;
int statesize;
if (strncmp(db->idtag, "LaFS-DeviceBlock", 16) != 0)
return 0;
- if (strncmp(db->version, "AlphaDevel ", 16) != 0)
+ if (__le32_to_cpu(db->version) != LAFS_DEV_VERS)
return 0;
/* uuid can be anything */
crc = db->checksum;
if (__le32_to_cpu(db->segment_offset) + segsize > device_bytes)
return 0;
- if (__le32_to_cpu(db->level) > 10)
- return 0;
-
/* I guess it look sane enough... */
return 1;
}
if (memcmp(curr->uuid, new->uuid, 16) != 0)
/* there are different */
return -1;
- if (memcmp(curr->version, new->version, 16) != 0)
- return -1;
if (__le32_to_cpu(curr->seq) >= __le32_to_cpu(new->seq))
return 0; /*current is best */
dev->segment_count = __le32_to_cpu(best.segment_count);
dev->usage_inum = __le32_to_cpu(best.usage_inum);
- memcpy(dev->version, best.version, 16);
memcpy(dev->uuid, best.uuid, 16);
dev->blockbits = best.blockbits;
dev->statesize = 1 << best.statebits;
u32 crc, crc2;
printf("Superblock:\n");
printf(" IdTag : %.16s\n", dev->idtag);
- printf(" Version : %.15s\n", dev->version);
+ printf(" Version : %d\n", (int)__le32_to_cpu(dev->version));
uuid_unparse(dev->uuid, uuidstr);
printf(" UUID : %s\n", uuidstr);
printf(" Checksum : %08x", (unsigned int)__le32_to_cpu(dev->checksum));
printf(" SegCount : %lu\n", (unsigned long)__le32_to_cpu(dev->segment_count));
printf(" BlkBits : %lu\n", (unsigned long)__le32_to_cpu(dev->blockbits));
printf(" UsageInum : %lu\n", (unsigned long)__le32_to_cpu(dev->usage_inum));
- printf(" Level : %lu\n", (unsigned long)__le32_to_cpu(dev->level));
printf("\n");
}
printf("Deviceblock:\n");
printf(" IdTag : %.16s\n", "LaFS-DeviceBlock");
- printf(" Version : %.15s\n", dev->version);
uuid_unparse(dev->uuid, uuidstr);
printf(" UUID : %s\n", uuidstr);
// printf(" Checksum : %08x\n", (unsigned int)le32_to_cpu(super->checksum));
printf(" SegCount : %lu\n", dev->segment_count);
printf(" BlkBits : %lu\n", (unsigned long)dev->blockbits);
printf(" UsageInum : %lu\n", (unsigned long)dev->usage_inum);
-// printf(" Level : %lu\n", (unsigned long)le32_to_cpu(super->level));
printf("\n");
}
struct lafs_snapshot *ss;
printf("LaFS State:\n");
- printf(" Version : %.15s\n", fs->version);
uuid_unparse(fs->uuid, uuidstr);
printf(" UUID : %s\n", uuidstr);
printf(" Seq : %d\n", (int)fs->seq);
printf("Stateblock:\n");
printf(" IDtag : %.16s\n", state->idtag);
- printf(" Version : %.15s\n", state->version);
+ printf(" Version : %d\n", (int)__le32_to_cpu(state->version));
uuid_unparse(state->uuid, uuidstr);
printf(" UUID : %s\n", uuidstr);
printf(" Checksum : %08x", (int) __le32_to_cpu(state->checksum));
else
printf(" (expected %08x)\n", (unsigned int)__le32_to_cpu(crc2));
printf(" Seq : %d\n", (int)__le32_to_cpu(state->seq));
- printf(" Levels : %d\n", (int)__le32_to_cpu(state->levels));
+ printf(" AltSeq : %d\n", (int)__le32_to_cpu(state->alt_seq));
printf(" Devices : %d\n", (int)__le32_to_cpu(state->devices));
printf(" MaxSnap : %d\n", (int)__le32_to_cpu(state->maxsnapshot));
printf(" NextYouth : %d\n", (int)__le16_to_cpu(state->nextyouth));
memset(buf, 0, sizeof(buf));
memcpy(pd->idtag, "LaFS-DeviceBlock", 16);
- memcpy(pd->version, "AlphaDevel ", 16);
+ pd->version = __cpu_to_le32(LAFS_DEV_VERS);
memcpy(pd->uuid, fs->uuid, 16);
dev->seq++;
pd->segment_offset = __cpu_to_le32(dev->segment_offset);
pd->segment_count = __cpu_to_le32(dev->segment_count);
pd->usage_inum = __cpu_to_le32(dev->usage_inum);
- pd->level = __cpu_to_le32(1);
csum = crc32(0, (uint32_t*)buf, LAFS_DEVBLK_SIZE);
pd->checksum = csum;
memcpy(st->idtag, "LaFS-State-Block", 16);
memcpy(st->uuid, fs->uuid, 16);
- memset(st->version, ' ', 16);
- memcpy(st->version, "AlphaDevel ", 16);
+ st->version = __cpu_to_le32(LAFS_STATE_VERS);
st->seq = __cpu_to_le32(fs->seq);
st->nextyouth = __cpu_to_le16(fs->youth_next);