Changes by: antona
Update of /cvsroot/linux-ntfs/linux-ntfs/ntfstools
In directory usw-pr-cvs1:/tmp/cvs-serv31088/ntfstools
Modified Files:
ntfsfix.c
Log Message:
Mft mirror now updated from ntfs_write_mft_record, yey! Fixup ntfstools accordingly.
Index: ntfsfix.c
===================================================================
RCS file: /cvsroot/linux-ntfs/linux-ntfs/ntfstools/ntfsfix.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -U2 -r1.32 -r1.33
--- ntfsfix.c 2 Jun 2002 23:02:20 -0000 1.32
+++ ntfsfix.c 5 Jun 2002 20:32:53 -0000 1.33
@@ -232,25 +232,8 @@
"$MFTMirr... ");
}
- /*
- * Copy the buffer from $MFT to $MFTMirr (due to USN
- * stuff, can't recycle the buffer).
- */
- memcpy(m2 + i * vol->mft_record_size,
- m + i * vol->mft_record_size,
- vol->mft_record_size);
br = ntfs_write_mft_record(vol, i, (MFT_RECORD*)(m +
i * vol->mft_record_size));
- if (br)
- goto mirr_sync_failed;
- br = ntfs_mst_pwrite(vol->fd, (vol->mftmirr_lcn <<
- vol->cluster_size_bits) +
- i * vol->mft_record_size, 1,
- vol->mft_record_size,
- m2 + i * vol->mft_record_size);
- if (br != 1) {
-mirr_sync_failed:
+ if (br) {
puts(FAILED);
- if (br != -1)
- errno = EIO;
perror("Error correcting $MFTMirr");
goto error_exit;
@@ -274,10 +257,4 @@
mount_ok:
m = NULL;
- m2 = (__u8*)malloc(vol->mft_record_size);
- if (!m2) {
- perror("Failed to allocate memory");
- goto error_exit;
- }
-
if (ntfs_read_file_record(vol, FILE_Volume, (MFT_RECORD**)&m, NULL)) {
perror("Failed to read $Volume");
@@ -321,20 +298,8 @@
/* FIXME: The above makes me puke! We definitely need functions just
taking the volume and flags and setting the volume flags! */
- /* Sync $MFTMirr and $MFT buffers. */
- memcpy(m2, m, vol->mft_record_size);
br = ntfs_write_mft_record(vol, FILE_Volume, (MFT_RECORD*)m);
if (br) {
puts(FAILED);
- if (br != -1)
- errno = EIO;
- perror("Error writing $Volume to $MFT");
- goto error_exit;
- }
- br = ntfs_mst_pwrite(vol->fd, (vol->mftmirr_lcn <<
- vol->cluster_size_bits) + 3 * vol->mft_record_size, 1,
- vol->mft_record_size, m2);
- if (br != 1) {
- puts(FAILED);
- perror("Error writing $Volume to $MFTMirr");
+ perror("Error writing $Volume");
goto error_exit;
}
@@ -342,7 +307,7 @@
printf("\n");
/*
- * Fill the value of the $LogFile data attribute (ie. the contents of
- * the file) with 0xff's, thus marking the journal as empty.
- * FIXME(?): We might need to zero the LSN field of every single $Mft
+ * Fill the value of the $LogFile data attribute, i.e. the contents of
+ * the file, with 0xff's, thus marking the journal as empty.
+ * FIXME(?): We might need to zero the LSN field of every single mft
* record as well. (But, first try without doing that and see what
* happens, since chkdsk might pickup the pieces and do it for us...)
|