Transfer data from user space to Kernel space and vice-versa, KEXT.
Transfer data from user space to Kernel space and vice-versa, KEXT.
- Subject: Transfer data from user space to Kernel space and vice-versa, KEXT.
- From: Chinki <email@hidden>
- Date: Mon, 29 May 2006 19:27:51 +0530
Dear All,
I am developing KEXT using i/o kit for my usb bulk device and currently stuck while passing the data from "User application" to "Kernel application".
How do we get and set data from User space to Kernel Space and vice-versa ??
Do we need to use copyout and copyin functions to get and set data ???
Below are the steps to send a structure from user level to kernel space.
Step1. Sending data from User level to Kernel level:
My user application and the user client of the KEXT agree on common index and data-structure.
i.e. enum{
kmyFirstCommand,
kmyCommandCounts
}
typedef structP{
mycommandpkt,
myresponsepkt.
}
Step2. I get the data at kernel level using the documented functionality
i.e. through getTargetandMethodForIndex
IOReturn myDriverUserClient::GetDeviceInfo(COMMAND_EXCHANGE* inpkt, COMMAND_EXCHANGE* outpkt, UInt32 inlen, UInt32* outlen)
{
DBLog(("myDriverUserClient::GetDeviceInfo\n"));
}
So in above function
1) Do we need to tranfer "Input structure" we get from the user using "copyin" ? If not, then plz suggest the alternate method ? B/w can memcpy work in this situation ?
2) Do we need to convert the "output structure" using "copyout" ? Again, If not, then plz suggest the alternate method ? B/w can memcpy work in this situation ?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden