Thank you for creating and releasing the NTFS user libraries. It is much
appreciated.
I would like to ask a question on why the API for dealing with runlists is
setup the way it is.
I have a file that is fragmented ~2000 times. I am trying to find out what
clusters this file is using. When dealing with runlists one much check to
see if the runlist element is mapped and if not then call
ntfs_attr_map_runlist(). I have found that for my file that is fragmented
2000 times I must call ntfs_attr_map_runlist()12 times to get the complete
runlist.
I think I am missing something. What advantage does this method have over
just getting the entire runlist to start with?
[Sample Code showing what I am talking about:]
{
ntfs_inode *ni;
ntfs_attr *na;
runlist_element *rl;
int i;
/* ...[snip]... */
/*Goal: Find out what clusters on the disk are being used by
filename*/
if(!(rl = ntfs_attr_find_vcn(na, 0))) {
perror("Error calling ntfs_attr_find_vcn");
exit(1);
}
for(i=0; rl[i].length != 0; i++) {
if (rl[i].lcn == LCN_HOLE) continue;
if (rl[i].lcn == LCN_RL_NOT_MAPPED) {
if (ntfs_attr_map_runlist(na, rl[i].vcn) == -1) {
perror("ntfs_attr_map_runlist failed\n");
exit(1);
} else {
rl = ntfs_attr_find_vcn(na, 0);
if(!rl) {
perror("Error calling
ntfs_attr_find_vcn");
exit(1);
}
--i;
continue;
}
}
/* ...[snip]... */
}
}
-------------------
Russ Christensen
Computer Science, Undergraduate
www.cs.utah.edu/~rchriste/
"Why is not a question, but a lesson learned in time."
--Artist:Greenday, song: Time of Your Life
|