Ignore:
File:
1 edited

Legend:

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

    r6e8e4e19 ra2aa81cb  
    4343static int set_gpt_partition(tinput_t *, gpt_part_t *);
    4444
    45 
    46 int construct_gpt_label(label_t *this)
     45int add_gpt_part(tinput_t * in, union label_data * data)
    4746{
    48         this->layout = LYT_GPT;
    49         this->alignment = 1;
    50        
    51         this->add_part    = add_gpt_part;
    52         this->delete_part = delete_gpt_part;
    53         this->new_label   = new_gpt_label;
    54         this->print_parts = print_gpt_parts;
    55         this->read_parts  = read_gpt_parts;
    56         this->write_parts = write_gpt_parts;
    57         this->extra_funcs = extra_gpt_funcs;
    58        
    59         return this->new_label(this);
    60 }
    61 
    62 int add_gpt_part(label_t *this, tinput_t * in)
    63 {
    64         gpt_part_t * p = gpt_alloc_partition(this->data.gpt->parts);
     47        gpt_part_t * p = gpt_alloc_partition(data->gpt->parts);
    6548        if (p == NULL) {
    6649                return ENOMEM;
     
    7053}
    7154
    72 int delete_gpt_part(label_t *this, tinput_t * in)
     55int delete_gpt_part(tinput_t * in, union label_data * data)
    7356{
    7457        size_t idx;
     
    7760        idx = get_input_size_t(in);
    7861
    79         if (gpt_remove_partition(this->data.gpt->parts, idx) == -1) {
     62        if (gpt_remove_partition(data->gpt->parts, idx) == -1) {
    8063                printf("Warning: running low on memory, not resizing...\n");
    8164        }
     
    8467}
    8568
    86 int destroy_gpt_label(label_t *this)
     69int destroy_gpt_label(union label_data *data)
    8770{
    8871        return EOK;
    8972}
    9073
    91 int new_gpt_label(label_t *this)
     74int new_gpt_label(union label_data *data)
    9275{
    93         this->data.gpt->gpt = gpt_alloc_gpt_header();
    94         this->data.gpt->parts = gpt_alloc_partitions();
     76        data->gpt->gpt = gpt_alloc_gpt_header();
     77        data->gpt->parts = gpt_alloc_partitions();
    9578        return EOK;
    9679}
    9780
    98 int print_gpt_parts(label_t *this)
     81int print_gpt_parts(union label_data *data)
    9982{
    10083        //int rc;
     
    10487        size_t i = 0;
    10588       
    106         gpt_part_foreach(this->data.gpt->parts, iter) {
    107                 //FIXMEE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    108                 if (gpt_get_part_type(iter) == 62)
    109                         continue;
    110                
     89        gpt_part_foreach(data->gpt->parts, iter) {
    11190                //printf("\t%10u %10u %10u %3d\n", iter->start_addr, iter->start_addr + iter->length,
    11291                //              iter->length, gpt_get_part_type(iter), gpt_get_part_name(iter));
     
    121100}
    122101
    123 int read_gpt_parts(label_t *this, service_id_t dev_handle)
     102int read_gpt_parts(service_id_t dev_handle, union label_data *data)
    124103{
    125104        return EOK;
    126105}
    127106
    128 int write_gpt_parts(label_t *this, service_id_t dev_handle)
     107int write_gpt_parts(service_id_t dev_handle, union label_data * data)
    129108{
    130109        int rc;
    131110
    132         rc = gpt_write_partitions(this->data.gpt->parts, this->data.gpt->gpt, dev_handle);
     111        rc = gpt_write_partitions(data->gpt->parts, data->gpt->gpt, dev_handle);
    133112        if (rc != EOK) {
    134113                printf("Error: Writing partitions failed: %d (%s)\n", rc, str_error(rc));
     
    136115        }
    137116
    138         rc = gpt_write_gpt_header(this->data.gpt->gpt, dev_handle);
     117        rc = gpt_write_gpt_header(data->gpt->gpt, dev_handle);
    139118        if (rc != EOK) {
    140119                printf("Error: Writing partitions failed: %d (%s)\n", rc, str_error(rc));
     
    145124}
    146125
    147 int extra_gpt_funcs(label_t *this, tinput_t * in, service_id_t dev_handle)
     126int extra_gpt_funcs(tinput_t * in, service_id_t dev_handle, union label_data * data)
    148127{
    149128        printf("Not implemented.\n");
Note: See TracChangeset for help on using the changeset viewer.