• Home
  • Raw
  • Download

Lines Matching refs:exfat

108 	struct exfat *exfat = de_iter->exfat;  in check_clus_chain()  local
116 max_count = DIV_ROUND_UP(node->size, exfat->clus_size); in check_clus_chain()
123 (node->size > 0 && !exfat_heap_clus(exfat, node->first_clus))) { in check_clus_chain()
141 count * exfat->clus_size)) in check_clus_chain()
151 if (exfat_bitmap_get(exfat->alloc_bitmap, clus)) { in check_clus_chain()
156 count * exfat->clus_size)) in check_clus_chain()
162 if (!exfat_bitmap_get(exfat->disk_bitmap, clus)) { in check_clus_chain()
171 if (exfat_get_inode_next_clus(exfat, node, clus, &next)) in check_clus_chain()
178 count * exfat->clus_size)) in check_clus_chain()
184 !exfat_heap_clus(exfat, next)) { in check_clus_chain()
189 (count + 1) * exfat->clus_size)) { in check_clus_chain()
192 exfat_bitmap_set(exfat->alloc_bitmap, in check_clus_chain()
202 exfat_bitmap_set(exfat->alloc_bitmap, clus); in check_clus_chain()
211 count * exfat->clus_size)) in check_clus_chain()
219 node->size = count * exfat->clus_size; in check_clus_chain()
220 if (!exfat_heap_clus(exfat, prev)) in check_clus_chain()
224 if (count * exfat->clus_size < in check_clus_chain()
227 count * exfat->clus_size); in check_clus_chain()
228 if (!exfat_heap_clus(exfat, prev)) in check_clus_chain()
231 count * exfat->clus_size); in check_clus_chain()
236 if (!node->is_contiguous && exfat_heap_clus(exfat, prev)) { in check_clus_chain()
237 if (exfat_set_fat(exfat, prev, EXFAT_EOF_CLUSTER)) in check_clus_chain()
243 static int root_check_clus_chain(struct exfat *exfat, in root_check_clus_chain() argument
249 if (!exfat_heap_clus(exfat, node->first_clus)) in root_check_clus_chain()
256 if (exfat_bitmap_get(exfat->alloc_bitmap, clus)) { in root_check_clus_chain()
264 exfat_bitmap_set(exfat->alloc_bitmap, clus); in root_check_clus_chain()
266 if (exfat_get_inode_next_clus(exfat, node, clus, &next)) { in root_check_clus_chain()
271 if (next != EXFAT_EOF_CLUSTER && !exfat_heap_clus(exfat, next)) { in root_check_clus_chain()
291 if (!exfat_heap_clus(exfat, prev)) { in root_check_clus_chain()
295 node->size = *clus_count * exfat->clus_size; in root_check_clus_chain()
296 return exfat_set_fat(exfat, prev, EXFAT_EOF_CLUSTER); in root_check_clus_chain()
344 static int exfat_mark_volume_dirty(struct exfat *exfat, bool dirty) in exfat_mark_volume_dirty() argument
348 flags = le16_to_cpu(exfat->bs->bsx.vol_flags); in exfat_mark_volume_dirty()
354 exfat->bs->bsx.vol_flags = cpu_to_le16(flags); in exfat_mark_volume_dirty()
355 if (exfat_write(exfat->blk_dev->dev_fd, exfat->bs, in exfat_mark_volume_dirty()
361 if (fsync(exfat->blk_dev->dev_fd) != 0) { in exfat_mark_volume_dirty()
591 struct exfat *exfat = iter->exfat; in check_inode() local
601 if (node->size > le32_to_cpu(exfat->bs->bsx.clu_count) * in check_inode()
602 (uint64_t)exfat->clus_size) { in check_inode()
620 node->size % exfat->clus_size != 0) { in check_inode()
623 node->size, exfat->clus_size); in check_inode()
658 hash = exfat_calc_name_hash(iter->exfat, inode->name, (int)name_len); in check_name_dentry_set()
704 err = exfat_lookup_file(iter->exfat, iter->parent, rename, &filter); in get_rename_from_user()
731 err = exfat_lookup_file(iter->exfat, iter->parent, rename, in generate_rename()
803 hash = exfat_calc_name_hash(iter->exfat, utf16_name, (int)name_len); in handle_dot_dotdot_filename()
961 static int read_bitmap(struct exfat *exfat) in read_bitmap() argument
971 retval = exfat_lookup_dentry_set(exfat, exfat->root, &filter); in read_bitmap()
981 DIV_ROUND_UP(exfat->clus_count, 8)) { in read_bitmap()
986 if (!exfat_heap_clus(exfat, le32_to_cpu(dentry->bitmap_start_clu))) { in read_bitmap()
992 exfat->disk_bitmap_clus = le32_to_cpu(dentry->bitmap_start_clu); in read_bitmap()
993 exfat->disk_bitmap_size = DIV_ROUND_UP(exfat->clus_count, 8); in read_bitmap()
995 exfat_bitmap_set_range(exfat, exfat->alloc_bitmap, in read_bitmap()
997 DIV_ROUND_UP(exfat->disk_bitmap_size, in read_bitmap()
998 exfat->clus_size)); in read_bitmap()
1001 if (exfat_read(exfat->blk_dev->dev_fd, exfat->disk_bitmap, in read_bitmap()
1002 exfat->disk_bitmap_size, in read_bitmap()
1003 exfat_c2o(exfat, exfat->disk_bitmap_clus)) != in read_bitmap()
1004 (ssize_t)exfat->disk_bitmap_size) in read_bitmap()
1035 static int read_upcase_table(struct exfat *exfat) in read_upcase_table() argument
1048 retval = exfat_lookup_dentry_set(exfat, exfat->root, &filter); in read_upcase_table()
1054 if (!exfat_heap_clus(exfat, le32_to_cpu(dentry->upcase_start_clu))) { in read_upcase_table()
1077 if (exfat_read(exfat->blk_dev->dev_fd, upcase, size, in read_upcase_table()
1078 exfat_c2o(exfat, in read_upcase_table()
1094 exfat_bitmap_set_range(exfat, exfat->alloc_bitmap, in read_upcase_table()
1097 exfat->clus_size)); in read_upcase_table()
1099 exfat->upcase_table = calloc(1, in read_upcase_table()
1101 if (!exfat->upcase_table) { in read_upcase_table()
1107 exfat->upcase_table, EXFAT_UPCASE_TABLE_CHARS); in read_upcase_table()
1118 struct exfat *exfat = fsck->exfat; in read_children() local
1126 ret = exfat_de_iter_init(de_iter, exfat, dir, fsck->buffer_desc); in read_children()
1161 &exfat->dir_list); in read_children()
1172 if (dir == exfat->root) in read_children()
1207 struct exfat *exfat = fsck->exfat; in write_bitmap() local
1212 dev_offset = exfat_c2o(exfat, exfat->disk_bitmap_clus); in write_bitmap()
1213 bitmap_bytes = EXFAT_BITMAP_SIZE(le32_to_cpu(exfat->bs->bsx.clu_count)); in write_bitmap()
1215 disk_b = (bitmap_t *)exfat->disk_bitmap; in write_bitmap()
1216 alloc_b = (bitmap_t *)exfat->alloc_bitmap; in write_bitmap()
1217 ohead_b = (bitmap_t *)exfat->ohead_bitmap; in write_bitmap()
1232 if (exfat_write(exfat->blk_dev->dev_fd, in write_bitmap()
1252 struct exfat *exfat = fsck->exfat; in exfat_filesystem_check() local
1256 if (!exfat->root) { in exfat_filesystem_check()
1261 list_add(&exfat->root->list, &exfat->dir_list); in exfat_filesystem_check()
1263 while (!list_empty(&exfat->dir_list)) { in exfat_filesystem_check()
1264 dir = list_entry(exfat->dir_list.next, in exfat_filesystem_check()
1288 exfat_free_dir_list(exfat); in exfat_filesystem_check()
1292 static int exfat_root_dir_check(struct exfat *exfat) in exfat_root_dir_check() argument
1302 exfat->root = root; in exfat_root_dir_check()
1303 root->first_clus = le32_to_cpu(exfat->bs->bsx.root_cluster); in exfat_root_dir_check()
1304 if (root_check_clus_chain(exfat, root, &clus_count)) { in exfat_root_dir_check()
1307 exfat->root = NULL; in exfat_root_dir_check()
1310 root->size = clus_count * exfat->clus_size; in exfat_root_dir_check()
1316 err = exfat_read_volume_label(exfat); in exfat_root_dir_check()
1321 err = read_bitmap(exfat); in exfat_root_dir_check()
1327 err = read_upcase_table(exfat); in exfat_root_dir_check()
1334 err = exfat_build_file_dentry_set(exfat, " ", ATTR_SUBDIR, in exfat_root_dir_check()
1343 static int read_lostfound(struct exfat *exfat, struct exfat_inode **lostfound) in read_lostfound() argument
1349 err = exfat_lookup_file(exfat, exfat->root, "LOST+FOUND", &filter); in read_lostfound()
1377 struct exfat *exfat = fsck->exfat; in rescue_orphan_clusters() local
1391 err = read_lostfound(exfat, &lostfound); in rescue_orphan_clusters()
1398 err = exfat_lookup_dentry_set(exfat, lostfound, &lf); in rescue_orphan_clusters()
1409 err = exfat_build_file_dentry_set(exfat, name, 0, &dset, &dcount); in rescue_orphan_clusters()
1416 clu_count = le32_to_cpu(exfat->bs->bsx.clu_count); in rescue_orphan_clusters()
1421 disk_b = (bitmap_t *)exfat->disk_bitmap; in rescue_orphan_clusters()
1422 alloc_b = (bitmap_t *)exfat->alloc_bitmap; in rescue_orphan_clusters()
1423 ohead_b = (bitmap_t *)exfat->ohead_bitmap; in rescue_orphan_clusters()
1431 exfat_bitmap_find_one(exfat, exfat->ohead_bitmap, clu, &s_clu) == 0;) { in rescue_orphan_clusters()
1432 if (exfat_bitmap_find_zero(exfat, exfat->ohead_bitmap, s_clu, &e_clu)) in rescue_orphan_clusters()
1438 err = exfat_update_file_dentry_set(exfat, dset, dcount, in rescue_orphan_clusters()
1442 err = exfat_add_dentry_set(exfat, &loc, dset, dcount, true); in rescue_orphan_clusters()
1479 struct exfat *exfat = fsck->exfat; in exfat_show_info() local
1483 bytes_to_human_readable(1 << exfat->bs->bsx.sect_size_bits)); in exfat_show_info()
1485 bytes_to_human_readable(exfat->clus_size)); in exfat_show_info()
1487 bytes_to_human_readable(exfat->blk_dev->size)); in exfat_show_info()
1591 exfat_fsck.exfat = exfat_alloc_exfat(&bd, bs); in main()
1592 if (!exfat_fsck.exfat) { in main()
1598 exfat_fsck.exfat->clus_size, in main()
1599 exfat_fsck.exfat->sect_size); in main()
1606 exfat_mark_volume_dirty(exfat_fsck.exfat, true)) { in main()
1612 ret = exfat_root_dir_check(exfat_fsck.exfat); in main()
1619 ret = exfat_create_file(exfat_fsck.exfat, in main()
1620 exfat_fsck.exfat->root, in main()
1628 if (fsync(exfat_fsck.exfat->blk_dev->dev_fd) != 0) { in main()
1660 exfat_mark_volume_dirty(exfat_fsck.exfat, false); in main()
1677 if (exfat_fsck.exfat) in main()
1678 exfat_free_exfat(exfat_fsck.exfat); in main()