Changeset 36bca8eb in mainline for uspace/app/ext2info/ext2info.c
- Timestamp:
- 2011-02-13T18:55:00Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e272949
- Parents:
- d5e2763
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/ext2info/ext2info.c
rd5e2763 r36bca8eb 60 60 char *dev_path; 61 61 devmap_handle_t handle; 62 size_t block_size;63 aoff64_t dev_nblocks;64 uint8_t *data;65 62 ext2_superblock_t *superblock; 66 63 … … 95 92 } 96 93 97 rc = block_get_bsize(handle, &block_size); 98 if (rc != EOK) { 99 printf(NAME ": Error determining device block size.\n"); 100 return 2; 101 } 102 103 rc = block_get_nblocks(handle, &dev_nblocks); 104 if (rc != EOK) { 105 printf(NAME ": Warning, failed to obtain block device size.\n"); 106 } 107 108 data = malloc(block_size); 109 if (data == NULL) { 110 printf(NAME ": Error allocating data buffer of %" PRIuOFF64 " bytes", (aoff64_t) block_size); 111 block_fini(handle); 94 rc = ext2_superblock_read_direct(&superblock, handle); 95 if (rc != EOK) { 96 printf(NAME ": Error reading superblock.\n"); 112 97 return 3; 113 98 } 114 115 // TODO: don't assume device block size of 512 bytes116 rc = block_read_direct(handle, 2, 1, data);117 if (rc != EOK) {118 printf(NAME ": Error reading block");119 free(data);120 return 3;121 }122 123 superblock = (ext2_superblock_t *) data;124 99 125 100 printf("Superblock:\n"); … … 133 108 134 109 135 free( data);110 free(superblock); 136 111 137 112 block_fini(handle);
Note:
See TracChangeset
for help on using the changeset viewer.