Changeset 271e24a in mainline for uspace/lib/gpt/libgpt.c
- Timestamp:
- 2013-03-24T00:12:25Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 30440ed
- Parents:
- ec50ac4a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gpt/libgpt.c
rec50ac4a r271e24a 52 52 53 53 static int load_and_check_header(service_id_t handle, aoff64_t addr, size_t b_size, gpt_header_t * header); 54 static gpt_part s_t * alloc_part_array(uint32_t num);55 static int extend_part_array(gpt_part s_t * p);56 static int reduce_part_array(gpt_part s_t * p);54 static gpt_partitions_t * alloc_part_array(uint32_t num); 55 static int extend_part_array(gpt_partitions_t * p); 56 static int reduce_part_array(gpt_partitions_t * p); 57 57 static long long nearest_larger_int(double a); 58 58 … … 162 162 * error code is stored in errno 163 163 */ 164 gpt_part s_t * gpt_read_partitions(gpt_t * gpt)164 gpt_partitions_t * gpt_read_partitions(gpt_t * gpt) 165 165 { 166 166 int rc; 167 167 unsigned int i; 168 gpt_part s_t * res;168 gpt_partitions_t * res; 169 169 uint32_t num_ent = uint32_t_le2host(gpt->raw_data->num_entries); 170 170 uint32_t ent_size = uint32_t_le2host(gpt->raw_data->entry_size); … … 242 242 * @return returns EOK on succes, specific error code otherwise 243 243 */ 244 int gpt_write_partitions(gpt_part s_t * parts, gpt_t * gpt, service_id_t dev_handle)244 int gpt_write_partitions(gpt_partitions_t * parts, gpt_t * gpt, service_id_t dev_handle) 245 245 { 246 246 int rc; … … 283 283 } 284 284 285 gpt_parts_t * gpt_add_partition(gpt_parts_t * parts, g_part_t * partition) 286 { 287 288 } 289 290 gpt_parts_t * gpt_remove_partition(gpt_parts_t * parts, int idx) 291 { 292 285 gpt_partitions_t * gpt_add_partition(gpt_partitions_t * parts, gpt_part_t * partition) 286 { 287 288 extend_part_array(parts); 289 return parts; 290 } 291 292 gpt_partitions_t * gpt_remove_partition(gpt_partitions_t * parts, size_t idx) 293 { 294 reduce_part_array(parts); 295 return parts; 293 296 } 294 297 … … 304 307 * @param parts partition list to be freed 305 308 */ 306 void gpt_free_partitions(gpt_part s_t * parts)309 void gpt_free_partitions(gpt_partitions_t * parts) 307 310 { 308 311 free(parts->part_array); … … 316 319 * 317 320 */ 318 void gpt_set_part_type(g _part_t * p, int type)321 void gpt_set_part_type(gpt_part_t * p, int type) 319 322 { 320 323 /* Beware: first 3 blocks are byteswapped! */ … … 386 389 } 387 390 388 static gpt_part s_t * alloc_part_array(uint32_t num)389 { 390 gpt_part s_t * res = malloc(sizeof(gpt_parts_t));391 static gpt_partitions_t * alloc_part_array(uint32_t num) 392 { 393 gpt_partitions_t * res = malloc(sizeof(gpt_partitions_t)); 391 394 if (res == NULL) { 392 395 errno = ENOMEM; … … 408 411 } 409 412 410 static int extend_part_array(gpt_part s_t * p)413 static int extend_part_array(gpt_partitions_t * p) 411 414 { 412 415 unsigned int nsize = p->arr_size * 2; … … 425 428 } 426 429 427 static int reduce_part_array(gpt_part s_t * p)430 static int reduce_part_array(gpt_partitions_t * p) 428 431 { 429 432 if(p->arr_size > GPT_MIN_PART_NUM) {
Note:
See TracChangeset
for help on using the changeset viewer.