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 16:19:40 +0100
   From: "J. Hannken-Illjes" <>

   On Mar 3, 2014, at 4:11 PM, Taylor R Campbell 
<> 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))

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.

Home | Main Index | Thread Index | Old Index