Re: [patch net-next v8 5/9] genetlink: introduce per-sock family private storage

From
Jiri Pirko <jiri@resnulli.us>
Date
2023-12-18 14:01:59
Reply to
Andy Shevchenko, 2023-12-18
Mon, Dec 18, 2023 at 12:01:09PM CET, andriy.shevchenko@linux.intel.com wrote:
On Sat, Dec 16, 2023 at 01:29:57PM +0100, Jiri Pirko wrote:
quoted
From: Jiri Pirko <redacted>

Introduce an xarray for Generic netlink family to store per-socket
private. Initialize this xarray only if family uses per-socket privs.

Introduce genl_sk_priv_get() to get the socket priv pointer for a family
and initialize it in case it does not exist.
Introduce __genl_sk_priv_get() to obtain socket priv pointer for a
family under RCU read lock.

Allow family to specify the priv size, init() and destroy() callbacks.
...
quoted
+	void			(*sock_priv_init)(void *priv);
Can in some cases init fail? Shouldn't we allow to propagate the error code
and fail the flow?
Currently not needed. Easy to add when (if ever) this is going to be
needed.
quoted
+	void			(*sock_priv_destroy)(void *priv);
...

P.S> I'm fine with either, just consider above as a material to think about.
I always do consider these :)

-- 
With Best Regards,
Andy Shevchenko
Thread (13 messages) 13 messages, 3 authors, last reply 2023-12-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help