Re: finding 'struct vfsmount' by given 'struct super_block'

From: Tigran Aivazian (tigran@veritas.com)
Date: Mon May 08 2000 - 08:27:38 EST


On 8 May 2000, Trond Myklebust wrote:

> >>>>> " " == Tigran Aivazian <tigran@veritas.com> writes:
>
> > mnt = list_entry(sb->s_mounts, struct vfsmount,
> > mnt_instances);
>
> > then it won't compile because of "cannot convert to a pointer
> > type" error.
>
> That's because s_mounts is the list head. If it is empty, then
> s_mounts.next == s_mounts.prev == &s_mounts
> if not then s_mounts.next points to the first mount instance.
>
> i.e. you need something like
>
> if (!list_empty(&sb->s_mounts))
> mnt = list_entry(sb->s_mounts.next, struct vfsmount, mnt_instances);

Thanks, this worked!

Regards,
Tigran

-
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/



This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:11 EST