Skip to content

Commit

Permalink
xdrgen: XDR width for optional_data type
Browse files Browse the repository at this point in the history
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
Chuck Lever committed Nov 11, 2024
1 parent 2db8940 commit dc6fa83
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tools/net/sunrpc/xdrgen/xdr_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,19 @@ class _XdrOptionalData(_XdrDeclaration):
spec: _XdrTypeSpecifier
template: str = "optional_data"

def max_width(self) -> int:
"""Return width of type in XDR_UNITS"""
return 1

def symbolic_width(self) -> List:
"""Return list containing XDR width of type's components"""
return ["XDR_bool"]

def __post_init__(self):
structs.add(self.name)
pass_by_reference.add(self.name)
max_widths[self.name] = self.max_width()
symbolic_widths[self.name] = self.symbolic_width()


@dataclass
Expand Down

0 comments on commit dc6fa83

Please sign in to comment.