Skip to content

Commit 3fa859a

Browse files
committed
Update README and main.ml to simplify project initialization commands and clarify program types.
1 parent 9a9b587 commit 3fa859a

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -242,19 +242,19 @@ Create a new KernelScript project with template code:
242242

243243
```bash
244244
# Create XDP project
245-
kernelscript init --btf-vmlinux-path /sys/kernel/btf/vmlinux xdp my_packet_filter
245+
kernelscript init xdp my_packet_filter
246246

247247
# Create TC project
248-
kernelscript init --btf-vmlinux-path /sys/kernel/btf/vmlinux tc my_traffic_shaper
248+
kernelscript init tc my_traffic_shaper
249249

250250
# Create kprobe project
251-
kernelscript init --btf-vmlinux-path /sys/kernel/btf/vmlinux kprobe my_tracer
251+
kernelscript init kprobe/sys_read my_tracer
252252

253253
# Create project with custom BTF path
254254
kernelscript init --btf-vmlinux-path /custom/path/vmlinux xdp my_project
255255

256256
# Create struct_ops project
257-
kernelscript init --btf-vmlinux-path /sys/kernel/btf/vmlinux tcp_congestion_ops my_congestion_control
257+
kernelscript init tcp_congestion_ops my_congestion_control
258258
```
259259

260260
After initialization, you get:
@@ -269,16 +269,10 @@ my_project/
269269
- `xdp` - XDP programs for packet processing
270270
- `tc` - Traffic control programs
271271
- `kprobe` - Kernel function tracing
272-
- `uprobe` - User function tracing
273272
- `tracepoint` - Kernel tracepoint programs
274-
- `lsm` - Linux Security Module programs
275-
- `cgroup_skb` - Cgroup socket buffer programs
276273

277274
**Available struct_ops:**
278275
- `tcp_congestion_ops` - TCP congestion control
279-
- `bpf_iter_ops` - BPF iterator operations
280-
- `bpf_struct_ops_test` - Test struct operations
281-
- Custom struct_ops names
282276

283277

284278
### Compile KernelScript Programs
@@ -348,7 +342,7 @@ sudo ./my_project # Run the program
348342

349343
3. **Create your first project:**
350344
```bash
351-
kernelscript -- init xdp hello_world
345+
kernelscript init xdp hello_world
352346
cd hello_world/
353347
```
354348

src/main.ml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ let rec parse_args () =
3434
printf "Subcommands:\n";
3535
printf " init <prog_type_or_struct_ops> <project_name> [--btf-vmlinux-path <path>]\n";
3636
printf " Initialize a new KernelScript project\n";
37-
printf " prog_type: xdp | tc | kprobe/target_function | uprobe | tracepoint | lsm | cgroup_skb\n";
37+
printf " prog_type: xdp | tc | kprobe/target_function | tracepoint/category/event\n";
3838
printf " Examples: kprobe/sys_read, kprobe/vfs_write, kprobe/tcp_sendmsg\n";
39-
printf " struct_ops: tcp_congestion_ops | bpf_iter_ops | bpf_struct_ops_test | custom_name\n";
39+
printf " tracepoint: tracepoint/syscalls/sys_enter_read, tracepoint/sched/sched_switch\n";
40+
printf " struct_ops: tcp_congestion_ops\n";
4041
printf " project_name: Name of the project directory to create\n";
4142
printf " --btf-vmlinux-path: Path to BTF vmlinux file (default: /sys/kernel/btf/vmlinux)\n\n";
4243
printf " compile <input_file> [options]\n";
@@ -300,10 +301,7 @@ cd %s && make run
300301
| "xdp" -> "XDP programs provide high-performance packet processing at the driver level."
301302
| "tc" -> "TC programs enable traffic control and packet filtering in the Linux networking stack."
302303
| "kprobe" -> "Kprobe programs allow dynamic tracing of kernel functions."
303-
| "uprobe" -> "Uprobe programs enable tracing of userspace functions."
304304
| "tracepoint" -> "Tracepoint programs provide static tracing points in the kernel."
305-
| "lsm" -> "LSM programs implement security policies and access control."
306-
| "cgroup_skb" -> "Cgroup SKB programs filter network packets based on cgroup membership."
307305
| _ -> "eBPF program for kernel-level processing."
308306
)
309307
) in

0 commit comments

Comments
 (0)