Lorenz Brun | c7b036b | 2023-06-01 12:23:57 +0200 | [diff] [blame] | 1 | syntax = "proto3"; |
| 2 | |
| 3 | package metropolis.pkg.kmod; |
| 4 | |
| 5 | option go_package = "source.monogon.dev/metropolis/pkg/kmod/spec"; |
| 6 | |
| 7 | // Module contains important metadata about a Linux kernel module. |
| 8 | message Module { |
| 9 | // Name of the module |
| 10 | string name = 1; |
| 11 | // Path of the module, relative to the module root. |
| 12 | // Unset if built-in. |
| 13 | string path = 2; |
| 14 | // List of Meta.modules indices on which this module depends. |
| 15 | repeated uint32 depends = 3; |
| 16 | } |
| 17 | |
| 18 | message RadixNode { |
| 19 | enum Type { |
| 20 | // Matches one or more characters literally. |
| 21 | LITERAL = 0; |
| 22 | // Matches zero or more arbitrary characters. |
| 23 | WILDCARD = 1; |
| 24 | // Matches exactly one arbitrary character. |
| 25 | SINGLE_WILDCARD = 2; |
| 26 | // Matches exactly one character between start_byte and end_byte. |
| 27 | BYTE_RANGE = 3; |
| 28 | // Root matches nothing, but serves a the root node for a radix |
| 29 | // tree. |
| 30 | ROOT = 4; |
| 31 | } |
| 32 | Type type = 1; |
| 33 | |
| 34 | // Only valid for LITERAL type |
| 35 | string literal = 2; |
| 36 | |
| 37 | // Only valid when BYTE_RANGE type |
| 38 | uint32 start_byte = 3; |
| 39 | uint32 end_byte = 4; |
| 40 | |
| 41 | // Contains a list of radix nodes which are children of this node. |
| 42 | repeated RadixNode children = 5; |
| 43 | |
| 44 | // A list of module indices (in the Meta.modules list) which have |
| 45 | // match expressions ending at this node. |
| 46 | repeated uint32 module_index = 6; |
| 47 | } |
| 48 | |
| 49 | // Meta contains metadata about all modules in a Linux kernel |
| 50 | message Meta { |
| 51 | // Contains a list of modules, including built-in ones. |
| 52 | repeated Module modules = 1; |
| 53 | |
| 54 | // Contains the root node of a radix tree for looking up modules to load |
| 55 | // for a given device modalias. |
| 56 | RadixNode module_device_matches = 2; |
| 57 | } |