Changeset 8f6c7785 in mainline for uspace/app/hdisk/func_gpt.c


Ignore:
Timestamp:
2013-04-26T02:55:32Z (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:
700f89e
Parents:
d617050
Message:

logical write functional

File:
1 edited

Legend:

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

    rd617050 r8f6c7785  
    4949                return ENOMEM;
    5050        }
    51        
     51
    5252        return set_gpt_partition(in, p);
    5353}
     
    5959        printf("Number of the partition to delete (counted from 0): ");
    6060        idx = get_input_size_t(in);
    61        
     61
    6262        if (gpt_remove_partition(data->gpt.parts, idx) == -1) {
    6363                printf("Warning: running low on memory, not resizing...\n");
    6464        }
    65        
     65
    6666        return EOK;
    6767}
     
    6969int print_gpt_parts(union table_data * data)
    7070{
     71        //int rc;
    7172        printf("Current partition scheme (GPT):\n");
    7273        printf("\t\tStart:\tEnd:\tLength:\tType:\tName:\n");
    7374       
    74         gpt_foreach(data->gpt.parts, i, iter) {
    75                 printf("\t%10u %10u %10u %3d\n", iter->start_addr, iter->start_addr + iter->length,
    76                                 iter->length, gpt_get_part_type(iter), gpt_get_part_name(iter));
     75        size_t i = 0;
     76       
     77        gpt_part_foreach(data->gpt.parts, iter) {
     78                //printf("\t%10u %10u %10u %3d\n", iter->start_addr, iter->start_addr + iter->length,
     79                //              iter->length, gpt_get_part_type(iter), gpt_get_part_name(iter));
     80                printf("%3u\t%10llu %10llu %10llu %3d %s\n", i, gpt_get_start_lba(iter), gpt_get_end_lba(iter),
     81                                gpt_get_end_lba(iter) - gpt_get_start_lba(iter), gpt_get_part_type(iter),
     82                                gpt_get_part_name(iter));
     83                i++;
    7784        }
    78        
    79         return rc;
     85
     86        //return rc;
     87        return EOK;
    8088}
    8189
     
    8391{
    8492        int rc;
    85        
     93
    8694        rc = gpt_write_partitions(data->gpt.parts, data->gpt.gpt, dev_handle);
    8795        if (rc != EOK) {
     
    8997                return rc;
    9098        }
    91        
     99
    92100        rc = gpt_write_gpt_header(data->gpt.gpt, dev_handle);
    93101        if (rc != EOK) {
     
    95103                return rc;
    96104        }
    97        
     105
    98106        return EOK;
    99107}
     
    106114static int set_gpt_partition(tinput_t * in, gpt_part_t * p)
    107115{
    108         int rc;
    109        
     116        //int rc;
     117
    110118        uint64_t sa, ea;
    111        
     119
    112120        printf("Set starting address (number): ");
    113121        sa = get_input_uint64(in);
     
    115123        printf("Set end addres (number): ");
    116124        ea = get_input_uint64(in);
    117        
     125
    118126        if (ea <= sa) {
    119127                printf("Invalid value.\n");
    120128                return EINVAL;
    121129        }
    122        
    123        
    124         p->start_addr = sa;
    125         p->length = ea - sa;
    126        
     130
     131
     132        //p->start_addr = sa;
     133        gpt_set_start_lba(p, sa);
     134        //p->length = ea - sa;
     135        gpt_set_end_lba(p, ea);
     136
    127137        return EOK;
    128138}
Note: See TracChangeset for help on using the changeset viewer.