Re: fs inode lookup

A. Ott (ao@ao.morpork.shnet.org)
19 Nov 1998 10:10:00 +0100


********* ***************** ********** **** ***** ***** ************
To subject Re: fs inode lookup
jack@atrey.karlin.mff.cuni.cz (Jan Kara) wrote:
********** ******************** ****** ******** ******* *************

> Hello.
> >
> > For consistency checks in RSBAC I am looking for a way to lookup (or at
> > least check existence of) fs inodes on devices.
> >
> > Currently only kdev number and inode number are available. kdev leads
> > easily to superblock and fs root dentry, inode number leads me nowhere.
> How :?)

sb_p = get_super(kdev);
dentry_p = sb_p->s_root;

Or did I get that wrong?

> > So my questions are:
> >
> > 1. Is there any generic way using vfs? I didn't find any...
> I don't know any. You can only read inode using iget() and then determine
> somehow whether it is deleted (in ext2 using dtime would be enough IMHO).

That's where I got stuck. dtime is not always reliable - or why do I get
zero dtime complains on fsck? How does ext2 detect a deleted inode?

Anyway, if dtime is set, I will treat the inode as deleted, if it's 0, no
harm will be done by keeping an entry for this inode.

> > 2. If not, is there an official way for ext2 (and hopefully others)?
> Another reliable way for ext2 would be to use its library for manipulating
> with filesystem (it is in package e2fsprogs...).

I really don't want do use these fs specific calls and libraries... :(

> Nice hacking. Honza.

Thanx... :)

Amon.

--
Please remove second ao for E-Mail reply - no spam please!
## CrossPoint v3.11 ##

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/