diff options
| author | Jakub Kicinski <[email protected]> | 2025-07-23 17:10:45 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-07-25 00:28:49 +0000 |
| commit | 8553fb7c555c15f32ebbc5d032f35589e970e206 (patch) | |
| tree | 837e487da5f11f176118225cf601d689941e5917 /net/core/net_test.c | |
| parent | tools: ynl-gen: print alloc helper for multi-val attrs (diff) | |
| download | kernel-8553fb7c555c15f32ebbc5d032f35589e970e206.tar.gz kernel-8553fb7c555c15f32ebbc5d032f35589e970e206.zip | |
tools: ynl-gen: print setters for multi-val attrs
For basic types we "flatten" setters. If a request "a" has a simple
nest "b" with value "val" we print helpers like:
req_set_a_b(struct a *req, int val)
{
req->_present.a = 1;
req->b._present.val = 1;
req->b.val = ...
}
This is not possible for multi-attr because they have to be allocated
dynamically by the user. Print "object level" setters so that user
preparing the object doesn't have to futz with the presence bits
and other YNL internals.
Add the ability to pass in the variable name to generated setters.
Using "req" here doesn't feel right, while the attr is part of a request
it's not the request itself, so it seems cleaner to call it "obj".
Example:
static inline void
netdev_queue_id_set_id(struct netdev_queue_id *obj, __u32 id)
{
obj->_present.id = 1;
obj->id = id;
}
Reviewed-by: Donald Hunter <[email protected]>
Acked-by: Stanislav Fomichev <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/core/net_test.c')
0 files changed, 0 insertions, 0 deletions
