Changeset f57ccb5 in mainline for uspace/lib/label/src/gpt.c
- Timestamp:
- 2015-08-11T16:03:59Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0bde8523
- Parents:
- 1b23e33
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/label/src/gpt.c
r1b23e33 rf57ccb5 55 55 static int gpt_part_create(label_t *, label_part_spec_t *, label_part_t **); 56 56 static int gpt_part_destroy(label_part_t *); 57 static int gpt_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *); 57 58 58 59 static void gpt_unused_pte(gpt_entry_t *); … … 80 81 .part_get_info = gpt_part_get_info, 81 82 .part_create = gpt_part_create, 82 .part_destroy = gpt_part_destroy 83 .part_destroy = gpt_part_destroy, 84 .suggest_ptype = gpt_suggest_ptype 83 85 }; 84 86 … … 547 549 linfo->dcnt = dc_label; 548 550 linfo->ltype = lt_gpt; 549 linfo->flags = 0;551 linfo->flags = lf_ptype_uuid; /* Partition type is in UUID format */ 550 552 if (gpt_can_create_pri(label)) 551 553 linfo->flags = linfo->flags | lf_can_create_pri; … … 607 609 /* GPT only has primary partitions */ 608 610 if (pspec->pkind != lpk_primary) { 611 rc = EINVAL; 612 goto error; 613 } 614 615 /* Partition type must be in UUID format */ 616 if (pspec->ptype.fmt != lptf_uuid) { 609 617 rc = EINVAL; 610 618 goto error; … … 663 671 } 664 672 673 static int gpt_suggest_ptype(label_t *label, label_pcnt_t pcnt, 674 label_ptype_t *ptype) 675 { 676 const char *ptid; 677 int rc; 678 679 ptid = NULL; 680 681 switch (pcnt) { 682 case lpc_fat12_16: 683 case lpc_exfat: 684 case lpc_fat32: 685 ptid = GPT_MS_BASIC_DATA; 686 break; 687 case lpc_ext4: 688 ptid = GPT_LINUX_FS_DATA; 689 break; 690 case lpc_minix: 691 ptid = GPT_MINIX_FAKE; 692 break; 693 } 694 695 if (ptid == NULL) 696 return EINVAL; 697 698 ptype->fmt = lptf_uuid; 699 rc = uuid_parse(ptid, &ptype->t.uuid, NULL); 700 assert(rc == EOK); 701 702 return EOK; 703 } 704 665 705 static void gpt_unused_pte(gpt_entry_t *pte) 666 706 { … … 677 717 678 718 memset(pte, 0, sizeof(gpt_entry_t)); 679 pte->part_type[0] = 0x12;719 uuid_encode(&part->ptype.t.uuid, pte->part_type); 680 720 uuid_encode(&part->part_uuid, pte->part_id); 681 721 pte->start_lba = host2uint64_t_le(part->block0); … … 713 753 part->block0 = b0; 714 754 part->nblocks = b1 - b0 + 1; 755 part->ptype.fmt = lptf_uuid; 756 uuid_decode(pte->part_type, &part->ptype.t.uuid); 715 757 uuid_decode(pte->part_id, &part->part_uuid); 716 758
Note:
See TracChangeset
for help on using the changeset viewer.