Changeset 2385 in MondoRescue
- Timestamp:
- Sep 10, 2009, 1:10:21 PM (15 years ago)
- Location:
- branches/2.2.10/mondo/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/common/libmondo-mountlist-EXT.h
r2352 r2385 4 4 extern int find_device_in_mountlist(struct mountlist_itself *mountlist, 5 5 char *device); 6 extern int look_for_duplicate_mountpoints(struct mountlist_itself7 *mountlist, char *flaws_str);8 6 extern int make_list_of_drives_in_mountlist(struct mountlist_itself *, 9 7 struct list_of_disks *); -
branches/2.2.10/mondo/src/common/libmondo-mountlist.c
r2382 r2385 530 530 char *flaws_str = NULL; 531 531 532 int currline = 0; 533 int copies = 0; 534 int last_copy = 0; 535 536 /*@ buffetr ********************************************************* */ 537 char *curr_mountpoint = NULL; 538 532 539 /*@ int ************************************************************** */ 533 540 int i = 0; … … 565 572 } 566 573 } 567 *res += look_for_duplicate_mountpoints(mountlist, flaws_str); 568 return(flaws_str); 569 } 570 571 572 /** 573 * Find the index number of @p device in the mountlist. 574 * The device given must match @p mountlist->el[N].device exactly, case-sensitive. 575 * @param mountlist The mountlist to search in. 576 * @param device The device to search for. 577 * @return The zero-based index of the device, or -1 if it could not be found. 578 */ 579 int 580 find_device_in_mountlist(struct mountlist_itself *mountlist, char *device) 581 { 582 583 /*@ int ************************************************************** */ 584 int i = 0; 585 586 assert(mountlist != NULL); 587 assert_string_is_neither_NULL_nor_zerolength(device); 588 for (i = 0; 589 i < mountlist->entries 590 && strcmp(mountlist->el[i].device, device) != 0; i++); 591 592 if (i == mountlist->entries) { 593 return (-1); 594 } else { 595 return (i); 596 } 597 } 598 599 600 /** 601 * Look for duplicate mountpoints in @p mountlist. 602 * @param mountlist The mountlist to check. 603 * @param flaws_str The flaws string to append the results to. 604 * @return The number of mountpoints that have duplicates, or 0 for success. 605 */ 606 int 607 look_for_duplicate_mountpoints(struct mountlist_itself *mountlist, char *flaws_str) 608 { 609 610 /*@ int ************************************************************* */ 611 int res = 0; 612 int currline = 0; 613 int i = 0; 614 int copies = 0; 615 int last_copy = 0; 616 617 /*@ buffetr ********************************************************* */ 618 char *curr_mountpoint = NULL; 619 char *tmp = NULL; 620 621 assert(mountlist != NULL); 622 assert(flaws_str != NULL); 574 575 /* Look for duplicate mountpoints in mountlist. */ 623 576 624 577 for (currline = 0; currline < mountlist->entries; currline++) { 625 578 mr_asprintf(curr_mountpoint, "%s", mountlist->el[currline].mountpoint); 626 for (i = 0, copies = 0, last_copy = -1; i < mountlist->entries; 627 i++) { 579 for (i = 0, copies = 0, last_copy = -1; i < mountlist->entries; i++) { 628 580 if (!strcmp(mountlist->el[i].mountpoint, curr_mountpoint) 629 581 && strcmp(mountlist->el[i].mountpoint, "lvm") … … 639 591 log_it(tmp); 640 592 mr_free(tmp); 641 res++;593 (*res)++; 642 594 } 643 595 mr_free(curr_mountpoint); 644 596 } 645 return (res); 597 598 return(flaws_str); 599 } 600 601 602 /** 603 * Find the index number of @p device in the mountlist. 604 * The device given must match @p mountlist->el[N].device exactly, case-sensitive. 605 * @param mountlist The mountlist to search in. 606 * @param device The device to search for. 607 * @return The zero-based index of the device, or -1 if it could not be found. 608 */ 609 int 610 find_device_in_mountlist(struct mountlist_itself *mountlist, char *device) 611 { 612 613 /*@ int ************************************************************** */ 614 int i = 0; 615 616 assert(mountlist != NULL); 617 assert_string_is_neither_NULL_nor_zerolength(device); 618 for (i = 0; 619 i < mountlist->entries 620 && strcmp(mountlist->el[i].device, device) != 0; i++); 621 622 if (i == mountlist->entries) { 623 return (-1); 624 } else { 625 return (i); 626 } 646 627 } 647 628 -
branches/2.2.10/mondo/src/common/libmondo-mountlist.h
r2352 r2385 7 7 int find_device_in_mountlist(struct mountlist_itself *mountlist, 8 8 char *device); 9 int look_for_duplicate_mountpoints(struct mountlist_itself *mountlist,10 char *flaws_str);11 9 int make_list_of_drives_in_mountlist(struct mountlist_itself *, 12 10 struct list_of_disks *); -
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.h
r2356 r2385 148 148 void log_file_end_to_screen(char *, char *); 149 149 void log_to_screen(const char *fmt, ...); 150 int look_for_duplicate_mountpoints(struct mountlist_itself *, char *);151 150 void make_list_of_unallocated_raid_partitions(struct mountlist_itself *, 152 151 struct mountlist_itself *,
Note:
See TracChangeset
for help on using the changeset viewer.