Changeset 4b6635a7 in mainline for uspace/lib/fdisk
- Timestamp:
- 2015-10-12T15:42:23Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- edebb4a1
- Parents:
- 6a0db524
- Location:
- uspace/lib/fdisk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/fdisk/include/fdisk.h
r6a0db524 r4b6635a7 71 71 extern int fdisk_cap_parse(const char *, fdisk_cap_t *); 72 72 extern int fdisk_ltype_format(label_type_t, char **); 73 extern int fdisk_fstype_format( fdisk_fstype_t, char **);73 extern int fdisk_fstype_format(vol_fstype_t, char **); 74 74 extern int fdisk_pkind_format(label_pkind_t, char **); 75 75 -
uspace/lib/fdisk/include/types/fdisk.h
r6a0db524 r4b6635a7 41 41 #include <stdint.h> 42 42 #include <types/label.h> 43 #include <types/vol.h> 43 44 #include <vbd.h> 44 45 #include <vol.h> … … 57 58 58 59 #define CU_LIMIT (cu_ybyte + 1) 59 60 /** File system type */61 typedef enum {62 fdfs_none = 0,63 fdfs_unknown,64 fdfs_exfat,65 fdfs_fat,66 fdfs_minix,67 fdfs_ext468 } fdisk_fstype_t;69 70 /** Highest fstype value + 1 */71 #define FDFS_LIMIT (fdfs_ext4 + 1)72 /** Lowest fstype allowed for creation */73 #define FDFS_CREATE_LO fdfs_exfat74 /** Highest fstype allowed for creation + 1 */75 #define FDFS_CREATE_HI (fdfs_ext4 + 1)76 60 77 61 /** Partition capacity */ … … 143 127 /** Partition kind */ 144 128 label_pkind_t pkind; 129 /** Partition contents */ 130 vol_part_cnt_t pcnt; 145 131 /** File system type */ 146 fdisk_fstype_t fstype;132 vol_fstype_t fstype; 147 133 /** Partition ID */ 148 134 vbd_part_id_t part_id; … … 153 139 /** Number of blocks */ 154 140 aoff64_t nblocks; 141 /** Service ID */ 142 service_id_t svc_id; 155 143 } fdisk_part_t; 156 144 … … 162 150 label_pkind_t pkind; 163 151 /** File system type */ 164 fdisk_fstype_t fstype;152 vol_fstype_t fstype; 165 153 } fdisk_part_spec_t; 166 154 … … 171 159 /** Partition kind */ 172 160 label_pkind_t pkind; 161 /** Partition contents */ 162 vol_part_cnt_t pcnt; 173 163 /** File system type */ 174 fdisk_fstype_t fstype;164 vol_fstype_t fstype; 175 165 } fdisk_part_info_t; 176 166 -
uspace/lib/fdisk/src/fdisk.c
r6a0db524 r4b6635a7 261 261 fdisk_part_t *part; 262 262 vbd_part_info_t pinfo; 263 vol_part_info_t vpinfo; 263 264 int rc; 264 265 … … 268 269 269 270 rc = vbd_part_get_info(dev->fdisk->vbd, partid, &pinfo); 271 if (rc != EOK) { 272 rc = EIO; 273 goto error; 274 } 275 276 rc = vol_part_info(dev->fdisk->vol, pinfo.svc_id, &vpinfo); 270 277 if (rc != EOK) { 271 278 rc = EIO; … … 278 285 part->nblocks = pinfo.nblocks; 279 286 part->pkind = pinfo.pkind; 287 part->svc_id = pinfo.svc_id; 288 part->pcnt = vpinfo.pcnt; 289 part->fstype = vpinfo.fstype; 280 290 281 291 switch (part->pkind) { … … 551 561 { 552 562 info->capacity = part->capacity; 563 info->pcnt = part->pcnt; 553 564 info->fstype = part->fstype; 554 565 info->pkind = part->pkind; … … 589 600 590 601 printf("fdisk_part_create() - done\n"); 602 part->pcnt = vpc_fs; 591 603 part->fstype = pspec->fstype; 592 604 part->capacity = pspec->capacity; … … 700 712 } 701 713 702 int fdisk_fstype_format( fdisk_fstype_t fstype, char **rstr)714 int fdisk_fstype_format(vol_fstype_t fstype, char **rstr) 703 715 { 704 716 const char *sfstype; … … 707 719 sfstype = NULL; 708 720 switch (fstype) { 709 case fdfs_none: 710 sfstype = "None"; 711 break; 712 case fdfs_unknown: 713 sfstype = "Unknown"; 714 break; 715 case fdfs_exfat: 721 case fs_exfat: 716 722 sfstype = "ExFAT"; 717 723 break; 718 case f dfs_fat:724 case fs_fat: 719 725 sfstype = "FAT"; 720 726 break; 721 case f dfs_minix:727 case fs_minix: 722 728 sfstype = "MINIX"; 723 729 break; 724 case f dfs_ext4:730 case fs_ext4: 725 731 sfstype = "Ext4"; 726 732 break; … … 916 922 int rc; 917 923 918 // pspec->fstype919 924 printf("fdisk_part_spec_prepare() - dev=%p pspec=%p vpspec=%p\n", dev, pspec, 920 925 vpspec); … … 935 940 936 941 switch (pspec->fstype) { 937 case fdfs_none: 938 case fdfs_unknown: 939 break; 940 case fdfs_exfat: 942 case fs_exfat: 941 943 pcnt = lpc_exfat; 942 944 break; 943 case f dfs_fat:945 case fs_fat: 944 946 pcnt = lpc_fat32; /* XXX Detect FAT12/16 vs FAT32 */ 945 947 break; 946 case f dfs_minix:948 case fs_minix: 947 949 pcnt = lpc_minix; 948 950 break; 949 case f dfs_ext4:951 case fs_ext4: 950 952 pcnt = lpc_ext4; 951 953 break;
Note:
See TracChangeset
for help on using the changeset viewer.