[OpenAFS-devel] Novice query about conversion of "struct vcache" to "struct vnode"

chas williams - CONTRACTOR chas@cmf.nrl.navy.mil
Mon, 30 Oct 2006 07:01:31 -0500


In message <fcb760c80610300327y3b5c077dtb70b6be3642ed2be@mail.gmail.com>,"Amit Dang" writes:
>My confusion is related to typecasting of "struct vnode **" to "struct
>vcache **".

take a look at struct vcache in src/afs/afs.h.  you will notice that
struct vnode is the first member of the struct vache.  this means a
struct vcache contains the struct vnode so you can just cast between
the these.  however for some platforms, its a pointer instead of the
vnode itself.  there are some macros that you should use to convert
the struct vcache to a vnode, but they arent used everywhere.