[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Filename to "inode" pointer in C



Thanx a lot for your help you guys...   this is what I came up with,
thanx to your help.   For those also interested,  this following function
does exactly what I want.

// Given the path of a file,   return the inode
ino_t   getInode(char *fname) {
	FILE f;
	struct stat mystat;
	
	stat(fname, &mystat);
	return mystat.st_ino;	
}

Ok,  now that I have the inode number of the file,   the next thing I need to know,  is now to find all the raw physical sectors used by the data in this file.

Is there a utility (preferrably in C) that given the inode of a file,   would return an array of the physical sectors belonging to that file?

Or,   better yet,   given a specific sector,   to determine what file references this sector (or node).    I think I can get the filename from the inode already.

By the way,   if anything useful comes out of this,   I'll post the code.

John