/* * KodeMsgFin, finish up by adding tagine and padding out last block */ static void KodeMsgFin(char *Qmail) { /* Add the the tagline. Rajout de la signature du programme */ if (get_tag_flag()) KodeMsgTag(); /* Ajuste la taille du dernier bloc … 128 octets */ /* Adjust the size of the last block to 128 bytes */ while (CountRecordChars < block_SIZE) { *tamp = SPC_CHAR; tamp++; CountRecordChars++; CountTotalChars++; } /* Inscrit dans le Header le nombre blocs de 128 octets */ /* Inscribe in the header the number of 128 byte blocks */ { char tmp[20]; sprintf(tmp, "%lu", (unsigned long) CountBlocks); str2mem(Qmail + HSizeMsg, tmp); } }
/* * dump_jbd_block() * */ void dump_jbd_block(FILE *out, journal_superblock_t *jsb, journal_header_t *header, uint64_t blknum) { int i; int j; int count = 0; GString *tagflg = NULL; /* for descriptors */ journal_block_tag_t *tag; journal_revoke_header_t *revoke; char *blk = (char *) header; uint32_t *blocknr; char *uuid; struct ocfs2_super_block *sb = OCFS2_RAW_SB(gbls.fs->fs_super); int tag_bytes = ocfs2_journal_tag_bytes(jsb); tagflg = g_string_new(NULL); fprintf(out, "\tBlock %"PRIu64": ", blknum); switch (ntohl(header->h_blocktype)) { case JBD2_DESCRIPTOR_BLOCK: fprintf(out, "Journal Descriptor\n"); dump_jbd_header(out, header); fprintf(out, "\t%3s %-15s %-s\n", "No.", "Blocknum", "Flags"); for (i = sizeof(journal_header_t); i < (1 << sb->s_blocksize_bits); i+=tag_bytes) { tag = (journal_block_tag_t *) &blk[i]; get_tag_flag(ntohl(tag->t_flags), tagflg); fprintf(out, "\t%2d. %-15"PRIu64" %-s\n", count, ocfs2_journal_tag_block(tag, tag_bytes), tagflg->str); g_string_truncate(tagflg, 0); if (tag->t_flags & htonl(JBD2_FLAG_LAST_TAG)) break; /* skip the uuid. */ if (!(tag->t_flags & htonl(JBD2_FLAG_SAME_UUID))) { uuid = &blk[i + tag_bytes]; fprintf(out, "\tUUID: "); for(j = 0; j < 16; j++) fprintf(out, "%02X",uuid[j]); fprintf(out, "\n"); i += 16; } count++; } break; case JBD2_COMMIT_BLOCK: fprintf(out, "Journal Commit Block\n"); dump_jbd_header(out, header); break; case JBD2_REVOKE_BLOCK: /*TODO*/ fprintf(out, "Journal Revoke Block\n"); dump_jbd_header(out, header); revoke = (journal_revoke_header_t *) blk; fprintf(out, "\tr_count:\t\t%d\n", ntohl(revoke->r_count)); count = (ntohl(revoke->r_count) - sizeof(journal_revoke_header_t)) / sizeof(uint32_t); blocknr = (uint32_t *) &blk[sizeof(journal_revoke_header_t)]; for(i = 0; i < count; i++) fprintf(out, "\trevoke[%d]:\t\t%u\n", i, ntohl(blocknr[i])); break; default: fprintf(out, "Unknown Block Type\n"); break; } fprintf(out, "\n"); if (tagflg) g_string_free(tagflg, 1); return; }