Lines Matching refs:vol
1010 static void get_parent_name(struct filename* name, ntfs_volume* vol)
1017 if (!name || !vol)
1020 rec = calloc(1, vol->mft_record_size);
1027 mft_data = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0);
1033 if (ntfs_attr_pread(mft_data, vol->mft_record_size * inode_num,
1034 vol->mft_record_size, rec) < 1) {
1147 static int get_filenames(struct ufile *file, ntfs_volume* vol)
1198 get_parent_name(name, vol);
1250 * @vol: An ntfs volume obtained from ntfs_mount
1262 static int get_data(struct ufile *file, ntfs_volume *vol)
1312 data->runlist = ntfs_mapping_pairs_decompress(vol, rec, NULL);
1331 * @vol: An ntfs volume obtained from ntfs_mount
1340 static struct ufile * read_record(ntfs_volume *vol, long long record)
1347 if (!vol)
1360 file->mft = malloc(vol->mft_record_size);
1367 mft = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0);
1374 if (ntfs_attr_mst_pread(mft, vol->mft_record_size * record, 1, vol->mft_record_size, file->mft) < 1) {
1404 if (get_filenames(file, vol) < 0) {
1407 if (get_data(file, vol) < 0) {
1419 * @vol: An ntfs volume obtained from ntfs_mount
1438 static int calc_percentage(struct ufile *file, ntfs_volume *vol)
1448 if (!file || !vol)
1524 if (utils_cluster_in_use(vol, j))
1946 * @vol: An ntfs volume obtained from ntfs_mount
1966 static int undelete_file(ntfs_volume *vol, long long inode)
1982 if (!vol)
1986 file = read_record(vol, inode);
2002 bufsize = vol->cluster_size;
2021 if (calc_percentage(file, vol) == 0) {
2090 for (k = 0; k < rl[0].length * vol->cluster_size; k += bufsize) {
2107 for (k = 0; k < rl[i].length * vol->cluster_size; k += bufsize) {
2121 for (k = 0; k < rl[i].length * vol->cluster_size; k += bufsize) {
2135 if (utils_cluster_in_use(vol, j) && !opts.optimistic) {
2143 if (ntfs_cluster_read(vol, j, 1, buffer) < 1) {
2164 * 0 <= (data->size_alloc - data->size_data) <= vol->cluster_size AND
2165 * cluster_count * vol->cluster_size == data->size_alloc THEN file
2175 (d->size_alloc - d->size_data) <= (long long)vol->cluster_size &&
2176 cluster_count * (long long)vol->cluster_size == d->size_alloc) {
2207 * @vol: An ntfs volume obtained from ntfs_mount
2217 static int scan_disk(ntfs_volume *vol)
2232 if (!vol)
2235 attr = ntfs_attr_open(vol->mft_ni, AT_BITMAP, AT_UNNAMED, 0);
2240 NVolSetNoFixupWarn(vol);
2260 re->upcase = vol->upcase;
2261 re->upcase_len = vol->upcase_len;
2265 nr_mft_records = vol->mft_na->initialized_size >>
2266 vol->mft_record_size_bits;
2283 file = read_record(vol, (i+j)*8+k);
2299 percent = calc_percentage(file, vol);
2309 if (!undelete_file(vol, file->inode))
2332 NVolClearNoFixupWarn(vol);
2340 * @vol: An ntfs volume obtained from ntfs_mount
2349 static int copy_mft(ntfs_volume *vol, long long mft_begin, long long mft_end)
2360 if (!vol)
2368 buffer = malloc(vol->mft_record_size);
2374 mft = ntfs_attr_open(vol->mft_ni, AT_DATA, AT_UNNAMED, 0);
2394 nr_mft_records = vol->mft_na->initialized_size >>
2395 vol->mft_record_size_bits;
2405 if (ntfs_attr_pread(mft, vol->mft_record_size * i,
2406 vol->mft_record_size, buffer) < vol->mft_record_size) {
2411 if (write_data(fd, buffer, vol->mft_record_size) < vol->mft_record_size) {
2434 static int handle_undelete(ntfs_volume *vol)
2447 result = !scan_disk(vol);
2461 result = !undelete_file(vol, inode);
2481 ntfs_volume *vol;
2495 vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
2497 if (!vol)
2504 result = !scan_disk(vol);
2512 result= handle_undelete(vol);
2517 result = !copy_mft(vol, opts.mft_begin, opts.mft_end);
2521 (long long)min((vol->mft_na->initialized_size >>
2522 vol->mft_record_size_bits) , opts.mft_end));
2528 ntfs_umount(vol, FALSE);