Index: uspace/app/mkmfs/mkmfs.c
===================================================================
--- uspace/app/mkmfs/mkmfs.c	(revision ee6d9dd7d6e50d883f28f884cac4122d6044052c)
+++ uspace/app/mkmfs/mkmfs.c	(revision 8367d1d9f98b6155fea9c37ae61d6b4a04f542c2)
@@ -55,6 +55,6 @@
 #define USED	1
 
-#define UPPER(n, size) 			(((n) / (size)) + (((n) % (size)) != 0))
-#define NEXT_DENTRY(p, dirsize)		(p += (dirsize))
+#define UPPER(n, size) 		(((n) / (size)) + (((n) % (size)) != 0))
+#define NEXT_DENTRY(p, dirsize)	(p += (dirsize))
 
 typedef enum {
@@ -63,5 +63,5 @@
 } help_level_t;
 
-/*Generic MFS superblock*/
+/* Generic MFS superblock */
 struct mfs_sb_info {
 	uint64_t n_inodes;
@@ -117,9 +117,9 @@
 	struct mfs_sb_info sb;
 
-	/*Default is MinixFS V3*/
+	/* Default is MinixFS V3 */
 	sb.magic = MFS_MAGIC_V3;
 	sb.fs_version = 3;
 
-	/*Default block size is 4Kb*/
+	/* Default block size is 4Kb */
 	sb.block_size = MFS_MAX_BLOCKSIZE;
 	sb.dirsize = MFS3_DIRSIZE;
@@ -135,5 +135,6 @@
 
 	for (c = 0, optind = 0, opt_ind = 0; c != -1;) {
-		c = getopt_long(argc, argv, "lh12b:i:", long_options, &opt_ind);
+		c = getopt_long(argc, argv, "lh12b:i:",
+		    long_options, &opt_ind);
 		switch (c) {
 		case 'h':
@@ -168,17 +169,19 @@
 
 	if (sb.block_size < MFS_MIN_BLOCKSIZE || 
-			sb.block_size > MFS_MAX_BLOCKSIZE) {
+	    sb.block_size > MFS_MAX_BLOCKSIZE) {
 		printf(NAME ":Error! Invalid block size.\n");
 		exit(0);
 	} else if (!is_power_of_two(sb.block_size)) {
-		/*Block size must be a power of 2.*/
+		/* Block size must be a power of 2. */
 		printf(NAME ":Error! Invalid block size.\n");
 		exit(0);
 	} else if (sb.block_size > MFS_BLOCKSIZE && 
-			sb.fs_version != 3) {
-		printf(NAME ":Error! Block size > 1024 is supported by V3 filesystem only.\n");
+	    sb.fs_version != 3) {
+		printf(NAME ":Error! Block size > 1024 is "
+		    "supported by V3 filesystem only.\n");
 		exit(0);
 	} else if (sb.fs_version == 3 && sb.longnames) {
-		printf(NAME ":Error! Long filenames are supported by V1/V2 filesystem only.\n");
+		printf(NAME ":Error! Long filenames are supported "
+		    "by V1/V2 filesystem only.\n");
 		exit(0);
 	}
@@ -220,8 +223,9 @@
 	rc = block_get_nblocks(service_id, &sb.dev_nblocks);
 	if (rc != EOK) {
-		printf(NAME ": Warning, failed to obtain block device size.\n");
+		printf(NAME ": Warning, failed to obtain "
+		    "block device size.\n");
 	} else {
 		printf(NAME ": Block device has %" PRIuOFF64 " blocks.\n",
-				sb.dev_nblocks);
+		    sb.dev_nblocks);
 	}
 
@@ -231,5 +235,5 @@
 	}
 
-	/*Minimum block size is 1 Kb*/
+	/* Minimum block size is 1 Kb */
 	sb.dev_nblocks /= 2;
 
@@ -237,5 +241,5 @@
 	printf(NAME ": Writing superblock\n");
 
-	/*Initialize superblock*/
+	/* Initialize superblock */
 	if (init_superblock(&sb) != EOK) {
 		printf(NAME ": Error. Superblock initialization failed\n");
@@ -245,5 +249,5 @@
 	printf(NAME ": Initializing bitmaps\n");
 
-	/*Initialize bitmaps*/
+	/* Initialize bitmaps */
 	if (init_bitmaps(&sb) != EOK) {
 		printf(NAME ": Error. Bitmaps initialization failed\n");
@@ -253,5 +257,5 @@
 	printf(NAME ": Initializing the inode table\n");
 
-	/*Init inode table*/
+	/* Init inode table */
 	if (init_inode_table(&sb) != EOK) {
 		printf(NAME ": Error. Inode table initialization failed\n");
@@ -261,5 +265,5 @@
 	printf(NAME ": Creating the root directory inode\n");
 
-	/*Make the root inode*/
+	/* Make the root inode */
 	if (sb.fs_version == 1)
 		rc = make_root_ino(&sb);
@@ -272,5 +276,5 @@
 	}
 
-	/*Insert directory entries . and ..*/
+	/* Insert directory entries . and .. */
 	if (insert_dentries(&sb) != EOK) {
 		printf(NAME ": Error. Root directory initialization failed\n");
@@ -305,5 +309,5 @@
 
 	if (sb->fs_version != 3) {
-		/*Directory entries for V1/V2 filesystem*/
+		/* Directory entries for V1/V2 filesystem */
 		struct mfs_dentry *dentry = root_block;
 
@@ -312,10 +316,10 @@
 
 		dentry = (struct mfs_dentry *) NEXT_DENTRY(dentry_ptr,
-				sb->dirsize);
+		    sb->dirsize);
 
 		dentry->d_inum = MFS_ROOT_INO;
 		memcpy(dentry->d_name, "..\0", 3);
 	} else {
-		/*Directory entries for V3 filesystem*/
+		/* Directory entries for V3 filesystem */
 		struct mfs3_dentry *dentry = root_block;
 
@@ -324,5 +328,5 @@
 
 		dentry = (struct mfs3_dentry *) NEXT_DENTRY(dentry_ptr,
-				sb->dirsize);
+		    sb->dirsize);
 
 		dentry->d_inum = MFS_ROOT_INO;
@@ -395,5 +399,5 @@
 	ino_buf[MFS_ROOT_INO - 1].i_gid = 0;
 	ino_buf[MFS_ROOT_INO - 1].i_size = (sb->longnames ? MFSL_DIRSIZE :
-	MFS_DIRSIZE) * 2;
+	    MFS_DIRSIZE) * 2;
 	ino_buf[MFS_ROOT_INO - 1].i_mtime = sec;
 	ino_buf[MFS_ROOT_INO - 1].i_nlinks = 2;
@@ -417,5 +421,5 @@
 	int rc;
 
-	/*Compute offset of the first inode table block*/
+	/* Compute offset of the first inode table block */
 	const long itable_off = sb->zbmap_blocks + sb->ibmap_blocks + 2;
 
@@ -460,15 +464,17 @@
 
 	if (sb->longnames)
-		sb->magic = sb->fs_version == 1 ? MFS_MAGIC_V1L : MFS_MAGIC_V2L;
-
-	/*Compute the number of zones on disk*/
+		sb->magic = sb->fs_version == 1 ? MFS_MAGIC_V1L :
+		    MFS_MAGIC_V2L;
+
+	/* Compute the number of zones on disk */
 
 	if (sb->fs_version == 1) {
-		/*Valid only for MFS V1*/
+		/* Valid only for MFS V1 */
 		sb->n_zones = sb->dev_nblocks > UINT16_MAX ? 
-				UINT16_MAX : sb->dev_nblocks;
+		    UINT16_MAX : sb->dev_nblocks;
 		ind = MFS_BLOCKSIZE / sizeof(uint16_t);
 		ind2 = ind * ind;
-		sb->max_file_size = (V1_NR_DIRECT_ZONES + ind + ind2) * MFS_BLOCKSIZE;
+		sb->max_file_size = (V1_NR_DIRECT_ZONES + ind + ind2) *
+		    MFS_BLOCKSIZE;
 	} else {
 		/*Valid for MFS V2/V3*/
@@ -478,4 +484,5 @@
 		else
 			ptrsize = sizeof(uint32_t);
+
 		ind = sb->block_size / ptrsize;
 		ind2 = ind * ind;
@@ -483,5 +490,5 @@
 		sb->max_file_size = zones * sb->block_size;
 		sb->n_zones = sb->dev_nblocks > UINT32_MAX ?
-				UINT32_MAX : sb->dev_nblocks;
+		    UINT32_MAX : sb->dev_nblocks;
 
 		if (sb->fs_version == 3) {
@@ -493,5 +500,5 @@
 	}
 
-	/*Round up the number of inodes to fill block size*/
+	/* Round up the number of inodes to fill block size */
 	if (sb->n_inodes == 0)
 		inodes = sb->dev_nblocks / 3;
@@ -500,5 +507,6 @@
 
 	if (inodes % sb->ino_per_block)
-		inodes = ((inodes / sb->ino_per_block) + 1) * sb->ino_per_block;
+		inodes = ((inodes / sb->ino_per_block) + 1) *
+		    sb->ino_per_block;
 
 	if (sb->fs_version < 3)
@@ -507,21 +515,21 @@
 		sb->n_inodes = inodes > UINT32_MAX ? UINT32_MAX : inodes;
 
-	/*Compute inode bitmap size in blocks*/
+	/* Compute inode bitmap size in blocks */
 	sb->ibmap_blocks = UPPER(sb->n_inodes, sb->block_size * 8);
 
-	/*Compute inode table size*/
+	/* Compute inode table size */
 	sb->itable_size = sb->n_inodes / sb->ino_per_block;
 
-	/*Compute zone bitmap size in blocks*/
+	/* Compute zone bitmap size in blocks */
 	sb->zbmap_blocks = UPPER(sb->n_zones, sb->block_size * 8);
 
-	/*Compute first data zone position*/
+	/* Compute first data zone position */
 	sb->first_data_zone = 2 + sb->itable_size + 
-			sb->zbmap_blocks + sb->ibmap_blocks;
-
-	/*Set log2 of zone to block ratio to zero*/
+	    sb->zbmap_blocks + sb->ibmap_blocks;
+
+	/* Set log2 of zone to block ratio to zero */
 	sb->log2_zone_size = 0;
 
-	/*Check for errors*/
+	/* Check for errors */
 	if (sb->first_data_zone >= sb->n_zones) {
 		printf(NAME ": Error! Insufficient disk space");
@@ -529,5 +537,5 @@
 	}
 
-	/*Superblock is now ready to be written on disk*/
+	/* Superblock is now ready to be written on disk */
 	printf(NAME ": %d block size\n", sb->block_size);
 	printf(NAME ": %d inodes\n", (uint32_t) sb->n_inodes);
@@ -536,5 +544,5 @@
 	printf(NAME ": inode bitmap blocks = %ld\n", sb->ibmap_blocks);
 	printf(NAME ": zone bitmap blocks = %ld\n", sb->zbmap_blocks);
-	printf(NAME ": first data zone = %d\n", (uint32_t) sb->first_data_zone);
+	printf(NAME ": first data zone = %d\n", (uint32_t)sb->first_data_zone);
 	printf(NAME ": max file size = %u\n", sb->max_file_size);
 	printf(NAME ": long fnames = %s\n", sb->longnames ? "Yes" : "No");
@@ -651,5 +659,5 @@
 	for (i = 0; i < ibmap_nblocks; ++i) {
 		if ((rc = write_block(start_block + i,
-				1, (ibmap_buf8 + i * sb->block_size))) != EOK)
+		    1, (ibmap_buf8 + i * sb->block_size))) != EOK)
 			return rc;
 	}
