diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-12-02 10:57:36 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-12-11 15:22:17 +0000 |
| commit | 38f1ffbd30e38b3215fa81114230ae2948dca8dc (patch) | |
| tree | 2411633f27011259a74e43a65b7d3544f5444f5b /pkg/declextract/serialization.go | |
| parent | 2f981ae0154bd9e967e046692984f0b6e2423a32 (diff) | |
pkg/declextract: refactor netlink generation
Emit all information related to a single netlink family close to each other.
Previously we emitted them scattered and grouped by info type.
That was both inconvinient to emit and inconvinient to read.
NFC.
Diffstat (limited to 'pkg/declextract/serialization.go')
| -rw-r--r-- | pkg/declextract/serialization.go | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/pkg/declextract/serialization.go b/pkg/declextract/serialization.go index c737a675c..1bc82a86b 100644 --- a/pkg/declextract/serialization.go +++ b/pkg/declextract/serialization.go @@ -14,8 +14,8 @@ func (ctx *context) serialize() { ctx.fmt(header) ctx.serializeIncludes() ctx.serializeEnums() - ctx.emitNetlinkTypes() ctx.serializeSyscalls() + ctx.serializeNetlink() ctx.serializeStructs() ctx.serializeDefines() } @@ -47,28 +47,12 @@ func (ctx *context) serializeDefines() { } func (ctx *context) serializeSyscalls() { - printedGetFamily, printedSendmsg := false, false for _, call := range ctx.Syscalls { ctx.fmt("%v(", call.Func) for i, arg := range call.Args { ctx.fmt("%v%v %v", comma(i), arg.Name, arg.syzType) } ctx.fmt(")\n") - - if call.Func == "syslog$auto" { - printedGetFamily = true - ctx.emitNetlinkGetFamily() - } - if call.Func == "sendmsg$auto" { - printedSendmsg = true - ctx.emitNetlinkSendmsgs() - } - } - if !printedGetFamily { - ctx.emitNetlinkGetFamily() - } - if !printedSendmsg { - ctx.emitNetlinkSendmsgs() } ctx.fmt("\n") } @@ -102,9 +86,6 @@ func (ctx *context) serializeStructs() { if str.Align != 0 { attrs = append(attrs, fmt.Sprintf("align[%v]", str.Align)) } - if str.isVarlen { - attrs = append(attrs, "varlen") - } if len(attrs) != 0 { ctx.fmt(" [%v]", strings.Join(attrs, ", ")) } |
