Lines Matching refs:vol

387 static runlist * find_unused(ntfs_volume *vol, s64 size, u64 loc
409 clus = vol->lcnbmp_na->allocated_size / bufsize;
415 bytes_read = ntfs_attr_pread(vol->lcnbmp_na, i*bufsize,
451 if (utils_cluster_in_use(vol, res->lcn + i)) {
500 IGNORE_CASE, ino->vol->upcase, ino->vol->upcase_len)) {
512 static int bitmap_alloc(ntfs_volume *vol, runlist_element *rl)
519 res = ntfs_bitmap_set_run(vol->lcnbmp_na, rl->lcn, rl->length);
530 static int bitmap_free(ntfs_volume *vol, runlist_element *rl)
537 res = ntfs_bitmap_clear_run(vol->lcnbmp_na, rl->lcn, rl->length);
548 static int data_copy(ntfs_volume *vol, runlist_element *from, runlist_element *to)
554 if (!vol || !from || !to)
560 buffer = malloc(vol->cluster_size);
568 res = ntfs_pread(vol->dev, (from->lcn+i) * vol->cluster_size,
569 vol->cluster_size, buffer);
570 if (res != vol->cluster_size) {
577 res = ntfs_pwrite(vol->dev, (to->lcn+i) * vol->cluster_size,
578 vol->cluster_size, buffer);
579 if (res != vol->cluster_size) {
601 static s64 move_runlist(ntfs_volume *vol, runlist_element *from,
606 if (!vol || !from || !to)
619 if (!utils_cluster_in_use(vol, from->lcn+i)) {
626 if (utils_cluster_in_use(vol, to->lcn+i)) {
632 if (bitmap_alloc(vol, to) < 0) {
637 if (data_copy(vol, from, to) < 0) {
642 if (bitmap_free(vol, from) < 0) {
667 static s64 move_datarun(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec,
678 to = find_unused(vol, run->length, loc, flags);
687 from = ntfs_mapping_pairs_decompress(vol, rec, NULL);
697 need_from = ntfs_get_size_for_mapping_pairs(vol, from, 0, INT_MAX);
711 need_to = ntfs_get_size_for_mapping_pairs(vol, from, 0, INT_MAX);
726 res = move_runlist(vol, run, to);
736 ntfs_mapping_pairs_build(vol, ((u8*)rec) + le16_to_cpu(rec->mapping_pairs_offset),
759 static s64 move_attribute(ntfs_volume *vol, ntfs_inode *ino, ATTR_RECORD *rec,
771 runs = ntfs_mapping_pairs_decompress(vol, rec, NULL);
785 res = move_datarun(vol, ino, rec, runs+i, loc, flags);
805 static s64 move_file(ntfs_volume *vol, ntfs_inode *ino, u64 loc, int flags)
835 utils_attr_get_name(vol, rec, buffer, MAX_PATH);
841 res = move_attribute(vol, ino, rec, loc, flags);
868 ntfs_volume *vol;
886 vol = utils_mount_volume(opts.device, flags);
887 if (!vol) {
888 ntfs_log_info("!vol\n");
892 inode = ntfs_pathname_to_inode(vol, NULL, opts.file);
898 count = move_file(vol, inode, opts.location, 0);
907 if(!(vol->flags & VOLUME_IS_DIRTY) && ntfs_volume_write_flags(
908 vol, vol->flags | VOLUME_IS_DIRTY)) {
924 ntfs_umount(vol, FALSE);