Changeset 2350 in MondoRescue
- Timestamp:
- Aug 28, 2009, 2:24:19 AM (15 years ago)
- Location:
- branches/2.2.9/mondo
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.9/mondo/src/common/libmondo-mountlist-EXT.h
r2202 r2350 1 1 /* libmondo-mountlist-EXT.h */ 2 2 3 extern int evaluate_mountlist(struct mountlist_itself *mountlist, 4 char *flaws_str_A, char *flaws_str_B, 5 char *flaws_str_C); 3 extern char *evaluate_mountlist(struct mountlist_itself *mountlist, int *res); 6 4 extern int find_device_in_mountlist(struct mountlist_itself *mountlist, 7 5 char *device); -
branches/2.2.9/mondo/src/common/libmondo-mountlist.c
r2304 r2350 500 500 * @see evaluate_drive_within_mountlist 501 501 */ 502 int 503 evaluate_mountlist(struct mountlist_itself *mountlist, char *flaws_str_A, 504 char *flaws_str_B, char *flaws_str_C) 505 { 502 char *evaluate_mountlist(struct mountlist_itself *mountlist, int *res) { 506 503 507 504 /*@ buffer *********************************************************** */ … … 512 509 /*@ int ************************************************************** */ 513 510 int i = 0; 514 int res = 0;515 511 516 512 /*@ initialize ******************************************************* */ 517 513 514 *res = 0; 518 515 drivelist = malloc(sizeof(struct list_of_disks)); 519 516 assert(mountlist != NULL); 520 assert(flaws_str_A != NULL);521 assert(flaws_str_B != NULL);522 assert(flaws_str_C != NULL);523 517 524 518 mr_asprintf(&flaws_str, "%s", ""); … … 539 533 tmp = evaluate_drive_within_mountlist(mountlist, drivelist->el[i].device); 540 534 if (tmp == NULL) { 541 res++;535 (*res)++; 542 536 } 543 537 } … … 550 544 } 551 545 } 552 res += look_for_duplicate_mountpoints(mountlist, flaws_str); 553 res = spread_flaws_across_three_lines(flaws_str, flaws_str_A, flaws_str_B, flaws_str_C,res); 554 paranoid_free(flaws_str); 555 return(res); 546 *res += look_for_duplicate_mountpoints(mountlist, flaws_str); 547 return(flaws_str); 556 548 } 557 549 -
branches/2.2.9/mondo/src/common/libmondo-mountlist.h
r2202 r2350 4 4 5 5 6 int evaluate_mountlist(struct mountlist_itself *mountlist, 7 char *flaws_str_A, char *flaws_str_B, 8 char *flaws_str_C); 6 char *evaluate_mountlist(struct mountlist_itself *mountlist, int *res); 9 7 int find_device_in_mountlist(struct mountlist_itself *mountlist, 10 8 char *device); -
branches/2.2.9/mondo/src/common/libmondo-string-EXT.h
r1647 r2350 21 21 char *s); 22 22 extern int special_dot_char(int i); 23 extern boolspread_flaws_across_three_lines(char *flaws_str,23 extern void spread_flaws_across_three_lines(char *flaws_str, 24 24 char *flaws_str_A, 25 25 char *flaws_str_B, 26 char *flaws_str_C , int res);26 char *flaws_str_C); 27 27 extern int strcmp_inc_numbers(char *stringA, char *stringB); 28 28 extern char *strip_afio_output_line(char *input); -
branches/2.2.9/mondo/src/common/libmondo-string.c
r2242 r2350 608 608 * @param flaws_str_B Where to put the second 74-or-less characters. 609 609 * @param flaws_str_C Where to put the rest. 610 * @param res The result of the original evaluate_mountlist() operation. 611 * @return TRUE if res == 0, FALSE otherwise. 612 */ 613 bool 610 */ 611 void 614 612 spread_flaws_across_three_lines(char *flaws_str, char *flaws_str_A, 615 char *flaws_str_B, char *flaws_str_C, 616 int res) 613 char *flaws_str_B, char *flaws_str_C) 617 614 { 618 615 … … 621 618 622 619 /*@ initialize ****************************************************** */ 623 assert(flaws_str_A != NULL);624 assert(flaws_str_B != NULL);625 assert(flaws_str_C != NULL);626 620 assert(flaws_str != NULL); 627 621 628 if (!res && !strlen(flaws_str)) {629 return (TRUE);630 }631 622 if (strlen(flaws_str) > 0) { 632 paranoid_free(flaws_str_A);633 623 mr_asprintf(&flaws_str_A, "%s", flaws_str + 1); 634 624 } 635 625 if (strlen(flaws_str_A) >= 74) { 636 626 for (i = 74; flaws_str_A[i] != ' '; i--); 637 paranoid_free(flaws_str_B);638 627 mr_asprintf(&flaws_str_B, "%s", flaws_str_A + i + 1); 639 628 flaws_str_A[i] = '\0'; … … 641 630 if (strlen(flaws_str_B) >= 74) { 642 631 for (i = 74; flaws_str_B[i] != ' '; i--); 643 paranoid_free(flaws_str_C);644 632 mr_asprintf(&flaws_str_C, "%s", flaws_str_B + i + 1); 645 633 flaws_str_B[i] = '\0'; 646 }647 if (res) {648 return (FALSE);649 } else {650 return (TRUE);651 634 } 652 635 } -
branches/2.2.9/mondo/src/common/libmondo-string.h
r1647 r2350 17 17 char *slice_fname(long bigfileno, long sliceno, char *path, char *s); 18 18 int special_dot_char(int i); 19 bool spread_flaws_across_three_lines(char *flaws_str, char *flaws_str_A, 20 char *flaws_str_B, char *flaws_str_C, 21 int res); 19 void spread_flaws_across_three_lines(char *flaws_str, char *flaws_str_A, 20 char *flaws_str_B, char *flaws_str_C); 22 21 int strcmp_inc_numbers(char *stringA, char *stringB); 23 22 char *strip_afio_output_line(char *input); -
branches/2.2.9/mondo/src/mondorestore/mondo-rstr-newt.c
r2230 r2350 1933 1933 /** int **************************************************************/ 1934 1934 int i = 0; 1935 int res = 0; 1935 1936 int currline = 0; 1936 1937 int finished = FALSE; … … 1938 1939 /** buffers **********************************************************/ 1939 1940 char tmp[MAX_STR_LEN]; 1941 char *flaws_str = NULL; 1940 1942 char *flaws_str_A = NULL; 1941 1943 char *flaws_str_B = NULL; … … 1945 1947 assert(raidlist != NULL); 1946 1948 1947 mr_asprintf(&flaws_str_A, "%s", " ");1948 mr_asprintf(&flaws_str_B, "%s", " ");1949 mr_asprintf(&flaws_str_C, "%s", " ");1950 1949 if (mountlist->entries > ARBITRARY_MAXIMUM) { 1951 1950 log_to_screen("Arbitrary limits suck, man!"); … … 1964 1963 "Size (MB)"); 1965 1964 headerMsg = newtLabel(2, 1, tmp); 1966 flawsLabelA = newtLabel(2, 13, flaws_str_A);1967 flawsLabelB = newtLabel(2, 14, flaws_str_B);1968 flawsLabelC = newtLabel(2, 15, flaws_str_C);1965 flawsLabelA = newtLabel(2, 13, " "); 1966 flawsLabelB = newtLabel(2, 14, " "); 1967 flawsLabelC = newtLabel(2, 15, " "); 1969 1968 partitionsListbox = 1970 1969 newtListbox(2, 2, 10, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT); … … 1976 1975 bEdit, bDelete, bReload, bCancel, bOK, NULL); 1977 1976 while (!finished) { 1978 evaluate_mountlist(mountlist, flaws_str_A, flaws_str_B, 1979 flaws_str_C); 1977 flaws_str = evaluate_mountlist(mountlist, &res); 1978 spread_flaws_across_three_lines(flaws_str, flaws_str_A, flaws_str_B, flaws_str_C); 1979 1980 mr_free(flaws_str); 1981 1980 1982 newtLabelSetText(flawsLabelA, flaws_str_A); 1981 1983 newtLabelSetText(flawsLabelB, flaws_str_B); 1982 1984 newtLabelSetText(flawsLabelC, flaws_str_C); 1983 1985 b_res = newtRunForm(myForm); 1986 mr_free(flaws_str_A); 1987 mr_free(flaws_str_B); 1988 mr_free(flaws_str_C); 1989 1984 1990 if (b_res == bOK) { 1985 if (!evaluate_mountlist 1986 (mountlist, flaws_str_A, flaws_str_B, flaws_str_C)) { 1991 flaws_str = evaluate_mountlist(mountlist, &res); 1992 mr_free(flaws_str); 1993 if (!res) { 1987 1994 finished = 1988 1995 ask_me_yes_or_no … … 2038 2045 } 2039 2046 } 2040 paranoid_free(flaws_str_A);2041 paranoid_free(flaws_str_B);2042 paranoid_free(flaws_str_C);2043 2047 newtFormDestroy(myForm); 2044 2048 newtPopWindow(); -
branches/2.2.9/mondo/src/mondorestore/mondo-rstr-newt.h
r2202 r2350 137 137 struct raidlist_itself *); 138 138 void edit_raidrec_additional_vars(struct raid_device_record *); 139 int evaluate_mountlist(struct mountlist_itself *, char *, char *, char*);139 char *evaluate_mountlist(struct mountlist_itself *, int *); 140 140 int find_device_in_mountlist(struct mountlist_itself *, char *); 141 141 int find_next_free_index_in_disklist(struct list_of_disks *); … … 180 180 void setup_newt_stuff(void); 181 181 long size_of_specific_device(struct mountlist_itself *, char *); 182 bool spread_flaws_across_three_lines(char *, char *, char *, char *, int);182 void spread_flaws_across_three_lines(char *, char *, char *, char *); 183 183 char *turn_raid_level_number_to_string(int); 184 184 void update_evalcall_form(int); -
branches/2.2.9/mondo/src/mondorestore/mondorestore.c
r2290 r2350 777 777 /** malloc **/ 778 778 char tmp[MAX_STR_LEN]; 779 char *tmpA; 780 char *tmpB; 781 char *tmpC; 779 char *flaws_str = NULL; 782 780 783 781 assert(bkpinfo != NULL); 784 782 assert(mountlist != NULL); 785 783 assert(raidlist != NULL); 786 787 mr_asprintf(&tmpA, "%s", " ");788 mr_asprintf(&tmpB, "%s", " ");789 mr_asprintf(&tmpC, "%s", " ");790 784 791 785 log_msg(2, "nuke_mode --- starting"); … … 807 801 resize_mountlist_proportionately_to_suit_new_drives(mountlist); 808 802 } 809 if (!evaluate_mountlist(mountlist, tmpA, tmpB, tmpC)) { 803 flaws_str = evaluate_mountlist(mountlist, &res); 804 if (!res) { 810 805 sprintf(tmp, 811 "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", 812 tmpA, tmpB, tmpC); 806 "Mountlist analyzed. Result: \"%s\" Switch to Interactive Mode?", 807 flaws_str); 808 mr_free(flaws_str); 813 809 if (ask_me_yes_or_no(tmp)) { 814 810 retval = interactive_mode(mountlist, raidlist); … … 818 814 } 819 815 } 816 mr_free(flaws_str); 817 820 818 save_mountlist_to_disk(mountlist, g_mountlist_fname); 821 819 mvaddstr_and_log_it(1, 30, "Restoring Automatically"); -
branches/2.2.9/mondo/src/mondorestore/mr-externs.h
r2109 r2350 109 109 extern bool g_restoring_live_from_nfs; 110 110 extern int fput_string_one_char_at_a_time(FILE *, char *); 111 112 113 114 115 116 extern int 117 evaluate_mountlist(struct mountlist_itself *mountlist, char *flaws_str_A, 118 char *flaws_str_B, char *flaws_str_C); 119 111 extern char *evaluate_mountlist(struct mountlist_itself *mountlist, int *res); 120 112 121 113 -
branches/2.2.9/mondo/test/test-mountlist.c
r2235 r2350 49 49 50 50 struct mountlist_itself *mountlist = NULL; 51 struct raidlist_itself *raidlist; 52 char *tmpA = NULL; 53 char *tmpB = NULL; 54 char *tmpC = NULL; 55 bool ret = FALSE; 51 struct raidlist_itself *raidlist = NULL; 52 int ret = 0; 53 char *flaws_str = NULL; 56 54 57 55 mr_asprintf(&MONDO_LOGFILE,"/tmp/mrtest-mountlist.log"); … … 82 80 log_it("after edit_mountlist"); 83 81 84 mr_asprintf(&tmpA, "%s", " "); 85 mr_asprintf(&tmpB, "%s", " "); 86 mr_asprintf(&tmpC, "%s", " "); 87 ret = evaluate_mountlist(mountlist, tmpA, tmpB, tmpC); 82 flaws_str = evaluate_mountlist(mountlist, &ret); 88 83 log_it("after evaluate_mountlist"); 84 mr_free(flaws_str); 89 85 90 86 mr_free(MONDO_LOGFILE);
Note:
See TracChangeset
for help on using the changeset viewer.