On Fri, 2004-03-12 at 16:42, Szakacsits Szabolcs wrote:
> On Fri, 12 Mar 2004, Anton Altaparmakov wrote:
>
> > "Modify meaning of ntfs_volume->nr_mft_records to be the number of
> > initialized mft records, not total mft records. This makes far more
> > sense and in fact reflects how nr_mft_records is being used in both
> > libntfs and the utilities."
> [...]
> > Could people using nr_mft_records in their applications double check for
> > me and tell me if this is a problem for them?
>
> This totally and fatally breaks ntfsresize and ntfsclone.
What do you mean? I looked at their code and they both looked wrong to
me with the old nr_mft_records...
In ntfsclone this code is affected:
last_mft_rec = volume->nr_mft_records - 1;
for (; inode <= last_mft_rec; inode++) {
blah...
err = ntfs_file_record_read(volume, mref, &ni->mrec, NULL);
if (err == -1) {
free(ni);
continue;
}
blah...
}
The above continue would always trigger for all mft records beyond
initialized ones so the new nr_mft_records actually saves you from
having to go through them!
How does that break ntfsclone?
And for ntfsresize this code is affected:
last_mft_rec = vol->nr_mft_records - 1;
for (; inode <= last_mft_rec; inode++) {
blah...
if ((ni = ntfs_inode_open(vol, (MFT_REF)inode)) == NULL) {
if (errno == EIO || errno == ENOENT)
continue;
perr_exit("Reading inode %lld failed", inode);
}
blah...
}
As in ntfsclone, the above continue would always trigger, so again, the
new nr_mft_records is saving you time and not breaking anything.
In ntfsresize the following code is also affected:
for (mref = 1; mref < (MFT_REF)vol->nr_mft_records; mref++)
relocate_inode(resize, mref);
And relocate_inode() has:
if (ntfs_file_record_read(vol, mref, &resize->mrec, NULL)) {
if (errno == EIO || errno == ENOENT)
return;
perr_exit("ntfs_file_record_record");
}
blah...
Here the return would always trigger so again the new nr_mft_records is
saving you time not breaking anything.
Convinced? If not you will have to walk me though how the code is now
broken because I fail to see it!
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ &
http://www-stu.christs.cam.ac.uk/~aia21/
|