blob: dfb223d16f8dd584f30ddbf17d9bc765b7f952b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Copyright 2024 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package declextract
import (
"slices"
)
type Interface struct {
Type string
Name string
IdentifyingConst string
Files []string
Func string
Access string
Subsystems []string
ManualDescriptions bool
AutoDescriptions bool
}
const (
IfaceSyscall = "SYSCALL"
IfaceNetlinkOp = "NETLINK"
IfaceIouring = "IOURING"
AccessUnknown = "unknown"
AccessUser = "user"
AccessNsAdmin = "ns_admin"
AccessAdmin = "admin"
)
func (ctx *context) noteInterface(iface *Interface) {
ctx.interfaces = append(ctx.interfaces, iface)
}
func (ctx *context) finishInterfaces() {
for _, iface := range ctx.interfaces {
slices.Sort(iface.Files)
iface.Files = slices.Compact(iface.Files)
if iface.Access == "" {
iface.Access = AccessUnknown
}
}
ctx.interfaces = sortAndDedupSlice(ctx.interfaces)
}
|