mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
tools: ynl: fix setting presence bits in simple nests
[ Upstream commitf6c8f5e869
] When we set members of simple nested structures in requests we need to set "presence" bits for all the nesting layers below. This has nothing to do with the presence type of the last layer. Fixes:be5bea1cc0
("net: add basic C code generators for Netlink") Reviewed-by: Breno Leitao <leitao@debian.org> Link: https://lore.kernel.org/r/20240321020214.1250202-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
331e125e02
commit
832d876b03
@ -243,8 +243,11 @@ class Type(SpecAttr):
|
||||
presence = ''
|
||||
for i in range(0, len(ref)):
|
||||
presence = f"{var}->{'.'.join(ref[:i] + [''])}_present.{ref[i]}"
|
||||
if self.presence_type() == 'bit':
|
||||
code.append(presence + ' = 1;')
|
||||
# Every layer below last is a nest, so we know it uses bit presence
|
||||
# last layer is "self" and may be a complex type
|
||||
if i == len(ref) - 1 and self.presence_type() != 'bit':
|
||||
continue
|
||||
code.append(presence + ' = 1;')
|
||||
code += self._setter_lines(ri, member, presence)
|
||||
|
||||
func_name = f"{op_prefix(ri, direction, deref=deref)}_set_{'_'.join(ref)}"
|
||||
|
Loading…
Reference in New Issue
Block a user