Hi Sasha, On Thu, May 26, 2011 at 12:38 PM, Sasha Levin <levinsasha928@xxxxxxxxx> wrote: >>> One option here is to rename 'struct ioport_entry' to 'struct ioport' >>> and pass a pointer to that as the first argument to all of the ops. >>> That's what most APIs in the kernel do anyway. >> >> Why do it like that? this way users of the callback functions will need >> to know the internal structure of struct ioport_entry. On Thu, May 26, 2011 at 12:43 PM, Pekka Enberg <penberg@xxxxxxxxxx> wrote: > Look at 'struct inode' or similar data structure in the kernel. That's > how we do it. You can then also do s/params/priv/. Btw, the whole notion of 'internal structure' for structs in C code is a pretty broken concept. In most cases, you just end up passing untyped fragments of the data to callers which makes following the data flow in code difficult. Passing 'struct ioport' down to the code makes the code more obvious and readable. Encapsulation is important but emulating that with hiding structs in .c files isn't helpful at all. Face it, there's no proper support for that in C so you just need to rely on conventions to do it. Pekka -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html