Changeset 395df52 in mainline
- Timestamp:
- 2017-05-12T19:58:27Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e48947e
- Parents:
- de5b708
- Location:
- uspace
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/init/init.c
rde5b708 r395df52 316 316 } 317 317 318 /* Make sure tmpfs isrunning. */318 /* Make sure file systems are running. */ 319 319 if (str_cmp(STRING(RDFMT), "tmpfs") != 0) 320 320 srv_start("/srv/tmpfs"); 321 321 if (str_cmp(STRING(RDFMT), "exfat") != 0) 322 srv_start("/srv/exfat"); 323 if (str_cmp(STRING(RDFMT), "fat") != 0) 324 srv_start("/srv/fat"); 325 srv_start("/srv/cdfs"); 322 326 srv_start("/srv/mfs"); 323 327 -
uspace/lib/c/include/types/vol.h
rde5b708 r395df52 52 52 fs_fat, 53 53 fs_minix, 54 fs_ext4 54 fs_ext4, 55 fs_cdfs 55 56 } vol_fstype_t; 56 57 -
uspace/lib/ext4/include/ext4/filesystem.h
rde5b708 r395df52 39 39 #include "ext4/types.h" 40 40 41 extern int ext4_filesystem_probe(service_id_t); 41 42 extern int ext4_filesystem_open(ext4_instance_t *, service_id_t, 42 43 enum cache_mode, aoff64_t *, ext4_filesystem_t **); -
uspace/lib/ext4/src/filesystem.c
rde5b708 r395df52 61 61 * 62 62 * @param fs Filesystem instance to be initialized 63 * @param service_id Identifier if device with the filesystem63 * @param service_id Block device to open 64 64 * @param cmode Cache mode 65 65 * … … 155 155 block_cache_fini(fs->device); 156 156 block_fini(fs->device); 157 } 158 159 /** Probe filesystem. 160 * 161 * @param service_id Block device to probe 162 * 163 * @return EOK or negative error code. 164 * 165 */ 166 int ext4_filesystem_probe(service_id_t service_id) 167 { 168 ext4_filesystem_t *fs = NULL; 169 int rc; 170 171 fs = calloc(1, sizeof(ext4_filesystem_t)); 172 if (fs == NULL) 173 return ENOMEM; 174 175 /* Initialize the file system for opening */ 176 rc = ext4_filesystem_init(fs, service_id, CACHE_MODE_WT); 177 if (rc != EOK) { 178 free(fs); 179 return rc; 180 } 181 182 ext4_filesystem_fini(fs); 183 return EOK; 157 184 } 158 185 -
uspace/lib/ext4/src/ops.c
rde5b708 r395df52 909 909 static int ext4_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info) 910 910 { 911 return ENOTSUP;911 return ext4_filesystem_probe(service_id); 912 912 } 913 913 -
uspace/lib/fdisk/src/fdisk.c
rde5b708 r395df52 824 824 sfstype = "Ext4"; 825 825 break; 826 case fs_cdfs: 827 sfstype = "ISO 9660"; 828 break; 826 829 } 827 830 … … 993 996 pcnt = lpc_ext4; 994 997 break; 998 case fs_cdfs: 999 return EINVAL; /* You cannot create an ISO partition */ 995 1000 } 996 1001 -
uspace/srv/fs/cdfs/cdfs_ops.c
rde5b708 r395df52 906 906 } 907 907 908 static bool iso_readfs(cdfs_t *fs, fs_node_t *rfn, 909 cdfs_lba_t altroot) 908 /** Read the volume descriptors. */ 909 static bool iso_read_vol_desc(service_id_t sid, cdfs_lba_t altroot, 910 uint32_t *rlba, uint32_t *rsize, cdfs_enc_t *enc) 910 911 { 911 912 /* First 16 blocks of isofs are empty */ 912 913 block_t *block; 913 int rc = block_get(&block, fs->service_id, altroot + 16, BLOCK_FLAGS_NONE);914 int rc = block_get(&block, sid, altroot + 16, BLOCK_FLAGS_NONE); 914 915 if (rc != EOK) 915 916 return false; … … 956 957 // TODO: implement path table support 957 958 958 cdfs_node_t *node = CDFS_NODE(rfn);959 960 959 /* Search for Joliet SVD */ 961 960 … … 963 962 uint32_t jrsize; 964 963 965 rc = cdfs_find_joliet_svd( fs->service_id, altroot, &jrlba, &jrsize);964 rc = cdfs_find_joliet_svd(sid, altroot, &jrlba, &jrsize); 966 965 if (rc == EOK) { 967 966 /* Found */ 968 node->lba = jrlba;969 node->size = jrsize;970 fs->enc = enc_ucs2;967 *rlba = jrlba; 968 *rsize = jrsize; 969 *enc = enc_ucs2; 971 970 } else { 972 node->lba = uint32_lb(vol_desc->data.prisec.root_dir.lba); 973 node->size = uint32_lb(vol_desc->data.prisec.root_dir.size); 974 fs->enc = enc_ascii; 975 } 976 977 if (!cdfs_readdir(fs, rfn)) { 978 block_put(block); 979 return false; 971 *rlba = uint32_lb(vol_desc->data.prisec.root_dir.lba); 972 *rsize = uint32_lb(vol_desc->data.prisec.root_dir.size); 973 *enc = enc_ascii; 980 974 } 981 975 982 976 block_put(block); 983 977 return true; 978 } 979 980 static bool iso_readfs(cdfs_t *fs, fs_node_t *rfn, 981 cdfs_lba_t altroot) 982 { 983 int rc; 984 985 cdfs_node_t *node = CDFS_NODE(rfn); 986 987 rc = iso_read_vol_desc(fs->service_id, altroot, &node->lba, 988 &node->size, &fs->enc); 989 if (rc != EOK) 990 return false; 991 992 return cdfs_readdir(fs, rfn); 984 993 } 985 994 … … 1023 1032 static int cdfs_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info) 1024 1033 { 1025 return ENOTSUP; 1034 /* Initialize the block layer */ 1035 int rc = block_init(service_id, BLOCK_SIZE); 1036 if (rc != EOK) 1037 return rc; 1038 1039 cdfs_lba_t altroot = 0; 1040 1041 /* 1042 * Read TOC multisession information and get the start address 1043 * of the first track in the last session 1044 */ 1045 scsi_toc_multisess_data_t toc; 1046 1047 rc = block_read_toc(service_id, 1, &toc, sizeof(toc)); 1048 if (rc == EOK && (uint16_t_be2host(toc.toc_len) == 10)) 1049 altroot = uint32_t_be2host(toc.ftrack_lsess.start_addr); 1050 1051 /* Initialize the block cache */ 1052 rc = block_cache_init(service_id, BLOCK_SIZE, 0, CACHE_MODE_WT); 1053 if (rc != EOK) { 1054 block_fini(service_id); 1055 return rc; 1056 } 1057 1058 /* Check if this device is not already mounted */ 1059 fs_node_t *rootfn; 1060 rc = cdfs_root_get(&rootfn, service_id); 1061 if ((rc == EOK) && (rootfn)) { 1062 cdfs_node_put(rootfn); 1063 block_cache_fini(service_id); 1064 block_fini(service_id); 1065 return EOK; 1066 } 1067 1068 /* Read volume descriptors */ 1069 uint32_t rlba; 1070 uint32_t rsize; 1071 cdfs_enc_t enc; 1072 if (!iso_read_vol_desc(service_id, altroot, &rlba, &rsize, &enc)) { 1073 block_cache_fini(service_id); 1074 block_fini(service_id); 1075 return EIO; 1076 } 1077 1078 return EOK; 1026 1079 } 1027 1080 -
uspace/srv/fs/exfat/exfat_fat.c
rde5b708 r395df52 540 540 * does not contain a exfat file system. 541 541 */ 542 int exfat_sanity_check(exfat_bs_t *bs , service_id_t service_id)542 int exfat_sanity_check(exfat_bs_t *bs) 543 543 { 544 544 if (str_cmp((char const *)bs->oem_name, "EXFAT ")) -
uspace/srv/fs/exfat/exfat_fat.h
rde5b708 r395df52 72 72 extern int exfat_set_cluster(struct exfat_bs *, service_id_t, exfat_cluster_t, 73 73 exfat_cluster_t); 74 extern int exfat_sanity_check(struct exfat_bs * , service_id_t);74 extern int exfat_sanity_check(struct exfat_bs *); 75 75 76 76 extern int exfat_append_clusters(struct exfat_bs *, struct exfat_node *, -
uspace/srv/fs/exfat/exfat_ops.c
rde5b708 r395df52 1053 1053 static int exfat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info) 1054 1054 { 1055 return ENOTSUP; 1055 int rc; 1056 exfat_bs_t *bs; 1057 1058 /* initialize libblock */ 1059 rc = block_init(service_id, BS_SIZE); 1060 if (rc != EOK) 1061 return rc; 1062 1063 /* prepare the boot block */ 1064 rc = block_bb_read(service_id, BS_BLOCK); 1065 if (rc != EOK) { 1066 block_fini(service_id); 1067 return rc; 1068 } 1069 1070 /* get the buffer with the boot sector */ 1071 bs = block_bb_get(service_id); 1072 1073 /* Do some simple sanity checks on the file system. */ 1074 rc = exfat_sanity_check(bs); 1075 1076 (void) block_cache_fini(service_id); 1077 block_fini(service_id); 1078 return rc; 1056 1079 } 1057 1080 … … 1086 1109 bs = block_bb_get(service_id); 1087 1110 1111 /* Do some simple sanity checks on the file system. */ 1112 rc = exfat_sanity_check(bs); 1113 if (rc != EOK) { 1114 (void) block_cache_fini(service_id); 1115 block_fini(service_id); 1116 return rc; 1117 } 1118 1088 1119 /* Initialize the block cache */ 1089 1120 rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, cmode); 1090 1121 if (rc != EOK) { 1091 block_fini(service_id);1092 return rc;1093 }1094 1095 /* Do some simple sanity checks on the file system. */1096 rc = exfat_sanity_check(bs, service_id);1097 if (rc != EOK) {1098 (void) block_cache_fini(service_id);1099 1122 block_fini(service_id); 1100 1123 return rc; -
uspace/srv/fs/fat/fat_ops.c
rde5b708 r395df52 915 915 static int fat_fsprobe(service_id_t service_id, vfs_fs_probe_info_t *info) 916 916 { 917 return ENOTSUP; 917 fat_bs_t *bs; 918 int rc; 919 920 /* initialize libblock */ 921 rc = block_init(service_id, BS_SIZE); 922 if (rc != EOK) 923 return rc; 924 925 /* prepare the boot block */ 926 rc = block_bb_read(service_id, BS_BLOCK); 927 if (rc != EOK) { 928 block_fini(service_id); 929 return rc; 930 } 931 932 /* get the buffer with the boot sector */ 933 bs = block_bb_get(service_id); 934 935 if (BPS(bs) != BS_SIZE) { 936 block_fini(service_id); 937 return ENOTSUP; 938 } 939 940 /* Initialize the block cache */ 941 rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, CACHE_MODE_WB); 942 if (rc != EOK) { 943 block_fini(service_id); 944 return rc; 945 } 946 947 /* Do some simple sanity checks on the file system. */ 948 rc = fat_sanity_check(bs, service_id); 949 950 (void) block_cache_fini(service_id); 951 block_fini(service_id); 952 953 return rc; 918 954 } 919 955 -
uspace/srv/volsrv/mkfs.c
rde5b708 r395df52 119 119 break; 120 120 case fs_ext4: 121 case fs_cdfs: 121 122 cmd = NULL; 122 123 break; -
uspace/srv/volsrv/part.c
rde5b708 r395df52 53 53 static FIBRIL_MUTEX_INITIALIZE(vol_parts_lock); 54 54 55 struct fsname_type { 56 const char *name; 57 vol_fstype_t fstype; 58 }; 59 60 static struct fsname_type fstab[] = { 61 { "ext4fs", fs_ext4 }, 62 { "cdfs", fs_cdfs }, 63 { "exfat", fs_exfat }, 64 { "fat", fs_fat }, 65 { "mfs", fs_minix }, 66 { NULL, 0 } 67 }; 68 55 69 /** Check for new partitions */ 56 70 static int vol_part_check_new(void) … … 134 148 bool empty; 135 149 vfs_fs_probe_info_t info; 150 struct fsname_type *fst; 136 151 int rc; 137 152 … … 157 172 158 173 log_msg(LOG_DEFAULT, LVL_NOTE, "Probe partition %s", part->svc_name); 159 rc = vfs_fsprobe("mfs", sid, &info); 160 if (rc == EOK) { 174 175 fst = &fstab[0]; 176 while (fst->name != NULL) { 177 rc = vfs_fsprobe(fst->name, sid, &info); 178 if (rc == EOK) 179 break; 180 ++fst; 181 } 182 183 if (fst->name != NULL) { 184 log_msg(LOG_DEFAULT, LVL_NOTE, "Found %s", fst->name); 161 185 part->pcnt = vpc_fs; 162 part->fstype = fs _minix;186 part->fstype = fst->fstype; 163 187 } else { 164 188 log_msg(LOG_DEFAULT, LVL_NOTE, "Partition does not contain "
Note:
See TracChangeset
for help on using the changeset viewer.