I've implemented a character device and I'd like to ask If this is correct:
In a Userspace I've a struct with 2 pointers.
I
writethis struct into my device.In my
writefunction in char device Icopy_from_userthis structure into kmalloced space.After this I'm in KS and got 2 pointers to US so I want to
copy_from_usereach. Am I allowed to do so right after firstcopy_from_userby using this copied addresses? They point to a data in US application which calledwritefunction not to thewritefunction argumentchar *buf开发者_JS百科.
Seems like it should work.
I'd probably be inclined to put this sort of thing into an ioctl instead of write, depending on whether the operation is similar to what other devices do when written to. But that's just style; it's functionally the same.
加载中,请稍侯......
精彩评论