Hi Anton and all list,
I know that you are busy but in order to finish my project I need one little
hint. What I am gonna finish is to expand the utility ntfsfix that check for
the consistency of the disk. I have creat a code that store the current
$Bitmap in an array and now I am creating my own bitmap exploring the disk.
For the first task I have used and changed the code you have develop in
order to check if one cluster is in use or not ( utils_cluster_in_use ). So
I have stored the $Bitmap in an array.
In order to build my own Bitmap I found in the code of ntfscluster.c the
function dump_file where for each node give you the number and the lenght of
the clusters used from the "non_resident" attribute. I loop from the first
MFT to the last (vol->nr_mft_record) and for each cluster used I marked the
corresponded bit to one.
Now the problem that as newbie I cannot resolve is that I don't know in
which cluster is stored each MFT record. So when I access to an MFT I cannot
mark the bit of the cluster where that MFT reside because I don't know.
I was wondering that this number could be the number of MFT multiplied for
the size of the MFT divided per the cluster lenght.
I catch this information reading this code in mft.c :
int ntfs_mft_records_read(const ntfs_volume *vol, const MFT_REF mref,
const s64 count, MFT_RECORD *b)
{
s64 br;
VCN m;
Dprintf("%s(): Entering for inode 0x%llx.\n", __FUNCTION__, MREF(mref));
if (!vol || !vol->mft_na || !b || count < 0) {
errno = EINVAL;
return -1;
}
m = MREF(mref);
if (m + count > vol->nr_mft_records) {
errno = ESPIPE;
return -1;
}
br = ntfs_attr_mst_pread(vol->mft_na, m << vol->mft_record_size_bits,
count, vol->mft_record_size, b);
........
I know that my project is not very big, but for me was a challenge to
understand the code and to figure-out how it works.
If you have any concerns or warnings about my concepts understing be free to
express them.
I hope to finish and send you my code in a couple of weeks, thank you to all
of you for your support.
Fabiano
|