Ignore:
File:
1 edited

Legend:

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

    ra2aa81cb r6e8e4e19  
    4343static int set_gpt_partition(tinput_t *, gpt_part_t *);
    4444
    45 int add_gpt_part(tinput_t * in, union label_data * data)
     45
     46int construct_gpt_label(label_t *this)
    4647{
    47         gpt_part_t * p = gpt_alloc_partition(data->gpt->parts);
     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
     62int add_gpt_part(label_t *this, tinput_t * in)
     63{
     64        gpt_part_t * p = gpt_alloc_partition(this->data.gpt->parts);
    4865        if (p == NULL) {
    4966                return ENOMEM;
     
    5370}
    5471
    55 int delete_gpt_part(tinput_t * in, union label_data * data)
     72int delete_gpt_part(label_t *this, tinput_t * in)
    5673{
    5774        size_t idx;
     
    6077        idx = get_input_size_t(in);
    6178
    62         if (gpt_remove_partition(data->gpt->parts, idx) == -1) {
     79        if (gpt_remove_partition(this->data.gpt->parts, idx) == -1) {
    6380                printf("Warning: running low on memory, not resizing...\n");
    6481        }
     
    6784}
    6885
    69 int destroy_gpt_label(union label_data *data)
     86int destroy_gpt_label(label_t *this)
    7087{
    7188        return EOK;
    7289}
    7390
    74 int new_gpt_label(union label_data *data)
     91int new_gpt_label(label_t *this)
    7592{
    76         data->gpt->gpt = gpt_alloc_gpt_header();
    77         data->gpt->parts = gpt_alloc_partitions();
     93        this->data.gpt->gpt = gpt_alloc_gpt_header();
     94        this->data.gpt->parts = gpt_alloc_partitions();
    7895        return EOK;
    7996}
    8097
    81 int print_gpt_parts(union label_data *data)
     98int print_gpt_parts(label_t *this)
    8299{
    83100        //int rc;
     
    87104        size_t i = 0;
    88105       
    89         gpt_part_foreach(data->gpt->parts, iter) {
     106        gpt_part_foreach(this->data.gpt->parts, iter) {
     107                //FIXMEE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     108                if (gpt_get_part_type(iter) == 62)
     109                        continue;
     110               
    90111                //printf("\t%10u %10u %10u %3d\n", iter->start_addr, iter->start_addr + iter->length,
    91112                //              iter->length, gpt_get_part_type(iter), gpt_get_part_name(iter));
     
    100121}
    101122
    102 int read_gpt_parts(service_id_t dev_handle, union label_data *data)
     123int read_gpt_parts(label_t *this, service_id_t dev_handle)
    103124{
    104125        return EOK;
    105126}
    106127
    107 int write_gpt_parts(service_id_t dev_handle, union label_data * data)
     128int write_gpt_parts(label_t *this, service_id_t dev_handle)
    108129{
    109130        int rc;
    110131
    111         rc = gpt_write_partitions(data->gpt->parts, data->gpt->gpt, dev_handle);
     132        rc = gpt_write_partitions(this->data.gpt->parts, this->data.gpt->gpt, dev_handle);
    112133        if (rc != EOK) {
    113134                printf("Error: Writing partitions failed: %d (%s)\n", rc, str_error(rc));
     
    115136        }
    116137
    117         rc = gpt_write_gpt_header(data->gpt->gpt, dev_handle);
     138        rc = gpt_write_gpt_header(this->data.gpt->gpt, dev_handle);
    118139        if (rc != EOK) {
    119140                printf("Error: Writing partitions failed: %d (%s)\n", rc, str_error(rc));
     
    124145}
    125146
    126 int extra_gpt_funcs(tinput_t * in, service_id_t dev_handle, union label_data * data)
     147int extra_gpt_funcs(label_t *this, tinput_t * in, service_id_t dev_handle)
    127148{
    128149        printf("Not implemented.\n");
Note: See TracChangeset for help on using the changeset viewer.