Index: uspace/app/ext2info/ext2info.c
===================================================================
--- uspace/app/ext2info/ext2info.c	(revision a54af668b195587f801880c219d838ca1c5537fe)
+++ uspace/app/ext2info/ext2info.c	(revision 102d4000af331bdf964271ff6b88d5992d3e1f77)
@@ -56,6 +56,7 @@
 static void print_block_groups(ext2_filesystem_t *);
 static void print_block_group(ext2_block_group_t *);
-static void print_inode_by_number(ext2_filesystem_t *, uint32_t);
+static void print_inode_by_number(ext2_filesystem_t *, uint32_t, bool, uint32_t);
 static void print_inode(ext2_filesystem_t *, ext2_inode_t *);
+static void print_inode_data(ext2_filesystem_t *, ext2_inode_t *, uint32_t);
 
 #define ARG_SUPERBLOCK 1
@@ -63,4 +64,5 @@
 #define ARG_INODE 4
 #define ARG_STRICT_CHECK 8
+#define ARG_INODE_DATA 16
 #define ARG_COMMON (ARG_SUPERBLOCK | ARG_BLOCK_GROUPS)
 #define ARG_ALL (ARG_COMMON | ARG_INODE)
@@ -77,4 +79,5 @@
 	int arg_flags;
 	uint32_t inode = 0;
+	uint32_t inode_data = 0;
 	
 	arg_flags = 0;
@@ -120,4 +123,22 @@
 		arg_flags |= ARG_INODE;
 		--argc; ++argv;
+		
+		if (str_cmp(*argv, "--inode-data") == 0) {
+			--argc; ++argv;
+			if (argc == 0) {
+				printf(NAME ": Argument expected for --inode-data\n");
+				return 2;
+			}
+			
+			inode_data = strtol(*argv, &endptr, 10);
+			if (*endptr != '\0') {
+				printf(NAME ": Error, invalid argument for --inode-data.\n");
+				syntax_print();
+				return 1;
+			}
+			
+			arg_flags |= ARG_INODE_DATA;
+			--argc; ++argv;
+		}
 	}
 
@@ -164,5 +185,6 @@
 	
 	if (arg_flags & ARG_INODE) {
-		print_inode_by_number(&filesystem, inode);
+		print_inode_by_number(&filesystem, inode, arg_flags & ARG_INODE_DATA,
+		    inode_data);
 	}
 
@@ -175,5 +197,6 @@
 static void syntax_print(void)
 {
-	printf("syntax: ext2info --strict-check --superblock --block-groups --inode <i-number> <device_name>\n");
+	printf("syntax: ext2info [--strict-check] [--superblock] [--block-groups] "
+	    "[--inode <i-number> [--inode-data <block-number>]] <device_name>\n");
 }
 
@@ -322,5 +345,6 @@
 }
 
-void print_inode_by_number(ext2_filesystem_t *fs, uint32_t inode)
+void print_inode_by_number(ext2_filesystem_t *fs, uint32_t inode, 
+    bool print_data, uint32_t data)
 {
 	int rc;
@@ -336,4 +360,7 @@
 	
 	print_inode(fs, inode_ref->inode);
+	if (print_data) {
+		print_inode_data(fs, inode_ref->inode, data);
+	}
 	
 	rc = ext2_filesystem_put_inode_ref(inode_ref);
@@ -355,4 +382,5 @@
 	const char *type;
 	uint32_t block;
+	uint32_t total_blocks;
 	int i;
 	bool all_blocks = false;
@@ -365,4 +393,5 @@
 	usage_count = ext2_inode_get_usage_count(inode);
 	flags = ext2_inode_get_flags(inode);
+	total_blocks = ext2_inode_get_reserved_blocks(fs->superblock, inode);
 	
 	type = "Unknown";
@@ -390,4 +419,5 @@
 	
 	access = mode & EXT2_INODE_MODE_ACCESS_MASK;
+	
 	
 	printf("  Mode: %08x (Type: %s, Access bits: %04ho)\n", mode, type, access);
@@ -397,4 +427,5 @@
 	printf("  Usage (link) count: %u\n", usage_count);
 	printf("  Flags: %u\n", flags);
+	printf("  Total allocated blocks: %u\n", total_blocks);
 	printf("  Block list: ");
 	for (i = 0; i < 12; i++) {
@@ -406,8 +437,55 @@
 		printf("%u ", block);
 	}
+	all_blocks = all_blocks || ext2_inode_get_indirect_block(inode, 0) == 0;
 	if (!all_blocks) {
 		printf(" and more...");
 	}
 	printf("\n");
+}
+
+void print_inode_data(ext2_filesystem_t *fs, ext2_inode_t *inode, uint32_t data)
+{
+	int rc;
+	uint32_t data_block_index;
+	block_t *block;
+	size_t i;
+	unsigned char c;
+	
+	rc = ext2_filesystem_get_inode_data_block_index(fs, inode, data,
+	    &data_block_index);
+	
+	if (rc != EOK) {
+		printf("Failed getting data block #%u\n", data);
+		return;
+	}
+	
+	printf("Data for inode contents block #%u is located in filesystem "
+	    "block %u\n", data, data_block_index);
+	
+	printf("Data preview (only printable characters):\n");
+	
+	rc = block_get(&block, fs->device, data_block_index, 0);
+	if (rc != EOK) {
+		printf("Failed reading filesystem block %u\n", data_block_index);
+		return;
+	}
+	
+	for (i = 0; i < block->size; i++) {
+		c = ((unsigned char *)block->data)[i];
+		if (c >= 32 && c < 127) {
+			putchar(c);
+		}
+		else {
+			putchar('.');
+		}
+	}
+	
+	printf("\n");	
+	
+	rc = block_put(block);
+	if (rc != EOK) {
+		printf("Failed putting filesystem block\n");
+	}
+	
 }
 
