tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Vnode API change: mnt_vnodelist traversal



On Mar 3, 2014, at 4:25 PM, Taylor R Campbell 
<campbell+netbsd-tech-kern%mumble.net@localhost> wrote:

>   Date: Mon, 3 Mar 2014 16:19:40 +0100
>   From: "J. Hannken-Illjes" <hannken%eis.cs.tu-bs.de@localhost>
> 
>   On Mar 3, 2014, at 4:11 PM, Taylor R Campbell 
> <campbell+netbsd-tech-kern%mumble.net@localhost> wrote:
> 
>> That is exactly what I was going for, except with a typed pointer
>> instead of a void pointer.
> 
>   Please explain in more detail why you prefer a typed pointer over a void
>   pointer for opaque data.  What is the benefit?
> 
> If I pass in the wrong thing, then with a typed pointer, the compiler
> will warn; with a void pointer, it won't.  E.g., consider:
> 
> while (vfs_vnode_iterator_next(vi, &vp)) {
>       ...
>       /* Skip to the next one.  */
>       if (!vfs_vnode_iterator_next(vp, &nvp))
>               break;
>       ...
> }
> 
> If vfs_vnode_iterator_next takes a void *, then the compiler will be
> happy with this and there's a nontrivial chance that this won't have
> any obvious adverse effects for a while.  If vfs_vnode_iterator_next
> takes a struct vnode_iterator *, then the compiler will promptly
> inform me that I failed to mind my p's and i's.

Ok, reasonable -- taken.

New diff at http://www.netbsd.org/~hannken/vnode-pass4-3.diff

--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)



Home | Main Index | Thread Index | Old Index