Changes in uspace/lib/label/src/gpt.c [b7fd2a0:b33d140] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/label/src/gpt.c
rb7fd2a0 rb33d140 46 46 #include "gpt.h" 47 47 48 static errno_t gpt_open(label_bd_t *, label_t **);49 static errno_t gpt_create(label_bd_t *, label_t **);48 static int gpt_open(label_bd_t *, label_t **); 49 static int gpt_create(label_bd_t *, label_t **); 50 50 static void gpt_close(label_t *); 51 static errno_t gpt_destroy(label_t *);52 static errno_t gpt_get_info(label_t *, label_info_t *);51 static int gpt_destroy(label_t *); 52 static int gpt_get_info(label_t *, label_info_t *); 53 53 static label_part_t *gpt_part_first(label_t *); 54 54 static label_part_t *gpt_part_next(label_part_t *); 55 55 static void gpt_part_get_info(label_part_t *, label_part_info_t *); 56 static errno_t gpt_part_create(label_t *, label_part_spec_t *, label_part_t **);57 static errno_t gpt_part_destroy(label_part_t *);58 static errno_t gpt_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);59 60 static errno_t gpt_check_free_idx(label_t *, int);61 static errno_t gpt_check_free_range(label_t *, uint64_t, uint64_t);56 static int gpt_part_create(label_t *, label_part_spec_t *, label_part_t **); 57 static int gpt_part_destroy(label_part_t *); 58 static int gpt_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *); 59 60 static int gpt_check_free_idx(label_t *, int); 61 static int gpt_check_free_range(label_t *, uint64_t, uint64_t); 62 62 63 63 static void gpt_unused_pte(gpt_entry_t *); 64 static errno_t gpt_part_to_pte(label_part_t *, gpt_entry_t *);65 static errno_t gpt_pte_to_part(label_t *, gpt_entry_t *, int);66 static errno_t gpt_pte_update(label_t *, gpt_entry_t *, int);67 68 static errno_t gpt_update_pt_crc(label_t *, uint32_t);64 static int gpt_part_to_pte(label_part_t *, gpt_entry_t *); 65 static int gpt_pte_to_part(label_t *, gpt_entry_t *, int); 66 static int gpt_pte_update(label_t *, gpt_entry_t *, int); 67 68 static int gpt_update_pt_crc(label_t *, uint32_t); 69 69 static void gpt_hdr_compute_crc(gpt_header_t *, size_t); 70 static errno_t gpt_hdr_get_crc(gpt_header_t *, size_t, uint32_t *);71 72 static errno_t gpt_pmbr_create(label_bd_t *, size_t, uint64_t);73 static errno_t gpt_pmbr_destroy(label_bd_t *, size_t);70 static int gpt_hdr_get_crc(gpt_header_t *, size_t, uint32_t *); 71 72 static int gpt_pmbr_create(label_bd_t *, size_t, uint64_t); 73 static int gpt_pmbr_destroy(label_bd_t *, size_t); 74 74 75 75 const uint8_t efi_signature[8] = { … … 92 92 }; 93 93 94 static errno_t gpt_open(label_bd_t *bd, label_t **rlabel)94 static int gpt_open(label_bd_t *bd, label_t **rlabel) 95 95 { 96 96 label_t *label = NULL; … … 111 111 uint32_t hdr_crc; 112 112 int i, j; 113 errno_t rc;113 int rc; 114 114 115 115 gpt_hdr[0] = NULL; … … 345 345 } 346 346 347 static errno_t gpt_create(label_bd_t *bd, label_t **rlabel)347 static int gpt_create(label_bd_t *bd, label_t **rlabel) 348 348 { 349 349 label_t *label = NULL; … … 362 362 uuid_t disk_uuid; 363 363 int i, j; 364 errno_t rc;364 int rc; 365 365 366 366 rc = bd->ops->get_bsize(bd->arg, &bsize); … … 510 510 } 511 511 512 static errno_t gpt_destroy(label_t *label)512 static int gpt_destroy(label_t *label) 513 513 { 514 514 gpt_header_t *gpt_hdr = NULL; … … 516 516 label_part_t *part; 517 517 int i; 518 errno_t rc;518 int rc; 519 519 520 520 part = gpt_part_first(label); … … 580 580 } 581 581 582 static errno_t gpt_get_info(label_t *label, label_info_t *linfo)582 static int gpt_get_info(label_t *label, label_info_t *linfo) 583 583 { 584 584 memset(linfo, 0, sizeof(label_info_t)); … … 624 624 } 625 625 626 static errno_t gpt_part_create(label_t *label, label_part_spec_t *pspec,626 static int gpt_part_create(label_t *label, label_part_spec_t *pspec, 627 627 label_part_t **rpart) 628 628 { 629 629 label_part_t *part; 630 630 gpt_entry_t pte; 631 errno_t rc;631 int rc; 632 632 633 633 part = calloc(1, sizeof(label_part_t)); … … 696 696 } 697 697 698 static errno_t gpt_part_destroy(label_part_t *part)698 static int gpt_part_destroy(label_part_t *part) 699 699 { 700 700 gpt_entry_t pte; 701 errno_t rc;701 int rc; 702 702 703 703 /* Prepare unused partition table entry */ … … 715 715 } 716 716 717 static errno_t gpt_suggest_ptype(label_t *label, label_pcnt_t pcnt,717 static int gpt_suggest_ptype(label_t *label, label_pcnt_t pcnt, 718 718 label_ptype_t *ptype) 719 719 { 720 720 const char *ptid; 721 errno_t rc;721 int rc; 722 722 723 723 ptid = NULL; … … 748 748 749 749 /** Verify that the specified index is valid and free. */ 750 static errno_t gpt_check_free_idx(label_t *label, int index)750 static int gpt_check_free_idx(label_t *label, int index) 751 751 { 752 752 label_part_t *part; … … 771 771 } 772 772 773 static errno_t gpt_check_free_range(label_t *label, uint64_t block0,773 static int gpt_check_free_range(label_t *label, uint64_t block0, 774 774 uint64_t nblocks) 775 775 { … … 796 796 } 797 797 798 static errno_t gpt_part_to_pte(label_part_t *part, gpt_entry_t *pte)798 static int gpt_part_to_pte(label_part_t *part, gpt_entry_t *pte) 799 799 { 800 800 uint64_t eblock; … … 814 814 } 815 815 816 static errno_t gpt_pte_to_part(label_t *label, gpt_entry_t *pte, int index)816 static int gpt_pte_to_part(label_t *label, gpt_entry_t *pte, int index) 817 817 { 818 818 label_part_t *part; … … 856 856 * @a pte. 857 857 */ 858 static errno_t gpt_pte_update(label_t *label, gpt_entry_t *pte, int index)858 static int gpt_pte_update(label_t *label, gpt_entry_t *pte, int index) 859 859 { 860 860 size_t pos; … … 866 866 uint32_t crc; 867 867 int i; 868 errno_t rc;868 int rc; 869 869 870 870 /* Byte offset of partition entry */ … … 921 921 } 922 922 923 static errno_t gpt_update_pt_crc(label_t *label, uint32_t crc)923 static int gpt_update_pt_crc(label_t *label, uint32_t crc) 924 924 { 925 925 gpt_header_t *gpt_hdr; 926 errno_t rc;926 int rc; 927 927 int i; 928 928 … … 968 968 } 969 969 970 static errno_t gpt_hdr_get_crc(gpt_header_t *hdr, size_t hdr_size, uint32_t *crc)970 static int gpt_hdr_get_crc(gpt_header_t *hdr, size_t hdr_size, uint32_t *crc) 971 971 { 972 972 gpt_header_t *c; … … 985 985 986 986 /** Create GPT Protective MBR */ 987 static errno_t gpt_pmbr_create(label_bd_t *bd, size_t bsize, uint64_t nblocks)987 static int gpt_pmbr_create(label_bd_t *bd, size_t bsize, uint64_t nblocks) 988 988 { 989 989 mbr_br_block_t *pmbr = NULL; 990 990 uint64_t pmbr_nb; 991 errno_t rc;991 int rc; 992 992 993 993 pmbr = calloc(1, bsize); … … 1023 1023 1024 1024 /** Destroy GPT Protective MBR */ 1025 static errno_t gpt_pmbr_destroy(label_bd_t *bd, size_t bsize)1025 static int gpt_pmbr_destroy(label_bd_t *bd, size_t bsize) 1026 1026 { 1027 1027 mbr_br_block_t *pmbr = NULL; 1028 errno_t rc;1028 int rc; 1029 1029 1030 1030 pmbr = calloc(1, bsize);
Note:
See TracChangeset
for help on using the changeset viewer.