Lines Matching refs:vol
474 * @vol: An ntfs volume obtained from ntfs_mount
484 static s64 wipe_unused(ntfs_volume *vol, int byte, enum action act)
491 if (!vol || (byte < 0))
495 buffer = malloc(vol->cluster_size);
500 memset(buffer, byte, vol->cluster_size);
503 for (i = 0; i < vol->nr_clusters; i++) {
504 if (utils_cluster_in_use(vol, i)) {
511 result = ntfs_pwrite(vol->dev, vol->cluster_size * i, vol->cluster_size, buffer);
512 if (result != vol->cluster_size) {
518 total += vol->cluster_size;
529 * @vol: An ntfs volume obtained from ntfs_mount
543 static s64 wipe_unused_fast(ntfs_volume *vol, int byte, enum action act)
557 if (!vol || (byte < 0))
560 big_buffer = (u8*)malloc(vol->cluster_size*64);
566 for (i = 0; i < vol->nr_clusters; i+=64) {
567 blksize = vol->nr_clusters - i;
573 if (utils_cluster_in_use(vol, i+j))
576 unused += (blksize - result) * vol->cluster_size;
585 if (ntfs_pread(vol->dev, vol->cluster_size * i,
586 vol->cluster_size * blksize, big_buffer)
587 != vol->cluster_size * blksize) {
599 if (!utils_cluster_in_use(vol, i+j)) {
600 for (k = 0; (k < vol->cluster_size)
603 if (k < vol->cluster_size)
606 buffer += vol->cluster_size;
616 if (!utils_cluster_in_use(vol, i+j)) {
617 memset(buffer, byte, vol->cluster_size);
618 total += vol->cluster_size;
620 buffer += vol->cluster_size;
624 && (ntfs_pwrite(vol->dev, vol->cluster_size * i,
625 vol->cluster_size * blksize, big_buffer)
626 != vol->cluster_size * blksize)) {
643 * @vol: An ntfs volume obtained from ntfs_mount
652 static s64 wipe_compressed_attribute(ntfs_volume *vol, int byte,
682 << vol->cluster_size_bits;
686 ret = ntfs_rl_pread(vol, restart,
688 << vol->cluster_size_bits),
704 vol->cluster_size_bits) - 2))
707 size = (rlt->vcn << vol->cluster_size_bits) - offset;
710 offset = (cur_vcn << vol->cluster_size_bits) - size;
739 ret = ntfs_rl_pwrite(vol, restart,
740 restart->vcn << vol->cluster_size_bits,
763 * @vol: An ntfs volume obtained from ntfs_mount
772 static s64 wipe_attribute(ntfs_volume *vol, int byte, enum action act,
784 size = (vol->cluster_size - offset) % vol->cluster_size;
798 wiped = ntfs_rl_pwrite(vol, na->rl, 0, offset, size, buf);
820 ntfs_volume *vol = ni->vol;
843 wiped = wipe_compressed_attribute(vol, byte, act, na);
845 wiped = wipe_attribute(vol, byte, act, na);
858 * @vol: An ntfs volume obtained from ntfs_mount
869 static s64 wipe_tails(ntfs_volume *vol, int byte, enum action act)
878 if (!vol || (byte < 0))
881 nr_mft_records = vol->mft_na->initialized_size >>
882 vol->mft_record_size_bits;
885 NVolSetNoFixupWarn(vol);
893 ni = ntfs_inode_open(vol, inode_num);
937 NVolClearNoFixupWarn(vol);
945 * @vol: An ntfs volume obtained from ntfs_mount
956 static s64 wipe_mft(ntfs_volume *vol, int byte, enum action act)
966 if (!vol || (byte < 0))
969 rec = (MFT_RECORD*)malloc(vol->mft_record_size);
975 nr_mft_records = vol->mft_na->initialized_size >>
976 vol->mft_record_size_bits;
979 if (utils_mftrec_in_use(vol, i)) {
980 result = ntfs_attr_mst_pread(vol->mft_na, vol->mft_record_size * i,
981 1, vol->mft_record_size, rec);
992 if ((size <= 0) || (size > (int)vol->mft_record_size)) {
1004 memset(((u8*) rec) + size, byte, vol->mft_record_size - size);
1007 (vol->major_ver == 3) ? 0x0030 : 0x002A;
1009 (vol->mft_record_size >> NTFS_BLOCK_SIZE_BITS);
1024 total += vol->mft_record_size;
1029 memset(rec, 0, vol->mft_record_size);
1038 rec->bytes_allocated = cpu_to_le32(vol->mft_record_size);
1045 result = ntfs_attr_mst_pwrite(vol->mft_na, vol->mft_record_size * i,
1046 1, vol->mft_record_size, rec);
1054 if ((vol->mft_record_size * (i+1)) <= vol->mftmirr_na->allocated_size)
1063 result = ntfs_attr_mst_pwrite(vol->mftmirr_na, vol->mft_record_size * i,
1064 1, vol->mft_record_size, rec);
1073 total += vol->mft_record_size;
1084 * @vol: An ntfs volume obtained from ntfs_mount
1095 static s64 wipe_index_allocation(ntfs_volume *vol, int byte, enum action act
1140 s64 ret = ntfs_rl_pread(vol, naa->rl,
1178 wiped = ntfs_rl_pwrite(vol, naa->rl, 0, offset, indx_record_size, buf);
1231 * @vol: An ntfs volume obtained from ntfs_mount
1242 static s64 wipe_directory(ntfs_volume *vol, int byte, enum action act)
1251 if (!vol || (byte < 0))
1254 nr_mft_records = vol->mft_na->initialized_size >>
1255 vol->mft_record_size_bits;
1258 NVolSetNoFixupWarn(vol);
1265 ni = ntfs_inode_open(vol, inode_num);
1336 wiped = wipe_index_allocation(vol, byte, act,
1360 NVolClearNoFixupWarn(vol);
1368 * @vol: An ntfs volume obtained from ntfs_mount
1379 static s64 wipe_logfile(ntfs_volume *vol, int byte, enum action act
1395 if (!vol || (byte < 0))
1400 if ((ni = ntfs_inode_open(vol, FILE_LogFile)) == NULL) {
1479 * @vol: An ntfs volume obtained from ntfs_mount
1490 static s64 wipe_pagefile(ntfs_volume *vol, int byte, enum action act
1501 if (!vol || (byte < 0))
1506 ni = ntfs_pathname_to_inode(vol, NULL, "pagefile.sys");
2150 ntfs_volume *vol;
2173 vol = utils_mount_volume(opts.device, flags);
2174 if (!vol)
2177 if ((vol->flags & VOLUME_IS_DIRTY) && !opts.force)
2205 srandom((int)vol + npasses);
2216 wiped = wipe_directory(vol, byte, act);
2224 wiped = wipe_tails(vol, byte, act);
2232 wiped = wipe_logfile(vol, byte, act);
2240 wiped = wipe_mft(vol, byte, act);
2248 wiped = wipe_pagefile(vol, byte, act);
2257 wiped = wipe_unused_fast(vol, byte,
2260 wiped = wipe_unused(vol, byte, act);
2268 wiped = wipe_unrm(vol);
2292 ntfs_umount(vol, FALSE);