Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/label/src/gpt.c

    rb33d140 rb7fd2a0  
    4646#include "gpt.h"
    4747
    48 static int gpt_open(label_bd_t *, label_t **);
    49 static int gpt_create(label_bd_t *, label_t **);
     48static errno_t gpt_open(label_bd_t *, label_t **);
     49static errno_t gpt_create(label_bd_t *, label_t **);
    5050static void gpt_close(label_t *);
    51 static int gpt_destroy(label_t *);
    52 static int gpt_get_info(label_t *, label_info_t *);
     51static errno_t gpt_destroy(label_t *);
     52static errno_t gpt_get_info(label_t *, label_info_t *);
    5353static label_part_t *gpt_part_first(label_t *);
    5454static label_part_t *gpt_part_next(label_part_t *);
    5555static void gpt_part_get_info(label_part_t *, label_part_info_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);
     56static errno_t gpt_part_create(label_t *, label_part_spec_t *, label_part_t **);
     57static errno_t gpt_part_destroy(label_part_t *);
     58static errno_t gpt_suggest_ptype(label_t *, label_pcnt_t, label_ptype_t *);
     59
     60static errno_t gpt_check_free_idx(label_t *, int);
     61static errno_t gpt_check_free_range(label_t *, uint64_t, uint64_t);
    6262
    6363static void gpt_unused_pte(gpt_entry_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);
     64static errno_t gpt_part_to_pte(label_part_t *, gpt_entry_t *);
     65static errno_t gpt_pte_to_part(label_t *, gpt_entry_t *, int);
     66static errno_t gpt_pte_update(label_t *, gpt_entry_t *, int);
     67
     68static errno_t gpt_update_pt_crc(label_t *, uint32_t);
    6969static void gpt_hdr_compute_crc(gpt_header_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);
     70static errno_t gpt_hdr_get_crc(gpt_header_t *, size_t, uint32_t *);
     71
     72static errno_t gpt_pmbr_create(label_bd_t *, size_t, uint64_t);
     73static errno_t gpt_pmbr_destroy(label_bd_t *, size_t);
    7474
    7575const uint8_t efi_signature[8] = {
     
    9292};
    9393
    94 static int gpt_open(label_bd_t *bd, label_t **rlabel)
     94static errno_t gpt_open(label_bd_t *bd, label_t **rlabel)
    9595{
    9696        label_t *label = NULL;
     
    111111        uint32_t hdr_crc;
    112112        int i, j;
    113         int rc;
     113        errno_t rc;
    114114
    115115        gpt_hdr[0] = NULL;
     
    345345}
    346346
    347 static int gpt_create(label_bd_t *bd, label_t **rlabel)
     347static errno_t gpt_create(label_bd_t *bd, label_t **rlabel)
    348348{
    349349        label_t *label = NULL;
     
    362362        uuid_t disk_uuid;
    363363        int i, j;
    364         int rc;
     364        errno_t rc;
    365365
    366366        rc = bd->ops->get_bsize(bd->arg, &bsize);
     
    510510}
    511511
    512 static int gpt_destroy(label_t *label)
     512static errno_t gpt_destroy(label_t *label)
    513513{
    514514        gpt_header_t *gpt_hdr = NULL;
     
    516516        label_part_t *part;
    517517        int i;
    518         int rc;
     518        errno_t rc;
    519519
    520520        part = gpt_part_first(label);
     
    580580}
    581581
    582 static int gpt_get_info(label_t *label, label_info_t *linfo)
     582static errno_t gpt_get_info(label_t *label, label_info_t *linfo)
    583583{
    584584        memset(linfo, 0, sizeof(label_info_t));
     
    624624}
    625625
    626 static int gpt_part_create(label_t *label, label_part_spec_t *pspec,
     626static errno_t gpt_part_create(label_t *label, label_part_spec_t *pspec,
    627627    label_part_t **rpart)
    628628{
    629629        label_part_t *part;
    630630        gpt_entry_t pte;
    631         int rc;
     631        errno_t rc;
    632632
    633633        part = calloc(1, sizeof(label_part_t));
     
    696696}
    697697
    698 static int gpt_part_destroy(label_part_t *part)
     698static errno_t gpt_part_destroy(label_part_t *part)
    699699{
    700700        gpt_entry_t pte;
    701         int rc;
     701        errno_t rc;
    702702
    703703        /* Prepare unused partition table entry */
     
    715715}
    716716
    717 static int gpt_suggest_ptype(label_t *label, label_pcnt_t pcnt,
     717static errno_t gpt_suggest_ptype(label_t *label, label_pcnt_t pcnt,
    718718    label_ptype_t *ptype)
    719719{
    720720        const char *ptid;
    721         int rc;
     721        errno_t rc;
    722722
    723723        ptid = NULL;
     
    748748
    749749/** Verify that the specified index is valid and free. */
    750 static int gpt_check_free_idx(label_t *label, int index)
     750static errno_t gpt_check_free_idx(label_t *label, int index)
    751751{
    752752        label_part_t *part;
     
    771771}
    772772
    773 static int gpt_check_free_range(label_t *label, uint64_t block0,
     773static errno_t gpt_check_free_range(label_t *label, uint64_t block0,
    774774    uint64_t nblocks)
    775775{
     
    796796}
    797797
    798 static int gpt_part_to_pte(label_part_t *part, gpt_entry_t *pte)
     798static errno_t gpt_part_to_pte(label_part_t *part, gpt_entry_t *pte)
    799799{
    800800        uint64_t eblock;
     
    814814}
    815815
    816 static int gpt_pte_to_part(label_t *label, gpt_entry_t *pte, int index)
     816static errno_t gpt_pte_to_part(label_t *label, gpt_entry_t *pte, int index)
    817817{
    818818        label_part_t *part;
     
    856856 * @a pte.
    857857 */
    858 static int gpt_pte_update(label_t *label, gpt_entry_t *pte, int index)
     858static errno_t gpt_pte_update(label_t *label, gpt_entry_t *pte, int index)
    859859{
    860860        size_t pos;
     
    866866        uint32_t crc;
    867867        int i;
    868         int rc;
     868        errno_t rc;
    869869
    870870        /* Byte offset of partition entry */
     
    921921}
    922922
    923 static int gpt_update_pt_crc(label_t *label, uint32_t crc)
     923static errno_t gpt_update_pt_crc(label_t *label, uint32_t crc)
    924924{
    925925        gpt_header_t *gpt_hdr;
    926         int rc;
     926        errno_t rc;
    927927        int i;
    928928
     
    968968}
    969969
    970 static int gpt_hdr_get_crc(gpt_header_t *hdr, size_t hdr_size, uint32_t *crc)
     970static errno_t gpt_hdr_get_crc(gpt_header_t *hdr, size_t hdr_size, uint32_t *crc)
    971971{
    972972        gpt_header_t *c;
     
    985985
    986986/** Create GPT Protective MBR */
    987 static int gpt_pmbr_create(label_bd_t *bd, size_t bsize, uint64_t nblocks)
     987static errno_t gpt_pmbr_create(label_bd_t *bd, size_t bsize, uint64_t nblocks)
    988988{
    989989        mbr_br_block_t *pmbr = NULL;
    990990        uint64_t pmbr_nb;
    991         int rc;
     991        errno_t rc;
    992992
    993993        pmbr = calloc(1, bsize);
     
    10231023
    10241024/** Destroy GPT Protective MBR */
    1025 static int gpt_pmbr_destroy(label_bd_t *bd, size_t bsize)
     1025static errno_t gpt_pmbr_destroy(label_bd_t *bd, size_t bsize)
    10261026{
    10271027        mbr_br_block_t *pmbr = NULL;
    1028         int rc;
     1028        errno_t rc;
    10291029
    10301030        pmbr = calloc(1, bsize);
Note: See TracChangeset for help on using the changeset viewer.