Changeset 1a1a735 in mainline for uspace/lib/gpt/libgpt.c
- Timestamp:
- 2013-07-26T18:29:51Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 903a897, 9f4650c
- Parents:
- 9bdfde73 (diff), 8559fa0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gpt/libgpt.c
r9bdfde73 r1a1a735 127 127 rc = block_init(EXCHANGE_ATOMIC, dev_handle, 512); 128 128 if (rc != EOK) 129 return rc;129 goto fail; 130 130 131 131 rc = block_get_bsize(dev_handle, &b_size); 132 132 if (rc != EOK) 133 return rc;133 goto fini_fail; 134 134 135 135 if (label->gpt == NULL) { 136 136 label->gpt = gpt_alloc_header(b_size); 137 if (label->gpt == NULL) 138 return ENOMEM; 137 if (label->gpt == NULL) { 138 rc = ENOMEM; 139 goto fini_fail; 140 } 139 141 } 140 142 … … 144 146 rc = block_get_nblocks(dev_handle, &n_blocks); 145 147 if (rc != EOK) 146 goto f ail;148 goto free_fail; 147 149 148 150 rc = load_and_check_header(dev_handle, n_blocks - 1, b_size, label->gpt->header); 149 151 if (rc == EBADCHECKSUM || rc == EINVAL) 150 goto f ail;152 goto free_fail; 151 153 } 152 154 … … 155 157 return EOK; 156 158 157 fail: 158 block_fini(dev_handle); 159 free_fail: 159 160 gpt_free_gpt(label->gpt); 160 161 label->gpt = NULL; 162 fini_fail: 163 block_fini(dev_handle); 164 fail: 161 165 return rc; 162 166 } … … 240 244 * - we don't need more bytes 241 245 * - the size of GPT partition entry can be different to 128 bytes */ 246 /* comm_size is ignored */ 242 247 rc = block_init(EXCHANGE_SERIALIZE, label->device, sizeof(gpt_entry_t)); 243 248 if (rc != EOK) … … 247 252 rc = block_get_bsize(label->device, &block_size); 248 253 if (rc != EOK) 249 goto f ail;254 goto fini_fail; 250 255 251 256 //size_t bufpos = 0; … … 266 271 267 272 if (rc != EOK) 268 goto f ail;273 goto fini_fail; 269 274 } 270 275 … … 274 279 * on all of the partition entry array. 275 280 */ 276 uint32_t crc = compute_crc32((uint8_t *) label->parts->part_array, label->parts->fill * sizeof(gpt_entry_t)); 281 uint32_t crc = compute_crc32((uint8_t *) label->parts->part_array, 282 label->parts->fill * sizeof(gpt_entry_t)); 277 283 278 284 if(uint32_t_le2host(label->gpt->header->pe_array_crc32) != crc) 279 285 { 280 286 rc = EBADCHECKSUM; 281 goto fail; 282 } 283 287 goto fini_fail; 288 } 289 290 block_fini(label->device); 284 291 return EOK; 292 293 fini_fail: 294 block_fini(label->device); 285 295 286 296 fail:
Note:
See TracChangeset
for help on using the changeset viewer.