David Sarrazin
|
RE: iofunc_open_default Memory Ownership
|
David Sarrazin
03/29/2010 11:59 AM
post50706
|
RE: iofunc_open_default Memory Ownership
Mark,
The iofunc_attr_t structure has to be unique for each unique named
entity that is opened in the resource manager, so the memory
requirements will be based on how many open FD there are, and not how
many total "files" exist, assuming you are passing _RESMGMR_FLAG_DIR to
the resmgr_attach() call. The iofunc_attr_t will need to be allocated
on IO_OPEN, or if you detect that the file is already opened, you can
just iofunc_ocb_attach() a new OCB to the existing attr structure.
However, you could save some memory by making the "register" files
psuedo files, which don't really exist, and don't get their own
iofunc_attr_t. Just extend the iofunc_attr_t to also hold the
information about number of registers, and anything else required from
the "register" level. Then in the IO_OPEN handler, strip off the
register portion of the pathname, and use that as a flag in the OCB to
indicate which register the operations are really targetted at.
David
> -----Original Message-----
> From: Mark Dowdy [mailto:community-noreply@qnx.com]
> Sent: March 26, 2010 8:50 PM
> To: ostech-core_os
> Subject: iofunc_open_default Memory Ownership
>
> The documentation for iofunc_open_default doesn't mention
> memory 'ownership' for the structured passed in the attr
> parameter. Can anyone help with the memory requirements for
> the attr parameter? Are the values in the passed in structure
> copied to a resource manager control structure or is the
> memory pointed to by attr expected to remain valid for the
> duration of the session (i.e. attr should not be automatic or
> reused for multiple 'files/directories')?
>
> I ask because I'm attempting to create a resource manager to
> provide access to the registers on a number of devices
> connected to our product. Each device has over 250 registers
> and there can be from one to twenty devices on the bus.
> That's a lot of attr structures if they have to be unique.
> FWIW, I'm looking at a directory hierarchy along the lines
> of [mount point]/device/[device number]/[register number]. I
> need to dynamically populate the 'device' directory because
> the number of devices is discovered and varies depending on
> system configuration. A directory listing of the 'device'
> directory should show all devices currently running. All
> devices have the same register set.
>
> Thanks.
>
> Mark
>
>
>
>
>
> _______________________________________________
>
> OSTech
> http://community.qnx.com/sf/go/post50613
>
>
|
|
|