Changeset 271e24a in mainline for uspace/lib/gpt/libgpt.c


Ignore:
Timestamp:
2013-03-24T00:12:25Z (11 years ago)
Author:
Dominik Taborsky (AT DOT) <brembyseznamcz>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
30440ed
Parents:
ec50ac4a
Message:

hdisk - testing libmbr

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gpt/libgpt.c

    rec50ac4a r271e24a  
    5252
    5353static int load_and_check_header(service_id_t handle, aoff64_t addr, size_t b_size, gpt_header_t * header);
    54 static gpt_parts_t * alloc_part_array(uint32_t num);
    55 static int extend_part_array(gpt_parts_t * p);
    56 static int reduce_part_array(gpt_parts_t * p);
     54static gpt_partitions_t * alloc_part_array(uint32_t num);
     55static int extend_part_array(gpt_partitions_t * p);
     56static int reduce_part_array(gpt_partitions_t * p);
    5757static long long nearest_larger_int(double a);
    5858
     
    162162 *                              error code is stored in errno
    163163 */
    164 gpt_parts_t * gpt_read_partitions(gpt_t * gpt)
     164gpt_partitions_t * gpt_read_partitions(gpt_t * gpt)
    165165{
    166166        int rc;
    167167        unsigned int i;
    168         gpt_parts_t * res;
     168        gpt_partitions_t * res;
    169169        uint32_t num_ent = uint32_t_le2host(gpt->raw_data->num_entries);
    170170        uint32_t ent_size = uint32_t_le2host(gpt->raw_data->entry_size);
     
    242242 * @return                              returns EOK on succes, specific error code otherwise
    243243 */
    244 int gpt_write_partitions(gpt_parts_t * parts, gpt_t * gpt, service_id_t dev_handle)
     244int gpt_write_partitions(gpt_partitions_t * parts, gpt_t * gpt, service_id_t dev_handle)
    245245{
    246246        int rc;
     
    283283}
    284284
    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        
     285gpt_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
     292gpt_partitions_t * gpt_remove_partition(gpt_partitions_t * parts, size_t idx)
     293{
     294        reduce_part_array(parts);
     295        return parts;
    293296}
    294297
     
    304307 * @param parts         partition list to be freed
    305308 */
    306 void gpt_free_partitions(gpt_parts_t * parts)
     309void gpt_free_partitions(gpt_partitions_t * parts)
    307310{
    308311        free(parts->part_array);
     
    316319 *
    317320 */
    318 void gpt_set_part_type(g_part_t * p, int type)
     321void gpt_set_part_type(gpt_part_t * p, int type)
    319322{
    320323        /* Beware: first 3 blocks are byteswapped! */
     
    386389}
    387390
    388 static gpt_parts_t * alloc_part_array(uint32_t num)
    389 {
    390         gpt_parts_t * res = malloc(sizeof(gpt_parts_t));
     391static gpt_partitions_t * alloc_part_array(uint32_t num)
     392{
     393        gpt_partitions_t * res = malloc(sizeof(gpt_partitions_t));
    391394        if (res == NULL) {
    392395                errno = ENOMEM;
     
    408411}
    409412
    410 static int extend_part_array(gpt_parts_t * p)
     413static int extend_part_array(gpt_partitions_t * p)
    411414{
    412415        unsigned int nsize = p->arr_size * 2;
     
    425428}
    426429
    427 static int reduce_part_array(gpt_parts_t * p)
     430static int reduce_part_array(gpt_partitions_t * p)
    428431{
    429432        if(p->arr_size > GPT_MIN_PART_NUM) {
Note: See TracChangeset for help on using the changeset viewer.