6 static char *VerifyNames[] = {"Null", "Next", "Next2", "Sum",};
7 static char *FlagNames[] = {"Checkpoint","Start","End", NULL};
9 void lafs_print_cluster(struct cluster_head *head, int blocksize,
10 int groups, int verbose)
12 struct group_head *gh;
14 struct descriptor *desc;
21 printf("ClusterHead:\n");
22 printf(" IdTag : %.8s\n", head->idtag);
24 if (le32_to_cpu(head->flags)==0) printf(" -none-");
25 else for (i=0; FlagNames[i]; i++)
26 if (le32_to_cpu(head->flags)&(1<<i))
27 printf(" %s", FlagNames[i]);
29 uuid_unparse(head->uuid, uuidstr);
30 printf(" UUID : %s\n", uuidstr);
31 printf(" Seq : %llu\n", (unsigned long long)__le64_to_cpu(head->seq));
32 printf(" Hlength : %d\n", (int)__le16_to_cpu(head->Hlength));
33 printf(" Clength : %d\n", (int)__le16_to_cpu(head->Clength));
34 printf(" Checksum : %08x\n", (unsigned int)le32_to_cpu(head->checksum));
35 printf(" Verify : %s\n", VerifyNames[(int)__le16_to_cpu(head->verify_type)]);
36 printf(" NEXT : %llu\n", (unsigned long long)__le64_to_cpu(head->next_addr));
37 printf(" THIS : %llu\n", (unsigned long long)__le64_to_cpu(head->this_addr));
38 printf(" PREV : %llu\n", (unsigned long long)__le64_to_cpu(head->prev_addr));
41 printf("Cluster %llu(", (unsigned long long)__le64_to_cpu(head->seq));
42 for (i=0; FlagNames[i]; i++)
43 if (le32_to_cpu(head->flags)&(1<<i)) {
44 printf("%s%s", sep, FlagNames[i]);
47 printf(") %llu < %llu > %llu\n",
48 (unsigned long long)__le64_to_cpu(head->prev_addr),
49 (unsigned long long)__le64_to_cpu(head->this_addr),
50 (unsigned long long)__le64_to_cpu(head->next_addr));
55 start = __le64_to_cpu(head->this_addr);
56 offset = (__le16_to_cpu(head->Hlength)+blocksize-1)/blocksize;
60 while ( ((char*)gh - (char*)head) < __le16_to_cpu(head->Hlength)) {
63 printf(" Group[%d]:\n", i);
64 printf(" Inum : %d\n", (int)le32_to_cpu(gh->inum));
65 printf(" FSnum : %d\n", (int)le32_to_cpu(gh->fsnum));
66 printf(" Flag : %s\n", (__le16_to_cpu(gh->truncatenum_and_flag) & 0x8000) ? "old":"new");
67 printf(" TRnum : %d\n", (int)__le16_to_cpu(gh->truncatenum_and_flag) & 0x7fff);
68 printf(" Size : %d words\n", (int)__le16_to_cpu(gh->group_size_words));
70 printf(" Inode: %d/%d\n", (int)le32_to_cpu(gh->fsnum),
71 (int)le32_to_cpu(gh->inum));
73 while (((char*)desc - (char*)gh) < __le16_to_cpu(gh->group_size_words)*4) {
74 if (__le16_to_cpu(desc->block_bytes) <= DescMiniOffset ||
75 __le16_to_cpu(desc->block_bytes) == DescIndex ) {
77 if (__le16_to_cpu(desc->block_bytes) != DescIndex)
82 printf(" Desc[%d]:\n", j);
83 printf(" Block : %u\n", (unsigned)le32_to_cpu(desc->block_num));
84 printf(" Count : %u\n", __le16_to_cpu(desc->block_cnt));
85 printf(" Type : %s\n", typ);
86 printf(" Offset : %ld (%llu)\n", offset,
87 (unsigned long long)start + offset);
89 if (__le16_to_cpu(desc->block_cnt) == 1)
90 printf(" %s : %u (%llu)\n", typ,
91 (unsigned)le32_to_cpu(desc->block_num),
92 (unsigned long long)start + offset);
94 printf(" %s : %u-%u (%llu)\n", typ,
95 (unsigned)le32_to_cpu(desc->block_num),
96 (unsigned)le32_to_cpu(desc->block_num)
97 + __le16_to_cpu(desc->block_cnt) - 1,
98 (unsigned long long)start + offset);
100 offset += __le16_to_cpu(desc->block_cnt);
104 mb = (struct miniblock *)desc;
105 len = __le16_to_cpu(mb->length) - DescMiniOffset;
107 printf(" MiniBlock[%d]:\n", j);
108 printf(" Block : %u\n", (unsigned)le32_to_cpu(mb->block_num));
109 printf(" Offset : %u\n", __le16_to_cpu(mb->block_offset));
110 printf(" length : %u\n", len);
112 printf(" Update: %u+%u - %u bytes\n",
113 (unsigned)le32_to_cpu(mb->block_num),
114 __le16_to_cpu(mb->block_offset), len);
117 printf(" Content : ");
118 for (k=0; k<len; k++) {
119 printf(" %02x", ((unsigned char*)mb)[k]);
127 mb = (struct miniblock *)(((char*)mb) + ROUND_UP(len));
128 desc = (struct descriptor *)mb;
132 gh = (struct group_head*)desc;
136 printf(" Final Offset : %ld (next %llu)\n", offset, (unsigned long long)start+offset);