Garrett D'Amore wrote: > Edward Pilatowicz wrote: >> On Tue, Oct 09, 2007 at 08:59:06PM -0700, Garrett D'Amore wrote: >> >>> I find the nomenclature here a bit confusing. >>> >>> ddi_copyin or copyin are most often used to copy from user space *in* to >>> kernel space. >>> >>> ddi_copyout or copyout likewise usually reference copying data *out* >>> from the kernel to user space. >>> >> >> actually, iirc this isn't correct. >> >> ddi_copyin() will copy from userland -or- the kernel into the kernel. >> ddi_copyout() will copy from the kernel to userland -or- the kernel. >> this is why drivers should use these routies vs copyin() and copyout(). >> if drivers use copyin() and copyout() and they are not layering safe >> and can not be accessed from within the kernel via the ldi. >> > > Yes, that is the "in" or the "out" is taken relative to the kernel. The > other side can be userspace, or kernel space (but is usually > userspace). (You'll note I said "most often" and "usually" above.) > The point is the direction of the reference. >> these new bp "in/out" interfaces behave the same way the ddi "in/out" >> interfaces do, which (to me) makes complete sense to me. >> > > I must be confused then. Because I read the documents and came away > believing that bp_copyin() copied into a buf (which could be user or > kernel space) from a kernel vaddr. That's backwards from ddi_copyin, > which copies from user (or kernel) space "in" to a kernel vaddr. > >> >>> In otherwords, the "in/out" are normally used to in reference to kernel >>> space. >>> >>> Your proposal, bp_copyin makes the "in" for this API in reference to the >>> buf. (Which may or may not be userspace.) >>> >>> >> >> correct. i see no problem with this. >> > > Again, I just find it backwards. The one part of the argument which is > a fixed type of address, the kernel vaddr, is the point of reference in > the ddi_copyin/copyin, but *not* in the bp_copyin. > > Its a switch of the point of reference that I find confusing.
bp_copyin - copy into a buf_t bp_copyout - copy out of a buf_t I think it would be more confusing if it were the other way around. bp_ makes the reference point want to be buf_t in my mind. If your not happy with that, how about... bp_copyto - copy into a buf_t bp_copyfrom - copy out of a buf_t MRJ -- Mark Johnson <mark.johnson at sun.com> Sun Microsystems, Inc. (781) 442-0869
