Changeset dc76f4a in mainline for uspace/app/hdisk/func_gpt.c


Ignore:
Timestamp:
2013-07-29T00:48:51Z (12 years ago)
Author:
Dominik Taborsky (AT DOT) <brembyseznamcz>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
675de6d
Parents:
c3cbbb2
Message:

libmbr, libgpt polishing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/hdisk/func_gpt.c

    rc3cbbb2 rdc76f4a  
    4242#include "input.h"
    4343
    44 static int set_gpt_partition(tinput_t *, gpt_part_t *);
     44static int set_gpt_partition(tinput_t *, gpt_part_t *, unsigned int);
    4545
    4646int construct_gpt_label(label_t *this)
     
    6868        }
    6969       
    70         return set_gpt_partition(in, p);
     70        return set_gpt_partition(in, p, this->alignment);
    7171}
    7272
     
    8080       
    8181        rc = gpt_remove_partition(this->data.gpt, idx);
    82         if (rc != EOK) {
     82        if (rc == ENOMEM) {
    8383                printf("Warning: running low on memory, not resizing...\n");
    8484                return rc;
     85        } else if (rc == EINVAL) {
     86                printf("Invalid index.\n");
     87                return rc;
    8588        }
    8689       
     
    102105int print_gpt_parts(label_t *this)
    103106{
    104         //int rc;
    105107        printf("Current partition scheme (GPT):\n");
    106         printf("\t\tStart:\tEnd:\tLength:\tType:\tName:\n");
     108        printf("%15s %10s %10s Type: Name:\n", "Start:", "End:", "Length:");
    107109       
    108110        size_t i = 0;
     
    117119                        printf("%15s %10s %10s Type: Name:\n", "Start:", "End:", "Length:");
    118120               
    119                 //printf("\t%10u %10u %10u %3d\n", iter->start_addr, iter->start_addr + iter->length,
    120                 //              iter->length, gpt_get_part_type(iter), gpt_get_part_name(iter));
     121               
    121122                printf("%3u  %10llu %10llu %10llu    %3d %s\n", i-1, gpt_get_start_lba(iter), gpt_get_end_lba(iter),
    122123                                gpt_get_end_lba(iter) - gpt_get_start_lba(iter), gpt_get_part_type(iter),
     
    125126        }
    126127       
    127         //return rc;
    128128        return EOK;
    129129}
     
    173173}
    174174
    175 static int set_gpt_partition(tinput_t *in, gpt_part_t *p)
     175static int set_gpt_partition(tinput_t *in, gpt_part_t *p, unsigned int alignment)
    176176{
    177177        int rc;
     
    181181        printf("Set starting address (number): ");
    182182        sa = get_input_uint64(in);
     183        if (sa % alignment != 0)
     184                sa = gpt_get_next_aligned(sa, alignment);
    183185       
    184186        printf("Set end addres (number): ");
Note: See TracChangeset for help on using the changeset viewer.