On Mon, May 08, 2000 at 11:47:37AM +0100, Tigran Aivazian wrote:
> how do I find the vfsmount structure by given superblock?
> I tried:
> mnt = list_entry(&sb->s_mounts, struct vfsmount, mnt_list);
> mnt = list_entry(&sb->s_mounts, struct vfsmount, mnt_instances);
> and they both point to garbage. I think ->mnt_list is expected to be wrong
> as it is headed by vfsmntlist.prev and not by &sb->s_mounts but
> ->mnt_instances should work (judging from add_vfsmnt()), no?
Look at the definition of list_entry in list.h.
If ptr points to the member field of a struct of type type,
then list_entry(ptr, type, member) points at the struct itself.
Now &sb->s_mounts points to the s_mounts field of a struct superblock
and list_entry(&sb->s_mounts, struct superblock, s_mounts)
would give you sb back again.
But if you delete the & then the second version looks better.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to email@example.com
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:11 EST