Changeset 4b6635a7 in mainline
- Timestamp:
- 2015-10-12T15:42:23Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- edebb4a1
- Parents:
- 6a0db524
- Location:
- uspace
- Files:
-
- 3 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/fdisk/fdisk.c
r6a0db524 r4b6635a7 262 262 } 263 263 264 static int fdsk_select_fstype( fdisk_fstype_t *fstype)264 static int fdsk_select_fstype(vol_fstype_t *fstype) 265 265 { 266 266 nchoice_t *choice = NULL; … … 284 284 } 285 285 286 for (i = FDFS_CREATE_LO; i < FDFS_CREATE_HI; i++) {286 for (i = 0; i < VOL_FSTYPE_LIMIT; i++) { 287 287 rc = fdisk_fstype_format(i, &sfstype); 288 288 if (rc != EOK) … … 307 307 308 308 nchoice_destroy(choice); 309 *fstype = ( fdisk_fstype_t)sel;309 *fstype = (vol_fstype_t)sel; 310 310 return EOK; 311 311 error: … … 321 321 fdisk_part_spec_t pspec; 322 322 fdisk_cap_t cap; 323 fdisk_fstype_t fstype = fdfs_none;323 vol_fstype_t fstype = 0; 324 324 tinput_t *tinput = NULL; 325 325 char *scap; … … 577 577 } 578 578 579 if (pinfo.pkind != lpk_extended) 580 printf(", %s", sfstype); 579 if (pinfo.pkind != lpk_extended) { 580 switch (pinfo.pcnt) { 581 case vpc_empty: 582 printf(", Empty"); 583 break; 584 case vpc_fs: 585 printf(", %s", sfstype); 586 break; 587 case vpc_unknown: 588 printf(", Unknown"); 589 break; 590 } 591 } 592 581 593 printf("\n"); 582 594 -
uspace/lib/c/include/vbd.h
r6a0db524 r4b6635a7 87 87 /** Number of blocks */ 88 88 aoff64_t nblocks; 89 /** Service ID */ 90 service_id_t svc_id; 89 91 } vbd_part_info_t; 90 92 -
uspace/lib/c/include/vol.h
r6a0db524 r4b6635a7 40 40 #include <stdint.h> 41 41 #include <types/label.h> 42 #include <types/vol.h> 42 43 43 44 /** Volume service */ … … 46 47 async_sess_t *sess; 47 48 } vol_t; 48 49 typedef enum {50 /** Partition is empty */51 vpc_empty,52 /** Partition contains a recognized filesystem */53 vpc_fs,54 /** Partition contains unrecognized data */55 vpc_unknown56 } vol_part_cnt_t;57 58 /** File system type */59 typedef enum {60 fs_exfat,61 fs_fat,62 fs_minix,63 fs_ext464 } vol_fstype_t;65 49 66 50 /** Partition information */ -
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; -
uspace/srv/bd/vbd/disk.c
r6a0db524 r4b6635a7 647 647 pinfo->block0 = lpinfo.block0; 648 648 pinfo->nblocks = lpinfo.nblocks; 649 pinfo->svc_id = part->svc_id; 649 650 return EOK; 650 651 } -
uspace/srv/volsrv/Makefile
r6a0db524 r4b6635a7 28 28 29 29 USPACE_PREFIX = ../.. 30 31 LIBS = $(LIBBLOCK_PREFIX)/libblock.a 32 EXTRA_CFLAGS = -I $(LIBBLOCK_PREFIX) 33 30 34 BINARY = volsrv 31 35 32 36 SOURCES = \ 37 empty.c \ 33 38 part.c \ 34 39 volsrv.c -
uspace/srv/volsrv/part.c
r6a0db524 r4b6635a7 43 43 #include <str.h> 44 44 45 #include "empty.h" 45 46 #include "part.h" 46 47 #include "types/part.h" … … 130 131 { 131 132 vol_part_t *part; 133 bool empty; 132 134 int rc; 133 135 … … 148 150 149 151 log_msg(LOG_DEFAULT, LVL_NOTE, "Probe partition %s", part->svc_name); 150 151 part->pcnt = vpc_unknown; 152 rc = vol_part_is_empty(sid, &empty); 153 if (rc != EOK) { 154 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed determining if " 155 "partition is empty."); 156 goto error; 157 } 158 159 part->pcnt = empty ? vpc_empty : vpc_unknown; 152 160 list_append(&part->lparts, &vol_parts); 153 161 -
uspace/srv/volsrv/part.h
r6a0db524 r4b6635a7 36 36 37 37 #ifndef PART_H_ 38 #define pART_H_38 #define PART_H_ 39 39 40 #include <loc.h> 40 41 #include <sys/types.h> 41 42 #include <vol.h>
Note:
See TracChangeset
for help on using the changeset viewer.