[openib-general] [RFC] [PATCH 1/2] sa_query: add generic query interfaces capable of supporting RMPP

Sean Hefty sean.hefty at intel.com
Tue Aug 1 17:22:02 PDT 2006


>I think I would rather see this called an "iterator".  The word "cursor"
>tends to mean that blinky thing on your screen these days.

That's easy enough to change.

> > +int ib_sa_get_next_attr(struct ib_sa_attr_cursor *cursor, void *attr);
>
>How does the consumer know how big the buffer has to be?

My assumption was that the user would know based on the context of the query, or
could use the attribute id field in the received MAD as a guide.  I was having
attr reference an unpacked struct ib_sa_path_rec, ib_sa_mcmember_rec,
ib_sa_service_rec, etc.  I will convert these to return a pointer to the packed
structure instead.

>    ib_sa_iter_next -- bump the iterator
>    ib_sa_iter_last -- return true if the iter has been bumped past the end
>    ib_sa_iter_attr -- return pointer to attr that iter is pointing at
>    ib_sa_iter_size -- return size of attr that iter points at

Note that an SA attribute can span across two different MADs, so some sort of
intermediate buffer is needed in certain cases.

I'll update the patch to use the first three calls.  I'm not as sure about
ib_sa_iter_size.  The packed attribute size can be determined from the MAD
attr_offset field, but I'm guessing that most users will need to unpack the
attribute before use.

- Sean




More information about the general mailing list