mkfs-simplefs: fill sb by zeros sb padding

This will make debugging more cleaner (you will see actual zeros instead
of trash)
This commit is contained in:
Azat Khuzhin 2014-07-12 21:56:49 +04:00
parent 7610120b10
commit 0fb2c3b7c1

View File

@ -14,19 +14,16 @@ const uint64_t WELCOMEFILE_INODE_NUMBER = 2;
static int write_superblock(int fd) static int write_superblock(int fd)
{ {
struct simplefs_super_block sb; struct simplefs_super_block sb = {
ssize_t ret; .version = 1,
.magic = SIMPLEFS_MAGIC,
sb.version = 1; .block_size = SIMPLEFS_DEFAULT_BLOCK_SIZE,
sb.magic = SIMPLEFS_MAGIC;
sb.block_size = SIMPLEFS_DEFAULT_BLOCK_SIZE;
/* One inode for rootdirectory and another for a welcome file that we are going to create */ /* One inode for rootdirectory and another for a welcome file that we are going to create */
sb.inodes_count = 2; .inodes_count = 2,
/* FIXME: Free blocks management is not implemented yet */ /* FIXME: Free blocks management is not implemented yet */
sb.free_blocks = ~0; .free_blocks = (~0) & ~(1 << WELCOMEFILE_DATABLOCK_NUMBER),
sb.free_blocks &= ~(1 << WELCOMEFILE_DATABLOCK_NUMBER); };
ssize_t ret;
ret = write(fd, &sb, sizeof(sb)); ret = write(fd, &sb, sizeof(sb));
if (ret != SIMPLEFS_DEFAULT_BLOCK_SIZE) { if (ret != SIMPLEFS_DEFAULT_BLOCK_SIZE) {