Changes in uspace/lib/gpt/libgpt.c [8559fa0:9bdfde73] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gpt/libgpt.c
r8559fa0 r9bdfde73 127 127 rc = block_init(EXCHANGE_ATOMIC, dev_handle, 512); 128 128 if (rc != EOK) 129 goto fail;129 return rc; 130 130 131 131 rc = block_get_bsize(dev_handle, &b_size); 132 132 if (rc != EOK) 133 goto fini_fail;133 return rc; 134 134 135 135 if (label->gpt == NULL) { 136 136 label->gpt = gpt_alloc_header(b_size); 137 if (label->gpt == NULL) { 138 rc = ENOMEM; 139 goto fini_fail; 140 } 137 if (label->gpt == NULL) 138 return ENOMEM; 141 139 } 142 140 … … 146 144 rc = block_get_nblocks(dev_handle, &n_blocks); 147 145 if (rc != EOK) 148 goto f ree_fail;146 goto fail; 149 147 150 148 rc = load_and_check_header(dev_handle, n_blocks - 1, b_size, label->gpt->header); 151 149 if (rc == EBADCHECKSUM || rc == EINVAL) 152 goto f ree_fail;150 goto fail; 153 151 } 154 152 … … 157 155 return EOK; 158 156 159 free_fail: 157 fail: 158 block_fini(dev_handle); 160 159 gpt_free_gpt(label->gpt); 161 160 label->gpt = NULL; 162 fini_fail:163 block_fini(dev_handle);164 fail:165 161 return rc; 166 162 } … … 244 240 * - we don't need more bytes 245 241 * - the size of GPT partition entry can be different to 128 bytes */ 246 /* comm_size is ignored */247 242 rc = block_init(EXCHANGE_SERIALIZE, label->device, sizeof(gpt_entry_t)); 248 243 if (rc != EOK) … … 252 247 rc = block_get_bsize(label->device, &block_size); 253 248 if (rc != EOK) 254 goto f ini_fail;249 goto fail; 255 250 256 251 //size_t bufpos = 0; … … 271 266 272 267 if (rc != EOK) 273 goto f ini_fail;268 goto fail; 274 269 } 275 270 … … 279 274 * on all of the partition entry array. 280 275 */ 281 uint32_t crc = compute_crc32((uint8_t *) label->parts->part_array, 282 label->parts->fill * sizeof(gpt_entry_t)); 276 uint32_t crc = compute_crc32((uint8_t *) label->parts->part_array, label->parts->fill * sizeof(gpt_entry_t)); 283 277 284 278 if(uint32_t_le2host(label->gpt->header->pe_array_crc32) != crc) 285 279 { 286 280 rc = EBADCHECKSUM; 287 goto fini_fail; 288 } 289 290 block_fini(label->device); 281 goto fail; 282 } 283 291 284 return EOK; 292 293 fini_fail:294 block_fini(label->device);295 285 296 286 fail:
Note:
See TracChangeset
for help on using the changeset viewer.