> com_MySoftwareCompany_driver_MyFilterScheme* fProvider;
I am sorry, I haven't look the code properly.
you have fProvider of your filterScheme class.
fTask would tell to map in kernel userClient context for calling task - fTask but than how this would solve the problem of calling the driver function?
Please help me to understand.
fTask is the application task which has made the code to driver. is this correct?
We need to share memory between kernel task and user space, so why to give fTask rather than kernel_task?
I couldn't find the answer from the Writing custom user client docuement.
Regards,
Parav Pandit
Dan Markarian <email@hidden> wrote:
Hi Yogesh,
> IOMemoryDescriptor *mem = IOMemoryDescriptor::withAddress(buf,
> 1024, kIODirectionOut);
IOMemoryDescriptor *mem = IOMemoryDescriptor::withAddress(buf,
1024, kIODirectionOut, fTask);
Dan
On 30 Mar 2005, at 7:54 AM, Yogesh P wrote:
> Hi folks,
> I have written a filter scheme driver,userclient and userspace
> application tool for doing read/write operations on IOMedia
> partitions.
>
> I have successfully send a structure from userspace to kernelspace
> through userclient.But when i try to read/write a buffer from
> userspace
> to kernel space,i am not able to map userspace buffer to kernel
> address
> space.
> I am specifying my code here.
> UserkernelShared.h includes the following structure.
> typedef struct MySampleStruct
>!
{ UInt32
size;
> void* buff;
> } MySampleStruct;
> In main function of userspace application i am calling the
> SPSOFT_Write
> function as follows.
> char *buf;
> UInt32 size;
> size = kBufSize;
> buf = malloc(sizeof(char) * 1024);
> bzero(buf, sizeof(char) * 1048576);
> strcpy(buf, " Hello MACOSX");
>
> I want to write this "buf" to the disk through userclient.
>
> // This shows an example of calling a user client's open method.
> kernResult = MyDoWrite(dataPort, buf, size);
> if (kernResult != KERN_SUCCESS)
> { printf("\n kMyDoWrite returned %d\n", kernResult);
> // This closes the connection to our user client and destroys the
> connect handle.
> IOServiceClose(dataPort);
> return 0;
> }
>
> The definition of MyDoWrite is as follows.
> kern_return_t
> MyDoWrite(io_connect_t connect, void *buf, UInt32 size)
> {
kern_return_t kernResult;
> if (!connect){
> return kIOReturnNoDevice;
> }
> else {
> kernResult = IOConnectMethodScalarIStructureI(connect,
> kMyDoWrite,
> 0,
> size,
> buf
> );
> }
> if (kernResult == kIOReturnSuccess){
> printf("\n kMyDoWrite was successful..........\n");
> }
> return kernResult;
> }
> My Userclient.h and Userclient.cpp includes the following code.
>
> com_MySoftwareCompany_driver_MyFilterScheme* fProvider;
>
> IOExternalMethod *
> com_MySoftwareCompany_MyUserClient::getTargetAndMethodForIndex
> (IOService
> ** target, UInt32 index)
> {
> { // kMyDoWrite
> NULL,
> (IOMethod) &com_MySoftwareCompany_MyUserClient::myDoWrite,
> kIOUCScalarIStructI,
> 0,
> 0xffffffff
> },
> }
> IOReturn com_MySoftwareCompany_MyUserClient::myDoWrite(void* buf,
>
UInt32
> size)
> { IOReturn retWrite = kIOReturnSuccess;
> UInt32 Size = size;
> if (fProvider && !isInactive()){
> IOMemoryDescriptor *mem = IOMemoryDescriptor::withAddress(buf,
> 1024,
> kIODirectionOut);
> if (mem){
> retWrite = mem->prepare();
> if(kIOReturnSuccess == retWrite){
> retWrite = fProvider->myDoWrite
> (mem,Size); //when i
> call this driver function it gives me the error as
> IOService::fProvider
> has no function myDoWrite.
> }
> mem->complete();
> mem->release();
> }else{
> retWrite = kIOReturnNoMemory;
> }
> release();
> }
>
> How should i call the filter scheme driver read/write routines from my
> userclient?? Or is there any sample code of read/write for filter
> scheme
> driver???
>
> Any help, certainly help me in solving this problem.
> Thanks!
in
Yahoo! India Matrimony: Find your life partner
online. _______________________________________________
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