Changeset 2989 in MondoRescue for branches/3.0/mondo/src/common/libmondo-raid.c
- Timestamp:
- Apr 4, 2012, 2:27:02 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mondo/src/common/libmondo-raid.c
r2982 r2989 598 598 { 599 599 FILE *fin; 600 char *tmp;601 600 char *label; 602 601 char *value; … … 604 603 int v; 605 604 606 malloc_string(tmp);607 malloc_string(label);608 malloc_string(value);609 605 assert(raidlist != NULL); 610 606 assert_string_is_neither_NULL_nor_zerolength(fname); … … 613 609 log_it("Raidtab is very small or non-existent. Ignoring it."); 614 610 raidlist->entries = 0; 615 paranoid_free(tmp);616 paranoid_free(label);617 paranoid_free(value);618 611 return (0); 619 612 } 620 613 if (!(fin = fopen(fname, "r"))) { 621 614 log_it("Cannot open raidtab"); 622 paranoid_free(tmp);623 paranoid_free(label);624 paranoid_free(value);625 615 return (1); 626 616 } 617 malloc_string(label); 618 malloc_string(value); 627 619 items = 0; 628 620 log_it("Loading raidtab..."); … … 636 628 strcpy(raidlist->el[items].additional_vars.el[v].label, label); 637 629 strcpy(raidlist->el[items].additional_vars.el[v].value, value); 630 log_msg(2,"Found raidtab entry Label: %s Value: %s",raidlist->el[items].additional_vars.el[v].label,raidlist->el[items].additional_vars.el[v].value); 638 631 v++; 639 632 get_next_raidtab_line(fin, label, value); 640 log_it(tmp);641 633 } 642 634 raidlist->el[items].additional_vars.entries = v; … … 658 650 log_msg(1, "Raidtab loaded successfully."); 659 651 log_msg(1, "%d RAID devices in raidtab", items); 660 paranoid_free(tmp);661 652 paranoid_free(label); 662 653 paranoid_free(value); … … 710 701 raidrec->raid_level = atoi(value); 711 702 } 703 log_msg(4,"Found raid level %d",raidrec->raid_level); 712 704 } else if (!strcmp(label, "nr-raid-disks")) { /* ignore it */ 713 705 } else if (!strcmp(label, "nr-spare-disks")) { /* ignore it */ … … 730 722 log_msg(1, "Unknown RAID parity algorithm '%s'\n.", value); 731 723 } 724 log_msg(4,"Found raid parity %d",raidrec->parity); 732 725 } else if (!strcmp(label, "device")) { 733 726 get_next_raidtab_line(fin, labelB, valueB); … … 755 748 strcpy(raidrec->additional_vars.el[v].label, label); 756 749 strcpy(raidrec->additional_vars.el[v].value, value); 757 raidrec->additional_vars.entries = ++v; 750 log_msg(4,"Found additional raid pair #%d: %s / %s",v,raidrec->additional_vars.el[v].label,raidrec->additional_vars.el[v].value); 751 v++; 752 raidrec->additional_vars.entries = v; 758 753 } 759 754 paranoid_free(labelB); … … 1042 1037 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].label, "UUID"); 1043 1038 mr_asprintf(&cmd,"mdadm --detail %s | grep UUID | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device); 1039 mr_asprintf(&strtmp, "%s", call_program_and_get_last_line_of_output(cmd)); 1040 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].value, strtmp); 1041 mr_free(strtmp); 1042 v++; 1043 // store the Version value in the additional_vars structure 1044 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].label, "Version"); 1045 mr_asprintf(&cmd,"mdadm --detail %s | grep Version | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device); 1044 1046 mr_asprintf(&strtmp, "%s", call_program_and_get_last_line_of_output(cmd)); 1045 1047 strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].value, strtmp);
Note:
See TracChangeset
for help on using the changeset viewer.