Changeset 283ea3d in mainline for uspace/app/hdisk/func_gpt.c
- Timestamp:
- 2013-07-28T22:52:16Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3bc355
- Parents:
- 8559fa0 (diff), 675de6d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/hdisk/func_gpt.c
r8559fa0 r283ea3d 42 42 #include "input.h" 43 43 44 static int set_gpt_partition(tinput_t *, gpt_part_t *); 45 44 static int set_gpt_partition(tinput_t *, gpt_part_t *, unsigned int); 46 45 47 46 int construct_gpt_label(label_t *this) … … 50 49 this->alignment = 1; 51 50 52 this->add_part = add_gpt_part; 53 this->delete_part = delete_gpt_part; 54 this->new_label = new_gpt_label; 55 this->print_parts = print_gpt_parts; 56 this->read_parts = read_gpt_parts; 57 this->write_parts = write_gpt_parts; 58 this->extra_funcs = extra_gpt_funcs; 51 this->add_part = add_gpt_part; 52 this->delete_part = delete_gpt_part; 53 this->destroy_label = destroy_gpt_label; 54 this->new_label = new_gpt_label; 55 this->print_parts = print_gpt_parts; 56 this->read_parts = read_gpt_parts; 57 this->write_parts = write_gpt_parts; 58 this->extra_funcs = extra_gpt_funcs; 59 59 60 60 return this->new_label(this); … … 68 68 } 69 69 70 return set_gpt_partition(in, p );70 return set_gpt_partition(in, p, this->alignment); 71 71 } 72 72 … … 80 80 81 81 rc = gpt_remove_partition(this->data.gpt, idx); 82 if (rc != EOK) {82 if (rc == ENOMEM) { 83 83 printf("Warning: running low on memory, not resizing...\n"); 84 84 return rc; 85 } else if (rc == EINVAL) { 86 printf("Invalid index.\n"); 87 return rc; 85 88 } 86 89 … … 102 105 int print_gpt_parts(label_t *this) 103 106 { 104 //int rc;105 107 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:"); 107 109 108 110 size_t i = 0; … … 110 112 gpt_part_foreach(this->data.gpt, iter) { 111 113 i++; 112 //FIXMEE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!114 113 115 if (gpt_get_part_type(iter) == GPT_PTE_UNUSED) 114 116 continue; … … 117 119 printf("%15s %10s %10s Type: Name:\n", "Start:", "End:", "Length:"); 118 120 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 121 122 printf("%3u %10llu %10llu %10llu %3d %s\n", i-1, gpt_get_start_lba(iter), gpt_get_end_lba(iter), 122 123 gpt_get_end_lba(iter) - gpt_get_start_lba(iter), gpt_get_part_type(iter), 123 124 gpt_get_part_name(iter)); 124 }125 126 //return rc;125 126 } 127 127 128 return EOK; 128 129 } … … 172 173 } 173 174 174 static int set_gpt_partition(tinput_t *in, gpt_part_t *p )175 static int set_gpt_partition(tinput_t *in, gpt_part_t *p, unsigned int alignment) 175 176 { 176 177 int rc; … … 180 181 printf("Set starting address (number): "); 181 182 sa = get_input_uint64(in); 183 if (sa % alignment != 0) 184 sa = gpt_get_next_aligned(sa, alignment); 182 185 183 186 printf("Set end addres (number): "); … … 192 195 gpt_set_end_lba(p, ea); 193 196 197 //printf("Set type : "); 198 //size_t idx = get_input_size_t(in); 199 //gpt_set_part_type(p, idx); 200 201 gpt_set_random_uuid(p->part_type); 202 gpt_set_random_uuid(p->part_id); 194 203 195 204 char *name; … … 201 210 } 202 211 203 printf("name: %s, len: %d\n", name, str_size(name));204 212 gpt_set_part_name(p, name, str_size(name)); 205 213
Note:
See TracChangeset
for help on using the changeset viewer.