Changes in uspace/lib/mbr/libmbr.c [dc76f4a:8559fa0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/mbr/libmbr.c
rdc76f4a r8559fa0 42 42 #include <stdio.h> 43 43 #include <stdlib.h> 44 #include <str_error.h>45 44 46 45 #include "libmbr.h" … … 50 49 static int decode_logical(mbr_label_t *, mbr_part_t *); 51 50 static void encode_part(mbr_part_t *, pt_entry_t *, uint32_t, bool); 52 static boolcheck_overlap(mbr_part_t *, mbr_part_t *);53 static boolcheck_encaps(mbr_part_t *, mbr_part_t *);54 static boolcheck_preceeds(mbr_part_t *, mbr_part_t *);55 static mbr_err_val mbr_add_primary(mbr_label_t * , mbr_part_t *);56 static mbr_err_val mbr_add_logical(mbr_label_t * , mbr_part_t *);51 static int check_overlap(mbr_part_t *, mbr_part_t *); 52 static int check_encaps(mbr_part_t *, mbr_part_t *); 53 static int check_preceeds(mbr_part_t *, mbr_part_t *); 54 static mbr_err_val mbr_add_primary(mbr_label_t *label, mbr_part_t *p); 55 static mbr_err_val mbr_add_logical(mbr_label_t *label, mbr_part_t *p); 57 56 58 57 /** Allocate and initialize mbr_label_t structure */ … … 760 759 /** Check whether two partitions overlap 761 760 * 762 * @return true/false763 */ 764 static boolcheck_overlap(mbr_part_t * p1, mbr_part_t * p2)761 * @return 1 for yes, 0 for no 762 */ 763 static int check_overlap(mbr_part_t * p1, mbr_part_t * p2) 765 764 { 766 765 if (p1->start_addr < p2->start_addr && p1->start_addr + p1->length <= p2->start_addr) { 767 return false;766 return 0; 768 767 } else if (p1->start_addr > p2->start_addr && p2->start_addr + p2->length <= p1->start_addr) { 769 return false;770 } 771 772 return true;768 return 0; 769 } 770 771 return 1; 773 772 } 774 773 775 774 /** Check whether one partition encapsulates the other 776 775 * 777 * @return true/false778 */ 779 static boolcheck_encaps(mbr_part_t * inner, mbr_part_t * outer)776 * @return 1 for yes, 0 for no 777 */ 778 static int check_encaps(mbr_part_t * inner, mbr_part_t * outer) 780 779 { 781 780 if (inner->start_addr <= outer->start_addr || outer->start_addr + outer->length <= inner->start_addr) { 782 return false;781 return 0; 783 782 } else if (outer->start_addr + outer->length < inner->start_addr + inner->length) { 784 return false;785 } 786 787 return true;783 return 0; 784 } 785 786 return 1; 788 787 } 789 788 790 789 /** Check whether one partition preceeds the other 791 790 * 792 * @return true/false793 */ 794 static boolcheck_preceeds(mbr_part_t * preceeder, mbr_part_t * precedee)791 * @return 1 for yes, 0 for no 792 */ 793 static int check_preceeds(mbr_part_t * preceeder, mbr_part_t * precedee) 795 794 { 796 795 return preceeder->start_addr < precedee->start_addr;
Note:
See TracChangeset
for help on using the changeset viewer.