Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - How to find ocb after iofunc_open_default ?: (4 Items)
   
How to find ocb after iofunc_open_default ?  
Below is a snippet from resource manager tutorial.  How do I point to newly created ocb in the place indicated by a 
comment? I extended ocb structure and I need to initialize my extra fields there.

int
io_open (resmgr_context_t *ctp, io_open_t *msg,
         RESMGR_HANDLE_T *handle, void *extra)
    int     sts;
    sts = iofunc_open_default (ctp, msg, handle, extra);
    if (sts == EOK) {
//HOW TO POINT TO OCB HERE?
        log_open_request (ctp, msg);
    }
    return (sts);
}

RobertL
Re: How to find ocb after iofunc_open_default ?  
You can use the (not documented in the current release)
   void *resmgr_ocb(resmgr_context_t *ctp)
call.

This may not exist in your libc, and you may have to instead use:
   void *_resmgr_ocb(resmgr_context_t *ctp,  struct _msg_info *info)
which is documented, but isn't quite as handy since it takes a few more
arguments.

Thomas
On Mon, Aug 4, 2008 at 1:24 PM, bob lipka <community-noreply@qnx.com> wrote:

> Below is a snippet from resource manager tutorial.  How do I point to newly
> created ocb in the place indicated by a comment? I extended ocb structure
> and I need to initialize my extra fields there.
>
> int
> io_open (resmgr_context_t *ctp, io_open_t *msg,
>         RESMGR_HANDLE_T *handle, void *extra)
>    int     sts;
>    sts = iofunc_open_default (ctp, msg, handle, extra);
>    if (sts == EOK) {
> //HOW TO POINT TO OCB HERE?
>        log_open_request (ctp, msg);
>    }
>    return (sts);
> }
>
> RobertL
>
> _______________________________________________
> OSTech
> http://community.qnx.com/sf/go/post11405
>
>
Re: How to find ocb after iofunc_open_default ?  
Thank you, you are very helpful as always. In the mean time I had to do something, so I initialized my extra fields as 
recommended in overrided ocb_calloc(), but it was not convenient at all. I had to pass some arguments via global 
variables under mutex guard since I do multithreading there. Next time I touch this code I try your way.

> You can use the (not documented in the current release)
>    void *resmgr_ocb(resmgr_context_t *ctp)
> call.
> 
> This may not exist in your libc, and you may have to instead use:
>    void *_resmgr_ocb(resmgr_context_t *ctp,  struct _msg_info *info)

RobertL
Re: How to find ocb after iofunc_open_default ?  
> You can use the (not documented in the current release)
>    void *resmgr_ocb(resmgr_context_t *ctp)
> This may not exist in your libc

I could not resist temptation and I have rewritten this piece first time at work. resmgr_ocb() exists in my 6.3.0 sp3 
and seems to work fine. Once again Thank You!
RobertL