tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Vnode API change: mnt_vnodelist traversal
Date: Mon, 3 Mar 2014 15:55:16 +0100
From: "J. Hannken-Illjes" <hannken%eis.cs.tu-bs.de@localhost>
On Mar 3, 2014, at 3:28 PM, Taylor R Campbell
<campbell+netbsd-tech-kern%mumble.net@localhost> wrote:
> /* mount.h */
> struct vnode_iterator; /* opaque */
>
> void vfs_vnode_iterator_init(struct mount *mp, struct vnode_iterator
**vip);
> void vfs_vnode_iterator_destroy(struct vnode_iterator *vi);
> bool vfs_vnode_iterator_next(struct vnode_iterator *vi, struct vnode
**vpp);
>
> /* vfs_mount.c */
> struct vnode_iterator {
> struct vnode vi_vnode;
> };
No. I want to keep the state opaque to the caller. There is no need for
the calling party to know anything about state internals.
That is exactly what I was going for, except with a typed pointer
instead of a void pointer. The definition of struct vnode_iterator
would be internal to vfs_mount.c; mount.h would only expose a forward
declaration. Callers would be unable to dereference it or pass it
around anywhere else without casts or compiler warnings.
You don't even need to define struct vnode_iterator: leaving it as
`struct vnode_iterator;' and just casting inside vfs_vnode_iterator_*
instead of using &vi->vi_vnode would do just as well.
Home |
Main Index |
Thread Index |
Old Index