@@ -659,5 +667,5 @@
 	for (i = 0; i < zbmap_nblocks; ++i) {
 		if ((rc = write_block(start_block + i,
-				1, (zbmap_buf8 + i * sb->block_size))) != EOK)
+		    1, (zbmap_buf8 + i * sb->block_size))) != EOK)
 			return rc;
 	}
@@ -698,5 +706,6 @@
 		uint8_t *data_ptr = (uint8_t *) data;
 
-		rc = block_write_direct(service_id, tmp_off << 2, size << 2, data_ptr);
+		rc = block_write_direct(service_id, tmp_off << 2,
+		    size << 2, data_ptr);
 
 		if (rc != EOK)
@@ -706,7 +715,9 @@
 		tmp_off++;
 
-		return block_write_direct(service_id, tmp_off << 2, size << 2, data_ptr);
-	}
-	return block_write_direct(service_id, off << shift, size << shift, data);
+		return block_write_direct(service_id, tmp_off << 2,
+		    size << 2, data_ptr);
+	}
+	return block_write_direct(service_id, off << shift,
+	    size << shift, data);
 }
 
@@ -717,13 +728,21 @@
 	} else {
 		printf("Usage: [options] device\n"
-				"-1         Make a Minix version 1 filesystem\n"
-				"-2         Make a Minix version 2 filesystem\n"
-				"-b ##      Specify the block size in bytes (V3 only),\n"
-				"           valid block size values are 1024, 2048 and 4096 bytes per block\n"
-				"-i ##      Specify the number of inodes for the filesystem\n"
-				"-l         Use 30-char long filenames (V1/V2 only)\n");
-	}
-}
-
+		    "-1         Make a Minix version 1 filesystem\n"
+		    "-2         Make a Minix version 2 filesystem\n"
+		    "-b ##      Specify the block size in bytes (V3 only),\n"
+		    "           valid block size values are 1024, 2048 and"
+				" 4096 bytes per block\n"
+		    "-i ##      Specify the number of inodes"
+				" for the filesystem\n"
+		    "-l         Use 30-char long filenames (V1/V2 only)\n");
+	}
+}
+
+/** Check if a given number is a power of two.
+ *
+ * @param n	The number to check.
+ *
+ * @return	true if it is a power of two, false otherwise.
+ */
 static bool is_power_of_two(uint32_t n)
 {
