Changeset cb328ab in mainline
- Timestamp:
- 2013-06-10T15:10:38Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1c8bfe8, 6317b33
- Parents:
- 469739f (diff), 44c4886 (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. - Location:
- uspace/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gpt/libgpt.c
r469739f rcb328ab 56 56 static int reduce_part_array(gpt_partitions_t * p); 57 57 static long long nearest_larger_int(double a); 58 static int gpt_memcmp(const void * a, const void * b, size_t len); 58 59 60 /** Allocate memory for gpt label */ 61 gpt_label_t * gpt_alloc_label(void) 62 { 63 gpt_label_t *label = malloc(sizeof(gpt_label_t)); 64 if (label == NULL) 65 return NULL; 66 67 label->gpt = NULL; 68 label->parts = NULL; 69 label->device = 0; 70 71 return label; 72 } 73 74 /** Free gpt_label_t structure */ 75 void gpt_free_label(gpt_label_t *label) 76 { 77 if (label->gpt != NULL) 78 gpt_free_gpt(label->gpt); 79 80 if (label->parts != NULL) 81 gpt_free_partitions(label->parts); 82 83 free(label); 84 } 59 85 60 86 /** Allocate memory for gpt header */ 61 gpt_t * gpt_alloc_gpt_header(void) 62 { 63 return malloc(sizeof(gpt_t)); 87 gpt_t * gpt_alloc_header(size_t size) 88 { 89 gpt_t *gpt = malloc(sizeof(gpt_t)); 90 if (gpt == NULL) 91 return NULL; 92 93 // We might need only sizeof(gpt_header_t), 94 // but we should follow specs and have 95 // zeroes through all the rest of the block 96 size_t final_size = size > sizeof(gpt_header_t) ? size : sizeof(gpt_header_t); 97 gpt->header = malloc(final_size); 98 if (gpt->header == NULL) { 99 free(gpt); 100 return NULL; 101 } 102 103 memset(gpt->header, 0, final_size); 104 105 return gpt; 106 } 107 108 /** free() GPT header including gpt->header_lba */ 109 void gpt_free_gpt(gpt_t *gpt) 110 { 111 free(gpt->header); 112 free(gpt); 64 113 } 65 114 66 115 /** Read GPT from specific device 67 * @param dev_handle device to read GPT from 68 * 69 * @return GPT record on success, NULL on error 70 */ 71 gpt_t * gpt_read_gpt_header(service_id_t dev_handle) 116 * @param label label structure to fill 117 * @param dev_handle device to read GPT from 118 * 119 * @return EOK on success, errorcode on error 120 */ 121 int gpt_read_header(gpt_label_t *label, service_id_t dev_handle) 72 122 { 73 123 int rc; … … 76 126 rc = block_init(EXCHANGE_ATOMIC, dev_handle, 512); 77 127 if (rc != EOK) 78 return NULL;128 return rc; 79 129 80 130 rc = block_get_bsize(dev_handle, &b_size); 81 if (rc != EOK) { 82 errno = rc; 83 return NULL; 84 } 85 86 gpt_t * gpt = malloc(sizeof(gpt_t)); 87 if (gpt == NULL) { 88 errno = ENOMEM; 89 return NULL; 90 } 91 92 gpt->raw_data = malloc(b_size); // We might need only sizeof(gpt_header_t), 93 if (gpt == NULL) { // but we should follow specs and have 94 free(gpt); // zeroes through all the rest of the block 95 errno = ENOMEM; 96 return NULL; 97 } 98 99 100 rc = load_and_check_header(dev_handle, GPT_HDR_BA, b_size, gpt->raw_data); 131 if (rc != EOK) 132 return rc; 133 134 if (label->gpt == NULL) { 135 label->gpt = gpt_alloc_header(b_size); 136 if (label->gpt == NULL) 137 return ENOMEM; 138 } 139 140 rc = load_and_check_header(dev_handle, GPT_HDR_BA, b_size, label->gpt->header); 101 141 if (rc == EBADCHECKSUM || rc == EINVAL) { 102 142 aoff64_t n_blocks; 103 143 rc = block_get_nblocks(dev_handle, &n_blocks); 104 if (rc != EOK) { 105 errno = rc; 144 if (rc != EOK) 106 145 goto fail; 107 } 108 109 rc = load_and_check_header(dev_handle, n_blocks - 1, b_size, gpt->raw_data); 110 if (rc == EBADCHECKSUM || rc == EINVAL) { 111 errno = rc; 146 147 rc = load_and_check_header(dev_handle, n_blocks - 1, b_size, label->gpt->header); 148 if (rc == EBADCHECKSUM || rc == EINVAL) 112 149 goto fail; 113 } 114 } 115 116 gpt->device = dev_handle; 150 } 151 152 label->device = dev_handle; 117 153 block_fini(dev_handle); 118 return gpt;154 return EOK; 119 155 120 156 fail: 121 157 block_fini(dev_handle); 122 gpt_free_gpt(gpt); 123 return NULL; 158 gpt_free_gpt(label->gpt); 159 label->gpt = NULL; 160 return rc; 124 161 } 125 162 126 163 /** Write GPT header to device 127 * @param header GPTheader to be written128 * @param dev_handle 129 * 130 * @return 0on success, libblock error code otherwise131 * 132 * Note: Firstly write partitions (if changed), then gpt header.133 */ 134 int gpt_write_ gpt_header(gpt_t * gpt, service_id_t dev_handle)164 * @param label GPT label header to be written 165 * @param dev_handle device handle to write the data to 166 * 167 * @return EOK on success, libblock error code otherwise 168 * 169 * Note: Firstly write partitions (if modified), then gpt header. 170 */ 171 int gpt_write_header(gpt_label_t *label, service_id_t dev_handle) 135 172 { 136 173 int rc; 137 174 size_t b_size; 138 175 139 gpt->raw_data->header_crc32 = 0;140 gpt->raw_data->header_crc32 = compute_crc32((uint8_t *) gpt->raw_data,141 uint32_t_le2host( gpt->raw_data->header_size));176 label->gpt->header->header_crc32 = 0; 177 label->gpt->header->header_crc32 = compute_crc32((uint8_t *) label->gpt->header, 178 uint32_t_le2host(label->gpt->header->header_size)); 142 179 143 180 rc = block_init(EXCHANGE_ATOMIC, dev_handle, b_size); … … 150 187 151 188 /* Write to main GPT header location */ 152 rc = block_write_direct(dev_handle, GPT_HDR_BA, GPT_HDR_BS, gpt->raw_data);153 if (rc != EOK) 189 rc = block_write_direct(dev_handle, GPT_HDR_BA, GPT_HDR_BS, label->gpt->header); 190 if (rc != EOK) { 154 191 block_fini(dev_handle); 155 192 return rc; 193 } 156 194 157 195 aoff64_t n_blocks; 158 196 rc = block_get_nblocks(dev_handle, &n_blocks); 159 if (rc != EOK) 160 return rc; 197 if (rc != EOK) { 198 block_fini(dev_handle); 199 return rc; 200 } 161 201 162 202 /* Write to backup GPT header location */ 163 203 //FIXME: those idiots thought it would be cool to have these fields in reverse order... 164 rc = block_write_direct(dev_handle, n_blocks - 1, GPT_HDR_BS, gpt->raw_data);204 rc = block_write_direct(dev_handle, n_blocks - 1, GPT_HDR_BS, label->gpt->header); 165 205 block_fini(dev_handle); 166 206 if (rc != EOK) … … 171 211 172 212 /** Alloc partition array */ 173 gpt_partitions_t * 213 gpt_partitions_t * gpt_alloc_partitions() 174 214 { 175 215 return alloc_part_array(128); … … 177 217 178 218 /** Parse partitions from GPT 179 * @param gpt GPT to be parsed 180 * 181 * @return partition linked list pointer or NULL on error 182 * error code is stored in errno 183 */ 184 gpt_partitions_t * gpt_read_partitions(gpt_t * gpt) 219 * @param label GPT label to be parsed 220 * 221 * @return EOK on success, errorcode otherwise 222 */ 223 int gpt_read_partitions(gpt_label_t *label) 185 224 { 186 225 int rc; 187 226 unsigned int i; 188 gpt_partitions_t * res;189 uint32_t fill = uint32_t_le2host(gpt->raw_data->fillries);190 uint 32_t ent_size = uint32_t_le2host(gpt->raw_data->entry_size);191 uint64_t ent_lba = uint64_t_le2host(gpt->raw_data->entry_lba);192 193 res = alloc_part_array(fill);194 if (res == NULL) {195 //errno = ENOMEM; // already set in alloc_part_array()196 return NULL;227 uint32_t fill = uint32_t_le2host(label->gpt->header->fillries); 228 uint32_t ent_size = uint32_t_le2host(label->gpt->header->entry_size); 229 uint64_t ent_lba = uint64_t_le2host(label->gpt->header->entry_lba); 230 231 if (label->parts == NULL) { 232 label->parts = alloc_part_array(fill); 233 if (label->parts == NULL) { 234 return ENOMEM; 235 } 197 236 } 198 237 … … 200 239 * - we don't need more bytes 201 240 * - the size of GPT partition entry can be different to 128 bytes */ 202 rc = block_init(EXCHANGE_SERIALIZE, gpt->device, sizeof(gpt_entry_t)); 203 if (rc != EOK) { 204 gpt_free_partitions(res); 205 errno = rc; 206 return NULL; 207 } 241 rc = block_init(EXCHANGE_SERIALIZE, label->device, sizeof(gpt_entry_t)); 242 if (rc != EOK) 243 goto fail; 208 244 209 245 size_t block_size; 210 rc = block_get_bsize(gpt->device, &block_size); 211 if (rc != EOK) { 212 gpt_free_partitions(res); 213 errno = rc; 214 return NULL; 215 } 246 rc = block_get_bsize(label->device, &block_size); 247 if (rc != EOK) 248 goto fail; 216 249 217 250 //size_t bufpos = 0; … … 226 259 for (i = 0; i < fill; ++i) { 227 260 //FIXME: this does bypass cache... 228 rc = block_read_bytes_direct( gpt->device, pos, sizeof(gpt_entry_t), res->part_array + i);261 rc = block_read_bytes_direct(label->device, pos, sizeof(gpt_entry_t), label->parts->part_array + i); 229 262 //FIXME: but seqread() is just too complex... 230 263 //rc = block_seqread(gpt->device, &bufpos, &buflen, &pos, res->part_array[i], sizeof(gpt_entry_t)); 231 264 pos += ent_size; 232 265 233 if (rc != EOK) { 234 gpt_free_partitions(res); 235 errno = rc; 236 return NULL; 237 } 266 if (rc != EOK) 267 goto fail; 238 268 } 239 269 … … 243 273 * on all of the partition entry array. 244 274 */ 245 uint32_t crc = compute_crc32((uint8_t *) res->part_array, res->fill * sizeof(gpt_entry_t));246 247 if(uint32_t_le2host( gpt->raw_data->pe_array_crc32) != crc)275 uint32_t crc = compute_crc32((uint8_t *) label->parts->part_array, label->parts->fill * sizeof(gpt_entry_t)); 276 277 if(uint32_t_le2host(label->gpt->header->pe_array_crc32) != crc) 248 278 { 249 gpt_free_partitions(res); 250 errno = EBADCHECKSUM; 251 return NULL; 252 } 253 254 return res; 279 rc = EBADCHECKSUM; 280 goto fail; 281 } 282 283 return EOK; 284 285 fail: 286 gpt_free_partitions(label->parts); 287 label->parts = NULL; 288 return rc; 255 289 } 256 290 257 291 /** Write GPT and partitions to device 258 * @param parts partition list to be written 259 * @param header GPT header belonging to the 'parts' partitions 260 * @param dev_handle device to write the data to 261 * 262 * @return returns EOK on succes, specific error code otherwise 263 */ 264 int gpt_write_partitions(gpt_partitions_t * parts, gpt_t * gpt, service_id_t dev_handle) 292 * @param label label to write 293 * @param dev_handle device to write the data to 294 * 295 * @return returns EOK on succes, errorcode otherwise 296 */ 297 int gpt_write_partitions(gpt_label_t *label, service_id_t dev_handle) 265 298 { 266 299 int rc; 267 300 size_t b_size; 268 269 gpt->raw_data->pe_array_crc32 = compute_crc32((uint8_t *) parts->part_array, parts->fill * gpt->raw_data->entry_size); 270 271 rc = block_init(EXCHANGE_ATOMIC, dev_handle, b_size); 301 uint32_t e_size = uint32_t_le2host(label->gpt->header->entry_size); 302 303 label->gpt->header->pe_array_crc32 = compute_crc32( 304 (uint8_t *) label->parts->part_array, 305 label->parts->fill * e_size); 306 307 /* comm_size of 4096 is ignored */ 308 rc = block_init(EXCHANGE_ATOMIC, dev_handle, 4096); 272 309 if (rc != EOK) 273 310 return rc; … … 275 312 rc = block_get_bsize(dev_handle, &b_size); 276 313 if (rc != EOK) 277 return rc;314 goto fail; 278 315 279 316 /* Write to main GPT partition array location */ 280 rc = block_write_direct(dev_handle, uint64_t_le2host(gpt->raw_data->entry_lba), 281 nearest_larger_int((uint64_t_le2host(gpt->raw_data->entry_size) * parts->fill) / b_size), 282 parts->part_array); 283 if (rc != EOK) 284 block_fini(dev_handle); 285 return rc; 317 rc = block_write_direct(dev_handle, uint64_t_le2host(label->gpt->header->entry_lba), 318 nearest_larger_int((uint64_t_le2host(label->gpt->header->entry_size) * label->parts->fill) / b_size), 319 label->parts->part_array); 320 if (rc != EOK) 321 goto fail; 286 322 287 323 aoff64_t n_blocks; 288 324 rc = block_get_nblocks(dev_handle, &n_blocks); 289 325 if (rc != EOK) 290 return rc;326 goto fail; 291 327 292 328 /* Write to backup GPT partition array location */ … … 294 330 block_fini(dev_handle); 295 331 if (rc != EOK) 296 return rc; 297 298 299 return gpt_write_gpt_header(gpt, dev_handle); 332 goto fail; 333 334 335 return gpt_write_header(label, dev_handle); 336 337 fail: 338 block_fini(dev_handle); 339 return rc; 300 340 } 301 341 302 342 /** Alloc new partition 303 343 * 304 * @param parts partition table to carry new partition 305 * 306 * @return returns pointer to the new partition or NULL on ENOMEM 307 * 308 * Note: use either gpt_alloc_partition or gpt_add_partition. The first 309 * returns a pointer to write your data to, the second copies the data 310 * (and does not free the memory). 311 */ 312 gpt_part_t * gpt_alloc_partition(gpt_partitions_t * parts) 313 { 314 if (parts->fill == parts->arr_size) { 315 if (extend_part_array(parts) == -1) 344 * @return returns pointer to the new partition or NULL 345 * 346 * Note: use either gpt_alloc_partition or gpt_get_partition. 347 * This returns a memory block (zero-filled) and needs gpt_add_partition() 348 * to be called to insert it into a partition array. 349 * Requires you to call gpt_free_partition after use. 350 */ 351 gpt_part_t * gpt_alloc_partition(void) 352 { 353 gpt_part_t *p = malloc(sizeof(gpt_part_t)); 354 if (p == NULL) 355 return NULL; 356 357 memset(p, 0, sizeof(gpt_part_t)); 358 359 return p; 360 } 361 362 /** Alloc new partition already inside the label 363 * 364 * @param label label to carry new partition 365 * 366 * @return returns pointer to the new partition or NULL on ENOMEM 367 * 368 * Note: use either gpt_alloc_partition or gpt_get_partition. 369 * This one return a pointer to a structure already inside the array, so 370 * there's no need to call gpt_add_partition(). 371 * This is the one you will usually want. 372 */ 373 gpt_part_t * gpt_get_partition(gpt_label_t *label) 374 { 375 if (label->parts->fill == label->parts->arr_size) { 376 if (extend_part_array(label->parts) == -1) 316 377 return NULL; 317 378 } 318 379 319 return parts->part_array +parts->fill++;380 return label->parts->part_array + label->parts->fill++; 320 381 } 321 382 322 383 /** Copy partition into partition array 323 384 * 324 * @param parts target partition array385 * @param parts target label 325 386 * @param partition source partition to copy 326 387 * 327 388 * @return -1 on error, 0 otherwise 328 389 * 329 * Note: use either gpt_alloc_partition or gpt_add_partition. The first 330 * returns a pointer to write your data to, the second copies the data 331 * (and does not free the memory). 332 */ 333 int gpt_add_partition(gpt_partitions_t * parts, gpt_part_t * partition) 334 { 335 if (parts->fill == parts->arr_size) { 336 if (extend_part_array(parts) == -1) 390 * Note: for use with gpt_alloc_partition() only. You will get 391 * duplicates with gpt_get_partition(). 392 */ 393 int gpt_add_partition(gpt_label_t *label, gpt_part_t *partition) 394 { 395 if (label->parts->fill == label->parts->arr_size) { 396 if (extend_part_array(label->parts) == -1) 337 397 return ENOMEM; 338 398 } 339 extend_part_array(parts); 340 return EOK;; 399 400 memcpy(label->parts->part_array + label->parts->fill++, 401 partition, sizeof(gpt_part_t)); 402 403 return EOK; 341 404 } 342 405 343 406 /** Remove partition from array 344 * 345 * @param idx 346 * 347 * @return -1 on error, 0 otherwise407 * @param label label to remove from 408 * @param idx index of the partition to remove 409 * 410 * @return EOK on success, ENOMEM on array reduction failure 348 411 * 349 412 * Note: even if it fails, the partition still gets removed. Only 350 413 * reducing the array failed. 351 414 */ 352 int gpt_remove_partition(gpt_partitions_t * parts, size_t idx) 353 { 354 if (idx != parts->fill - 1) { 355 memcpy(parts->part_array + idx, parts->part_array + parts->fill - 1, sizeof(gpt_entry_t)); 356 parts->fill -= 1; 357 } 358 359 if (parts->fill < (parts->arr_size / 2) - GPT_IGNORE_FILL_NUM) { 360 if (reduce_part_array(parts) == -1) 361 return -1; 362 } 363 364 return 0; 365 } 366 367 /** free() GPT header including gpt->header_lba */ 368 void gpt_free_gpt(gpt_t * gpt) 369 { 370 free(gpt->raw_data); 371 free(gpt); 415 int gpt_remove_partition(gpt_label_t *label, size_t idx) 416 { 417 if (idx != label->parts->fill - 1) { 418 memmove(label->parts->part_array + idx, 419 label->parts->part_array + idx + 1, 420 (label->parts->fill - 1) * sizeof(gpt_entry_t)); 421 label->parts->fill -= 1; 422 } 423 424 /* FIXME: This probably shouldn't be here, but instead 425 * in reduce_part_array() or similar */ 426 if (label->parts->fill < (label->parts->arr_size / 2) - GPT_IGNORE_FILL_NUM) { 427 if (reduce_part_array(label->parts) == ENOMEM) 428 return ENOMEM; 429 } 430 431 return EOK; 372 432 } 373 433 … … 389 449 size_t i; 390 450 for (i = 0; gpt_ptypes[i].guid != NULL; i++) { 391 if ( gpt_memcmp(p->part_type, gpt_ptypes[i].guid, 16) == 0) {451 if (bcmp(p->part_type, gpt_ptypes[i].guid, 16) == 0) { 392 452 break; 393 453 } … … 449 509 } 450 510 451 511 /** Get partition name */ 452 512 unsigned char * gpt_get_part_name(gpt_part_t * p) 453 513 { … … 561 621 if(p->arr_size > GPT_MIN_PART_NUM) { 562 622 unsigned int nsize = p->arr_size / 2; 623 nsize = nsize > GPT_MIN_PART_NUM ? nsize : GPT_MIN_PART_NUM; 563 624 gpt_entry_t * tmp = malloc(nsize * sizeof(gpt_entry_t)); 564 if(tmp == NULL) { 565 errno = ENOMEM; 566 return -1; 567 } 625 if(tmp == NULL) 626 return ENOMEM; 568 627 569 628 memcpy(tmp, p->part_array, p->fill < nsize ? p->fill : nsize); … … 586 645 } 587 646 588 static int gpt_memcmp(const void * a, const void * b, size_t len) 589 { 590 size_t i; 591 int diff; 592 const unsigned char * x = a; 593 const unsigned char * y = b; 594 595 for (i = 0; i < len; i++) { 596 diff = (int)*(x++) - (int)*(y++); 597 if (diff != 0) { 598 return diff; 599 } 600 } 601 return 0; 602 } 603 604 605 606 647 648 649 650 651 -
uspace/lib/gpt/libgpt.h
r469739f rcb328ab 86 86 typedef struct { 87 87 /** Raw header. Has more bytes alloced than sizeof(gpt_header_t)! 88 * See gpt_read_gpt_header() to know why. */ 89 gpt_header_t * raw_data; 90 /** Device where the data are from */ 91 service_id_t device; 92 /** Linked list of partitions (initially NULL) */ 88 * See gpt_alloc_header() to know why. */ 89 gpt_header_t *header; 93 90 } gpt_t; 94 91 … … 123 120 size_t arr_size; 124 121 /** Resizable partition array */ 125 gpt_entry_t * 122 gpt_entry_t *part_array; 126 123 } gpt_partitions_t; 127 124 128 125 129 126 typedef struct gpt_table { 130 gpt_t * gpt; 131 gpt_partitions_t * parts; 127 gpt_t *gpt; 128 gpt_partitions_t *parts; 129 service_id_t device; 132 130 } gpt_label_t; 133 131 134 132 struct partition_type { 135 const char * 136 const char * 133 const char *desc; 134 const char *guid; 137 135 }; 138 136 139 137 extern const struct partition_type gpt_ptypes[]; 140 138 139 extern gpt_label_t * gpt_alloc_label(void); 140 extern void gpt_free_label(gpt_label_t *); 141 141 142 extern gpt_t * gpt_alloc_ gpt_header(void);143 extern gpt_t * gpt_read_gpt_header(service_id_t dev_handle);144 extern int gpt_write_ gpt_header(gpt_t * header, service_id_t dev_handle);142 extern gpt_t * gpt_alloc_header(size_t); 143 extern int gpt_read_header(gpt_label_t *, service_id_t); 144 extern int gpt_write_header(gpt_label_t *, service_id_t); 145 145 146 146 extern gpt_partitions_t * gpt_alloc_partitions(void); 147 extern gpt_partitions_t * gpt_read_partitions(gpt_t * gpt); 148 extern int gpt_write_partitions(gpt_partitions_t * parts, gpt_t * header, service_id_t dev_handle); 149 extern gpt_part_t * gpt_alloc_partition (gpt_partitions_t * parts); 150 extern int gpt_add_partition (gpt_partitions_t * parts, gpt_part_t * partition); 151 extern int gpt_remove_partition(gpt_partitions_t * parts, size_t idx); 147 extern int gpt_read_partitions (gpt_label_t *); 148 extern int gpt_write_partitions(gpt_label_t *, service_id_t); 149 extern gpt_part_t * gpt_alloc_partition (void); 150 extern gpt_part_t * gpt_get_partition (gpt_label_t *); 151 extern int gpt_add_partition (gpt_label_t *, gpt_part_t *); 152 extern int gpt_remove_partition(gpt_label_t *, size_t); 152 153 153 extern size_t gpt_get_part_type(gpt_part_t * p);154 extern void gpt_set_part_type(gpt_part_t * p, size_t type);155 extern void gpt_set_start_lba(gpt_part_t * p, uint64_t start);156 extern uint64_t gpt_get_start_lba(gpt_part_t * p);157 extern void gpt_set_end_lba (gpt_part_t * p, uint64_t end);158 extern uint64_t gpt_get_end_lba (gpt_part_t * p);159 extern unsigned char * gpt_get_part_name(gpt_part_t * p);160 extern void gpt_set_part_name(gpt_part_t * p, char * name[], size_t length);161 extern bool gpt_get_flag (gpt_part_t * p, GPT_ATTR flag);162 extern void gpt_set_flag (gpt_part_t * p, GPT_ATTR flag, bool value);154 extern size_t gpt_get_part_type(gpt_part_t *); 155 extern void gpt_set_part_type(gpt_part_t *, size_t); 156 extern void gpt_set_start_lba(gpt_part_t *, uint64_t); 157 extern uint64_t gpt_get_start_lba(gpt_part_t *); 158 extern void gpt_set_end_lba (gpt_part_t *, uint64_t); 159 extern uint64_t gpt_get_end_lba (gpt_part_t *); 160 extern unsigned char * gpt_get_part_name(gpt_part_t *); 161 extern void gpt_set_part_name(gpt_part_t *, char *[], size_t); 162 extern bool gpt_get_flag (gpt_part_t *, GPT_ATTR); 163 extern void gpt_set_flag (gpt_part_t *, GPT_ATTR, bool); 163 164 164 165 … … 168 169 iterator < (parts)->part_array + (parts)->fill; ++iterator) 169 170 170 extern void gpt_free_gpt(gpt_t * gpt);171 extern void gpt_free_partitions(gpt_partitions_t * parts);171 extern void gpt_free_gpt(gpt_t *); 172 extern void gpt_free_partitions(gpt_partitions_t *); 172 173 173 174 #endif -
uspace/lib/mbr/libmbr.c
r469739f rcb328ab 92 92 */ 93 93 int mbr_read_mbr(mbr_label_t *label, service_id_t dev_handle) 94 { 95 if (label == NULL) 96 return EINVAL; 97 94 { 98 95 int rc; 99 96
Note:
See TracChangeset
for help on using the changeset viewer.