Changes in uspace/app/hdisk/func_gpt.c [6e8e4e19:a2aa81cb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/hdisk/func_gpt.c
r6e8e4e19 ra2aa81cb 43 43 static int set_gpt_partition(tinput_t *, gpt_part_t *); 44 44 45 46 int construct_gpt_label(label_t *this) 45 int add_gpt_part(tinput_t * in, union label_data * data) 47 46 { 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); 65 48 if (p == NULL) { 66 49 return ENOMEM; … … 70 53 } 71 54 72 int delete_gpt_part( label_t *this, tinput_t * in)55 int delete_gpt_part(tinput_t * in, union label_data * data) 73 56 { 74 57 size_t idx; … … 77 60 idx = get_input_size_t(in); 78 61 79 if (gpt_remove_partition( this->data.gpt->parts, idx) == -1) {62 if (gpt_remove_partition(data->gpt->parts, idx) == -1) { 80 63 printf("Warning: running low on memory, not resizing...\n"); 81 64 } … … 84 67 } 85 68 86 int destroy_gpt_label( label_t *this)69 int destroy_gpt_label(union label_data *data) 87 70 { 88 71 return EOK; 89 72 } 90 73 91 int new_gpt_label( label_t *this)74 int new_gpt_label(union label_data *data) 92 75 { 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(); 95 78 return EOK; 96 79 } 97 80 98 int print_gpt_parts( label_t *this)81 int print_gpt_parts(union label_data *data) 99 82 { 100 83 //int rc; … … 104 87 size_t i = 0; 105 88 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) { 111 90 //printf("\t%10u %10u %10u %3d\n", iter->start_addr, iter->start_addr + iter->length, 112 91 // iter->length, gpt_get_part_type(iter), gpt_get_part_name(iter)); … … 121 100 } 122 101 123 int read_gpt_parts( label_t *this, service_id_t dev_handle)102 int read_gpt_parts(service_id_t dev_handle, union label_data *data) 124 103 { 125 104 return EOK; 126 105 } 127 106 128 int write_gpt_parts( label_t *this, service_id_t dev_handle)107 int write_gpt_parts(service_id_t dev_handle, union label_data * data) 129 108 { 130 109 int rc; 131 110 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); 133 112 if (rc != EOK) { 134 113 printf("Error: Writing partitions failed: %d (%s)\n", rc, str_error(rc)); … … 136 115 } 137 116 138 rc = gpt_write_gpt_header( this->data.gpt->gpt, dev_handle);117 rc = gpt_write_gpt_header(data->gpt->gpt, dev_handle); 139 118 if (rc != EOK) { 140 119 printf("Error: Writing partitions failed: %d (%s)\n", rc, str_error(rc)); … … 145 124 } 146 125 147 int extra_gpt_funcs( label_t *this, tinput_t * in, service_id_t dev_handle)126 int extra_gpt_funcs(tinput_t * in, service_id_t dev_handle, union label_data * data) 148 127 { 149 128 printf("Not implemented.\n");
Note:
See TracChangeset
for help on using the changeset viewer.