From: Alan H. <aho...@va...> - 2001-04-27 11:10:54
|
On Fri, Apr 27, 2001 at 12:06:51PM +0100, Doug Rabson wrote: > > On Fri, Apr 27, 2001 at 11:43:45AM +0100, Doug Rabson wrote: > > > This is great Alan. When this gets closer to working, I would like to > try it > > > out. I have a few ideas on how to simplify the authentication code in > the > > > drivers. The linux driver relies on being able to track each individual > open > > > call to the driver which isn't the way BSD drivers work so I try to look > up > > > the auth information using the current PID. I recently realised an > > > alternative way of writing drivers in BSD which would make it possible > to > > > track each open call which would make life easier for DRM. > > > > > Definately could use your help when the compilation issues are out of the > way. > > > > One thing though. We use the copy_from_user and copy_to_user in linux, and > > I've noticed you didn't do that in the original BSD drivers. You just > passed > > a pointer. Was there a reason for this ? From what I can see - we should > > be using copyin/copyout ? Is this right (BSD kernel knowledge is very > new!). > > I guess we are talking about ioctls. In BSD (and I think in most AT&T > derived unix kernels), the kernel handles the copyin/copyout of ioctl > arguments. It requires that the data direction and size fields of the ioctl > number are correct and it uses that information to copy to/from a kernel > buffer. The driver's ioctl routing is actually passed a pointer to a kernel > buffer, not the user's pointer. Of course, if the structure passed to ioctl > contains pointers to other user data structures, the driver must perform its > own copyin. > > It would be pretty easy to do the copy_from_user/copy_to_user for the linux > drivers in common code and I think it would simplify the drivers. > Sure. Thanks for that. Alan. |