[openib-general] Re: [PATCH] memory leaks in ipoib, srp

James Lentini jlentini at netapp.com
Thu Sep 1 10:07:19 PDT 2005



On Thu, 1 Sep 2005, Roland Dreier wrote:

>     Michael> I noticed the following while working on the client data patch.
> 
> Good catch, applied.
> 
>     Michael> BTW, opinions on the newer version I sent?
> 
> I'm undecided.  On the one hand, it seems like a reasonable thing to
> do. On the other hand, I'm not sure whether having two remove entry
> points is just going to confuse people.  And in any case I don't see
> the real motivation for making the change now.

I agree. Adding two removal functions is confusing. 

Michael, I liked your original idea of having the add upcall return a 
context value. The issue with that approach was that the return value 
was both an indication of the client's interest in a future device 
removal event and the client's context. Ideally, the client's context 
would remain opaque, but because it was being used for two things, 
this wasn't the case.

Off the top of my head, I can think of two ways to fix that: make the 
return value a structure:

	struct ib_context { // you can probably think of a better name
		int subscribe; // ditto
		void *context;
 	};

        ib_context* (*add)   (struct ib_device *);

or add an additional parameter to the client's add call for the 
context:

        int (*add)   (struct ib_device *, void **context);

where int is !0 if the client want's to receive a removal callback.



More information about the general mailing list