Re: [PATCH 08/17] odb/source: make `close()` function pluggable
- From
Justin Tobler <jltobler@gmail.com>
- Date
- Mar 5, 2026, 17:11 UTC
- Message-ID
- <aam432ZZOigjUiAx@denethor>
- In-Reply-To
- <aamD3Xm1_E5zMdj1@pks.im>
On 26/03/05 02:23PM, Patrick Steinhardt wrote:
Show 25 quoted lines
> On Wed, Mar 04, 2026 at 03:03:26PM -0600, Justin Tobler wrote:
> > On 26/02/23 05:17PM, Patrick Steinhardt wrote:
> > > Introduce a new callback function in `struct odb_source` to make the
> > > function pluggable.
> > >
> > > Signed-off-by: Patrick Steinhardt <ps@pks.im>
> > > ---
> > [snip]
> > > +/*
> > > + * Close the object database source without releasing he underlying data. The
> > > + * source can still be used going forward, but it first needs to be reopened.
> > > + * This can be useful to reduce resource usage.
> > > + */
> > > +static inline void odb_source_close(struct odb_source *source)
> > > +{
> > > + source->close(source);
> > > +}
> >
> > Just to be safe, should we BUG()/ASSERT() in case the provide source is
> > NULL? Or do we expect the calling pattern to always provide an actual
> > source?
>
> We don't do that for any of the other wrappers either, so I'm not quite
> sure why closing would be special. If this was the free function I might
> agree, but otherwise I don't quite see the value.Fair, I noticed that we did it in the free function, so I was wondering if we wanted to apply it to the other functions as well. But thinking about it some more, there is proabably no/little value.
-Justin