Thanks for your help. I checked all the interface supported by
IOMemoryDescriptor
but I cannot find one that can work for me. I think I need to give
you more details.
I am writing a filter driver. In the read/write routines, I got a
IOMemoryDescriptor
as input but I really need another buffer of the same size to do
some processing.
You should not be allocating this buffer for each I/O, as I have
already noted.
Instead, allocate a small pool of them by subclassing IOCommand and
use an IOCommandPool to manage the free queue.
As Garth noted, you need to use an IOBufferMemoryDescriptor for the
buffer, which you'd then attach to your IOCommand subclass.
I thought about reusing the memory buffer but I cannot assume that
the sizes are all the same
and it will be hard to manage them this way. It is the kernel's
job to manage memory.
It's your job to use it sensibly. You've been told how; now go for
it. 8)