[OpenAFS] afs file id's

craigev@us.ibm.com craigev@us.ibm.com
Wed, 4 Sep 2002 16:54:32 -0400


On Wednesday, 09/04/2002 at 01:21 MST, "Matthew N. Andrews" <matt@slackers.
net> wrote:
> Hello, is there a tool that will allow me to determine what the name of
> a file with a given FID (as logged in the FileLog)is? IE, if I see:
>
> Tue Sep  3 01:00:31 2002 SRXAFS_FetchData, Fid = 536892583.761.13052,
> Host 130.237.230.154, Id 32766
>
> in my log, is there a way to determine what the name of the file being
> accessed by host 130.237.230.154 is?
>
> being able to retrieve the file id given a name is also sufficient(I'm
> willing to build a static
> table of name <-> id mappings by walking the volume if necesary.)

I think that the fid is going to be in volume.vnode.uniquifier, so your
example is volume 536892583, vnode 761, and uniquifier 13052.  I think that
these are in decimal in the log.  The cache manager generates the st_ino
field, printed with "ls -li" on Unix, by shifting the volume ID left 16
bits and then adding in the vnode number, then masking off the sign bit.
My bet is, therefore, that the inode number (st_ino value) of the file you
mentioned would be ((536892583 << 16) + 761) & 0x7fffffff, or 1385956089.
You can see this little bit of arithmetic in src/afs/VNOPS/afs_vnop_attrs.
c, function afs_CopyOutAttrs(), computing attrs->va_nodeid.

            Craig