On Sat, Aug 19, 2017 at 09:07:55PM +0200, Jan Engelhardt wrote: > > On Saturday 2017-08-19 10:43, Eric Leblond wrote: > > >>> Hence I defined a global init and deinit. But maybe it does not > >>> really make sense and could be attached to each context or init > >>> could be done at first usage. > >> > >> My idea was to implement simple reference counting to see whether > >> the library was already initialized and whether it is safe to > >> deinit. Of course this needs some serialization for thread-safety. > >> > >> Or maybe the deinit can be ignored completely and > >> nft_global_init() just has to check whether data is already > >> initialized or not. > > > >I have used numerous libraries providing a global init or deinit. > >For now we could easily skip it with your approach or another but I > >prefer we have it existing so it is available later in case of > >needs. > > If a global init - more correctly, a singleton init - is needed, > can't it just implicitly be called from make_me_a_new_context()? I would advocate for placing the nft_global_init() and deinit() code into the ctx object too. Those _init() and _deinit() are indeed initializing context information, such as iproute/ct label maps. So they are context after all. -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html