FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
kernelscript/src/btf_parser.mli at main · multikernel/kernelscript · GitHub
multikernel
/
kernelscript
Public
Notifications
You must be signed in to change notification settings
Fork
24
Star
508
Code
Issues
2
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
kernelscript
/
src
/
btf_parser.mli
Copy path
More file actions
More file actions
Latest commit
History
History
History
73 lines (57 loc) · 3.01 KB
Breadcrumbs
kernelscript
/
src
/
btf_parser.mli
Copy path
File metadata and controls
73 lines (57 loc) · 3.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
(*
* Copyright 2025 Multikernel Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*)
(*
* BTF Parser - Extract type information from BTF files for KernelScript
*)
type
btf_type_info
= {
name
:
string
;
kind
:
string
;
size
:
int
option
;
members
: (
string
*
string
)
list
option
;
(*
field_name * field_type
*)
kernel_defined
:
bool
;
(*
Mark if this type is kernel-defined
*)
}
type
program_template
= {
program_type
:
string
;
context_type
:
string
;
return_type
:
string
;
includes
:
string
list
;
types
:
btf_type_info
list
;
function_signatures
: (
string
*
string
)
list
;
(*
Function name and signature for kprobe targets
*)
}
(*
* Get program template based on eBPF program type with optional BTF extraction
*)
val
get_program_template
:
string
->
string
option
->
program_template
(*
* Get kprobe program template for a specific target function
*)
val
get_kprobe_program_template
:
string
->
string
option
->
program_template
(*
* Get tracepoint program template for a specific target function
*)
val
get_tracepoint_program_template
:
string
->
string
option
->
program_template
(*
* Check if a type name is a well-known eBPF kernel type using BTF
*)
val
is_well_known_kernel_type
:
?
btf_path
:
string
->
string
->
bool
(*
* Check if a type name is a well-known eBPF kernel type using BTF (main function)
*)
val
is_well_known_ebpf_type
:
?
btf_path
:
string
->
string
->
bool
(*
* Clear the kernel types cache (useful for testing or when BTF file changes)
*)
val
clear_kernel_types_cache
:
unit
->
unit
(*
* Get all known kernel types for the given BTF file (for debugging/inspection)
*)
val
get_all_kernel_types
:
?
btf_path
:
string
->
unit
->
string
list
(*
* Extract struct_ops definitions from BTF and generate KernelScript code
*)
val
extract_struct_ops_definitions
:
string
option
->
string
list
->
string
list
(*
* Generate struct_ops template with BTF extraction
*)
val
generate_struct_ops_template
:
?
include_kfuncs
:
string
->
string
option
->
string
list
->
string
->
string
(*
* Generate program-type specific header content using BTF
*)
val
generate_program_header
:
extract_kfuncs
:
bool
->
string
->
string
->
string
(*
* Generate struct_ops-specific header content using BTF
*)
val
generate_struct_ops_header
:
string
->
string
->
string
(*
* Generate tracepoint-specific header content using BTF
*)
val
generate_tracepoint_header
:
string
->
string
->
string
(*
* Generate KernelScript source code from template
*)
val
generate_kernelscript_source
:
?
extra_param
:
string
->
?
include_kfuncs
:
string
->
program_template
->
string
->
string
Back
|
FazBrowse Home
|
New Git URL