Changeset b7a4d06 in mainline for uspace/lib/fdisk
- Timestamp:
- 2015-07-18T12:55:12Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c43db5f
- Parents:
- 70815a24
- Location:
- uspace/lib/fdisk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fdisk/include/fdisk.h
r70815a24 rb7a4d06 72 72 extern int fdisk_ltype_format(label_type_t, char **); 73 73 extern int fdisk_fstype_format(fdisk_fstype_t, char **); 74 extern int fdisk_pkind_format(label_pkind_t, char **); 74 75 75 76 #endif -
uspace/lib/fdisk/include/types/fdisk.h
r70815a24 rb7a4d06 119 119 /** Label type */ 120 120 label_type_t ltype; 121 /** Label flags */ 122 label_flags_t flags; 121 123 } fdisk_label_info_t; 122 124 … … 131 133 /** Capacity */ 132 134 fdisk_cap_t capacity; 135 /** Partition kind */ 136 label_pkind_t pkind; 133 137 /** File system type */ 134 138 fdisk_fstype_t fstype; … … 147 151 /** Desired capacity */ 148 152 fdisk_cap_t capacity; 153 /** Partition kind */ 154 label_pkind_t pkind; 149 155 /** File system type */ 150 156 fdisk_fstype_t fstype; … … 153 159 /** Partition info */ 154 160 typedef struct { 161 /** Capacity */ 155 162 fdisk_cap_t capacity; 163 /** Partition kind */ 164 label_pkind_t pkind; 156 165 /** File system type */ 157 166 fdisk_fstype_t fstype; -
uspace/lib/fdisk/src/fdisk.c
r70815a24 rb7a4d06 271 271 part->block0 = pinfo.block0; 272 272 part->nblocks = pinfo.nblocks; 273 part->pkind = pinfo.pkind; 273 274 274 275 /* Insert to list by block address */ … … 442 443 info->dcnt = vinfo.dcnt; 443 444 info->ltype = vinfo.ltype; 445 info->flags = vinfo.flags; 444 446 return EOK; 445 447 error: … … 497 499 info->capacity = part->capacity; 498 500 info->fstype = part->fstype; 501 info->pkind = part->pkind; 499 502 return EOK; 500 503 } … … 671 674 } 672 675 676 int fdisk_pkind_format(label_pkind_t pkind, char **rstr) 677 { 678 const char *spkind; 679 char *s; 680 681 spkind = NULL; 682 switch (pkind) { 683 case lpk_primary: 684 spkind = "Primary"; 685 break; 686 case lpk_extended: 687 spkind = "Extended"; 688 break; 689 case lpk_logical: 690 spkind = "Logical"; 691 break; 692 } 693 694 s = str_dup(spkind); 695 if (s == NULL) 696 return ENOMEM; 697 698 *rstr = s; 699 return EOK; 700 } 701 673 702 /** Get free partition index. */ 674 703 static int fdisk_part_get_free_idx(fdisk_dev_t *dev, int *rindex) … … 765 794 return EIO; 766 795 796 memset(vpspec, 0, sizeof(vbd_part_spec_t)); 767 797 vpspec->index = index; 768 798 vpspec->block0 = fblock0; 769 799 vpspec->nblocks = req_blocks; 770 vpspec->ptype = 42; 800 vpspec->pkind = pspec->pkind; 801 if (pspec->pkind != lpk_extended) 802 vpspec->ptype = 42; 803 771 804 return EOK; 772 805 }
Note:
See TracChangeset
for help on using the changeset viewer.