Changeset 283ea3d in mainline for uspace/lib/mbr/libmbr.c
- Timestamp:
- 2013-07-28T22:52:16Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e3bc355
- Parents:
- 8559fa0 (diff), 675de6d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/mbr/libmbr.c
r8559fa0 r283ea3d 42 42 #include <stdio.h> 43 43 #include <stdlib.h> 44 #include <str_error.h> 44 45 45 46 #include "libmbr.h" … … 49 50 static int decode_logical(mbr_label_t *, mbr_part_t *); 50 51 static void encode_part(mbr_part_t *, pt_entry_t *, uint32_t, bool); 51 static intcheck_overlap(mbr_part_t *, mbr_part_t *);52 static intcheck_encaps(mbr_part_t *, mbr_part_t *);53 static intcheck_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);52 static bool check_overlap(mbr_part_t *, mbr_part_t *); 53 static bool check_encaps(mbr_part_t *, mbr_part_t *); 54 static bool check_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 *); 56 57 57 58 /** Allocate and initialize mbr_label_t structure */ … … 759 760 /** Check whether two partitions overlap 760 761 * 761 * @return 1 for yes, 0 for no762 */ 763 static intcheck_overlap(mbr_part_t * p1, mbr_part_t * p2)762 * @return true/false 763 */ 764 static bool check_overlap(mbr_part_t * p1, mbr_part_t * p2) 764 765 { 765 766 if (p1->start_addr < p2->start_addr && p1->start_addr + p1->length <= p2->start_addr) { 766 return 0;767 return false; 767 768 } else if (p1->start_addr > p2->start_addr && p2->start_addr + p2->length <= p1->start_addr) { 768 return 0;769 } 770 771 return 1;769 return false; 770 } 771 772 return true; 772 773 } 773 774 774 775 /** Check whether one partition encapsulates the other 775 776 * 776 * @return 1 for yes, 0 for no777 */ 778 static intcheck_encaps(mbr_part_t * inner, mbr_part_t * outer)777 * @return true/false 778 */ 779 static bool check_encaps(mbr_part_t * inner, mbr_part_t * outer) 779 780 { 780 781 if (inner->start_addr <= outer->start_addr || outer->start_addr + outer->length <= inner->start_addr) { 781 return 0;782 return false; 782 783 } else if (outer->start_addr + outer->length < inner->start_addr + inner->length) { 783 return 0;784 } 785 786 return 1;784 return false; 785 } 786 787 return true; 787 788 } 788 789 789 790 /** Check whether one partition preceeds the other 790 791 * 791 * @return 1 for yes, 0 for no792 */ 793 static intcheck_preceeds(mbr_part_t * preceeder, mbr_part_t * precedee)792 * @return true/false 793 */ 794 static bool check_preceeds(mbr_part_t * preceeder, mbr_part_t * precedee) 794 795 { 795 796 return preceeder->start_addr < precedee->start_addr;
Note:
See TracChangeset
for help on using the changeset viewer.