Re: Genetlink per cmd policies
From: Johannes Berg <johannes@sipsolutions.net>
Date: 2020-09-30 19:03:15
On Wed, 2020-09-30 at 12:01 -0700, Jakub Kicinski wrote:
On Wed, 30 Sep 2020 20:36:24 +0200 Johannes Berg wrote:quoted
On Wed, 2020-09-30 at 09:44 -0700, Jakub Kicinski wrote:quoted
I started with a get_policy() callback, but I didn't like it much. Static data is much more pleasant for a client of the API IMHO.Yeah, true.quoted
What do you think about "ops light"? Insufficiently flexible?TBH, I'm not really sure how you'd do it?There are very few users who actually access ops, I was thinking that callers to genl_get_cmd() should declare a full struct genl_ops on the stack (or in some context, not sure yet), and then genl_get_cmd() will fill it in. If family has full ops it will do a memcpy(); if the ops are "light" it can assign the right pointers. Plus it can propagate the policy and maxattr from family if needed in both cases.
Oh, so you were thinking you'd have to sort of decide on the *family* level whether you want "light" or "heavy" ops? Hm. I guess you could even have both? struct genl_ops *ops; struct genl_ops_ext *extops; and then search both arrays, no need for memcpy/pointer assignment? johannes