Changeset 2323 in MondoRescue for branches/2.2.10/mondo/src/common/libmondo-mountlist.c
- Timestamp:
- Aug 18, 2009, 3:05:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-mountlist.c
r2316 r2323 73 73 /*@ initialize ***************************************************** */ 74 74 prev_part_no = 0; 75 mr_asprintf( &flaws_str, "%s", "");75 mr_asprintf(flaws_str, "%s", ""); 76 76 77 77 … … 79 79 80 80 if (physical_drive_size < 0) { 81 mr_asprintf( &tmp, " %s does not exist.", drive);81 mr_asprintf(tmp, " %s does not exist.", drive); 82 82 mr_strcat(flaws_str, "%s", tmp); 83 83 } else { 84 mr_asprintf( &tmp, "%s is %ld MB", drive, physical_drive_size);84 mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size); 85 85 } 86 86 log_it(tmp); … … 90 90 /* check DD */ 91 91 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 92 mr_asprintf( &device, "%s%c", drive, cur_sp_no);92 mr_asprintf(device, "%s%c", drive, cur_sp_no); 93 93 if (find_device_in_mountlist(mountlist, device) >= 0) { 94 94 foundsome = TRUE; … … 98 98 if (foundsome) { 99 99 for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) { 100 mr_asprintf( &device, "%s%c", drive, cur_sp_no);100 mr_asprintf(device, "%s%c", drive, cur_sp_no); 101 101 pos = find_device_in_mountlist(mountlist, device); 102 102 if (pos < 0) { … … 107 107 /* is it too big? */ 108 108 if (curr_part_no > 'h') { 109 mr_asprintf( &tmp, " Can only have up to 'h' in disklabel.");109 mr_asprintf(tmp, " Can only have up to 'h' in disklabel."); 110 110 log_it(tmp); 111 111 mr_strcat(flaws_str, tmp); … … 121 121 } 122 122 if (device_copies > 1) { 123 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);123 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 124 124 if (!strstr(flaws_str, tmp)) { 125 125 log_it(tmp); … … 132 132 if (mountlist->el[pos].size < 8192 133 133 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 134 mr_asprintf( &tmp, " %s is tiny!", device);134 mr_asprintf(tmp, " %s is tiny!", device); 135 135 log_it(tmp); 136 136 mr_strcat(flaws_str, tmp); … … 145 145 && strcmp(mountlist->el[pos].mountpoint, "none") 146 146 && mountlist->el[pos].mountpoint[0] != '/') { 147 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);147 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 148 148 log_it(tmp); 149 149 mr_strcat(flaws_str, tmp); … … 153 153 /* is format sensible? */ 154 154 if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) { 155 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);155 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 156 156 log_it(tmp); 157 157 mr_strcat(flaws_str, tmp); … … 172 172 npos = 0; 173 173 for (cur_sp_no = 'a'; cur_sp_no <= 'h'; cur_sp_no++) { 174 mr_asprintf( &tmp, "%ss%i%c", device, curr_part_no, cur_sp_no);174 mr_asprintf(tmp, "%ss%i%c", device, curr_part_no, cur_sp_no); 175 175 if (find_device_in_mountlist(mountlist, tmp) >= 0) { 176 176 npos++; … … 191 191 if (curr_part_no - prev_part_no > 1) { 192 192 if (prev_part_no == 0) { 193 mr_asprintf( &tmp, " Gap prior to %s.", device);193 mr_asprintf(tmp, " Gap prior to %s.", device); 194 194 log_it(tmp); 195 195 mr_strcat(flaws_str, "%s", tmp); … … 198 198 } else if (curr_part_no > 5 199 199 || (curr_part_no <= 4 && prev_part_no > 0)) { 200 mr_asprintf( &tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no);200 mr_asprintf(tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no); 201 201 log_it(tmp); 202 202 mr_strcat(flaws_str, "%s", tmp); … … 210 210 if ((curr_part_no >= 5 && prev_part_no == 4) 211 211 && (strcmp(part_table_fmt, "MBR") == 0)) { 212 mr_asprintf( &tmp, " Partition %ss4 is occupied.", drive);212 mr_asprintf(tmp, " Partition %ss4 is occupied.", drive); 213 213 log_it(tmp); 214 214 mr_strcat(flaws_str, "%s", tmp); … … 224 224 } 225 225 if (device_copies > 1) { 226 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);226 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 227 227 if (!strstr(flaws_str, "%s", tmp)) { 228 228 log_it(tmp); … … 235 235 if (mountlist->el[pos].size < 8192 236 236 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 237 mr_asprintf( &tmp, " %s is tiny!", device);237 mr_asprintf(tmp, " %s is tiny!", device); 238 238 log_it(tmp); 239 239 mr_strcat(flaws_str, "%s", tmp); … … 248 248 && strcmp(mountlist->el[pos].mountpoint, "none") 249 249 && mountlist->el[pos].mountpoint[0] != '/') { 250 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);250 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 251 251 log_it(tmp); 252 252 mr_strcat(flaws_str, "%s", tmp); … … 256 256 /* is format sensible? */ 257 257 if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) { 258 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);258 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 259 259 log_it(tmp); 260 260 mr_strcat(flaws_str, "%s", tmp); … … 274 274 /* is it too big? */ 275 275 if (curr_part_no > 'h') { 276 mr_asprintf( &tmp, " Can only have up to 'h' in disklabel.");276 mr_asprintf(tmp, " Can only have up to 'h' in disklabel."); 277 277 log_it(tmp); 278 278 mr_strcat(flaws_str, "%s", tmp); … … 288 288 } 289 289 if (device_copies > 1) { 290 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);290 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 291 291 if (!strstr(flaws_str, tmp)) { 292 292 log_it(tmp); … … 299 299 if (mountlist->el[pos].size < 8192 300 300 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 301 mr_asprintf( &tmp, " %s is tiny!", device);301 mr_asprintf(tmp, " %s is tiny!", device); 302 302 log_it(tmp); 303 303 mr_strcat(flaws_str, "%s", tmp); … … 312 312 && strcmp(mountlist->el[pos].mountpoint, "none") 313 313 && mountlist->el[pos].mountpoint[0] != '/') { 314 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);314 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 315 315 log_it(tmp); 316 316 mr_strcat(flaws_str, "%s", tmp); … … 321 321 if (!is_this_a_valid_disk_format 322 322 (mountlist->el[pos].format)) { 323 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);323 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 324 324 log_it(tmp); 325 325 mr_strcat(flaws_str, "%s", tmp); … … 341 341 if (amount_allocated > physical_drive_size) // Used to be +1, but what if you're 1 MB too high? 342 342 { 343 mr_asprintf( &tmp, " %ld MB over-allocated on %s.",343 mr_asprintf(tmp, " %ld MB over-allocated on %s.", 344 344 amount_allocated - physical_drive_size, drive); 345 345 log_it(tmp); … … 348 348 res++; 349 349 } else if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ 350 mr_asprintf( &tmp, " %ld MB unallocated on %s.",350 mr_asprintf(tmp, " %ld MB unallocated on %s.", 351 351 physical_drive_size - amount_allocated, drive); 352 352 log_it(tmp); … … 389 389 assert_string_is_neither_NULL_nor_zerolength(drive); 390 390 assert(mountlist != NULL); 391 mr_asprintf( &flaws_str, "%s", "");391 mr_asprintf(flaws_str, "%s", ""); 392 392 393 393 prev_part_no = 0; … … 396 396 397 397 if (physical_drive_size < 0) { 398 mr_asprintf( &tmp, " %s does not exist.", drive);398 mr_asprintf(tmp, " %s does not exist.", drive); 399 399 mr_strcat(flaws_str, "%s", tmp); 400 400 res++; … … 403 403 return(flaws_str); 404 404 } else { 405 mr_asprintf( &tmp, "%s is %ld MB", drive, physical_drive_size);405 mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size); 406 406 log_it(tmp); 407 407 mr_free(tmp); … … 417 417 if (curr_part_no - prev_part_no > 1) { 418 418 if (prev_part_no == 0) { 419 mr_asprintf( &tmp, " Gap prior to %s.", device);419 mr_asprintf(tmp, " Gap prior to %s.", device); 420 420 log_it(tmp); 421 421 mr_strcat(flaws_str, "%s", tmp); … … 424 424 } else if (curr_part_no > 5 425 425 || (curr_part_no <= 4 && prev_part_no > 0)) { 426 mr_asprintf( &tmp, " Gap on %s between %d and %d.", drive,426 mr_asprintf(tmp, " Gap on %s between %d and %d.", drive, 427 427 prev_part_no, curr_part_no); 428 428 log_it(tmp); … … 437 437 if ((curr_part_no >= 5 && prev_part_no == 4) 438 438 && (strcmp(part_table_fmt, "MBR") == 0)) { 439 mr_asprintf( &tmp, " Partition 4 of %s is occupied.", drive);439 mr_asprintf(tmp, " Partition 4 of %s is occupied.", drive); 440 440 log_it(tmp); 441 441 mr_strcat(flaws_str, "%s", tmp); … … 451 451 } 452 452 if (device_copies > 1) { 453 mr_asprintf( &tmp, " %s %s's.", number_to_text(device_copies), device);453 mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device); 454 454 if (!strstr(flaws_str, tmp)) { 455 455 log_it(tmp); … … 462 462 if (mountlist->el[pos].size < 8192 463 463 && strcmp(mountlist->el[pos].mountpoint, "lvm")) { 464 mr_asprintf( &tmp, " %s is tiny!", device);464 mr_asprintf(tmp, " %s is tiny!", device); 465 465 log_it(tmp); 466 466 mr_strcat(flaws_str, "%s", tmp); … … 474 474 && strcmp(mountlist->el[pos].mountpoint, "image") 475 475 && mountlist->el[pos].mountpoint[0] != '/') { 476 mr_asprintf( &tmp, " %s has a weird mountpoint.", device);476 mr_asprintf(tmp, " %s has a weird mountpoint.", device); 477 477 log_it(tmp); 478 478 mr_strcat(flaws_str, "%s", tmp); … … 482 482 /* is format sensible? */ 483 483 if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) { 484 mr_asprintf( &tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);484 mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format); 485 485 log_it(tmp); 486 486 mr_strcat(flaws_str, "%s", tmp); … … 496 496 /* Over-allocated the disk? Unallocated space on disk? */ 497 497 if (amount_allocated > physical_drive_size + 1) { 498 mr_asprintf( &tmp, " %ld MB over-allocated on %s.",498 mr_asprintf(tmp, " %ld MB over-allocated on %s.", 499 499 amount_allocated - physical_drive_size, drive); 500 500 log_it(tmp); … … 503 503 res++; 504 504 } else if (amount_allocated < physical_drive_size - 1) { /* NOT AN ERROR, JUST A WARNING :-) */ 505 mr_asprintf( &tmp, " %ld MB unallocated on %s.",505 mr_asprintf(tmp, " %ld MB unallocated on %s.", 506 506 physical_drive_size - amount_allocated, drive); 507 507 log_it(tmp); … … 551 551 assert(flaws_str_C != NULL); 552 552 553 mr_asprintf( &flaws_str, "%s", "");553 mr_asprintf(flaws_str, "%s", ""); 554 554 555 555 make_list_of_drives_in_mountlist(mountlist, drivelist); … … 561 561 (drivelist->el[i].device, 562 562 DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE)) { 563 mr_asprintf( &tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);563 mr_asprintf(tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device); 564 564 log_it(tmp); 565 565 paranoid_free(tmp); … … 639 639 640 640 for (currline = 0; currline < mountlist->entries; currline++) { 641 mr_asprintf( &curr_mountpoint, "%s", mountlist->el[currline].mountpoint);641 mr_asprintf(curr_mountpoint, "%s", mountlist->el[currline].mountpoint); 642 642 for (i = 0, copies = 0, last_copy = -1; i < mountlist->entries; 643 643 i++) { … … 651 651 if (copies > 1 && last_copy == currline 652 652 && strcmp(curr_mountpoint, "raid")) { 653 mr_asprintf( &tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);653 mr_asprintf(tmp, " %s %s's.", number_to_text(copies), curr_mountpoint); 654 654 mr_strcat(flaws_str, "%s", tmp); 655 655 log_it(tmp); … … 690 690 for (lino = 0, noof_drives = 0; lino < mountlist->entries; lino++) { 691 691 692 mr_asprintf( &drive, "%s", mountlist->el[lino].device);692 mr_asprintf(drive, "%s", mountlist->el[lino].device); 693 693 if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) { 694 694 log_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive); … … 777 777 (void *) &mountlist->el[i], 778 778 sizeof(struct mountlist_line)); 779 mr_asprintf( &tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);779 mr_asprintf(tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device); 780 780 log_it(tmp); 781 781 paranoid_free(tmp); … … 895 895 if (j < items) { 896 896 strcat(mountlist->el[items].device, "_dup"); 897 mr_asprintf( &tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);897 mr_asprintf(tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device); 898 898 log_it(tmp); 899 899 paranoid_free(tmp); 900 900 } 901 mr_asprintf( &tmp, "%s", mountlist->el[items].device);901 mr_asprintf(tmp, "%s", mountlist->el[items].device); 902 902 if (strstr(tmp, "/dev/md/")) { 903 903 log_it("format_device() --- Contracting %s", tmp); … … 1048 1048 assert(b >= 0); 1049 1049 1050 mr_asprintf( &device, "%s", mountlist->el[a].device);1051 mr_asprintf( &mountpoint, "%s", mountlist->el[a].mountpoint);1052 mr_asprintf( &format, "%s", mountlist->el[a].format);1050 mr_asprintf(device, "%s", mountlist->el[a].device); 1051 mr_asprintf(mountpoint, "%s", mountlist->el[a].mountpoint); 1052 mr_asprintf(format, "%s", mountlist->el[a].format); 1053 1053 1054 1054 size = mountlist->el[a].size;
Note:
See TracChangeset
for help on using the changeset viewer.