When transfer data from app to driver via IOCTL, which is better: by string or by common struct?
If the app needs to exchange data with the underlying driver via IOCTL, I know that the app and the driver can define a common struct to hold data and pass it bidirectionally. However, I recently noticed that some app/driver doesn't use this paradigm. Instead, they pass a string represnetation of the data and let the driver parse the string to get each fileds of the data.
I can feel that this is not a good choice, e.g. the string parser may slow the driver, which should be fast in kernel.
Can anyo开发者_如何学JAVAne compare these two approaches and give the pros and cons? Thanks.
Not sure what protocol passes the string of data to underlying kernel module/code, but in linux you can use netlink for fullduplex IPC between the user space proc. and kernel.
精彩评论