Commit 99b8be6
committed
Add
Since FdtWriter only accept &str, it does a validation to make sure
it's NULL-terminated and copies the whole string in Cstring::new().
This is unnecessary in some circumstances. For example, for "bootargs"
property, linux_loader can create CString [1]. However, library users
need to convert it into String [2].
This patches adds another property helper `property_cstring`, which
accepts a &CStr value directly.
[1] https://docs.rs/linux-loader/latest/linux_loader/cmdline/struct.Cmdline.html#method.as_cstring
[2] https://github.com/firecracker-microvm/firecracker/blob/3853362520b81efc8ce6559148d023379a5a4da4/src/vmm/src/arch/aarch64/fdt.rs#L240-L246
Signed-off-by: Seiya Nuta <nuta@seiya.me>FdtWriter::property_cstring
1 parent ef5bd73 commit 99b8be6
2 files changed
+16
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
1 | 10 | | |
2 | 11 | | |
3 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
448 | 449 | | |
449 | 450 | | |
450 | 451 | | |
451 | | - | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
452 | 458 | | |
453 | 459 | | |
454 | 460 | | |
| |||
0 commit comments