Commit 4442deb
feat: allow visiting entire domain metadata (#1384)
## What changes are proposed in this pull request?
Adding the ability to scan the entire domain metadata. This PR is in a
way a follow up to
#1342. I wanted to use
the `visit_string_map` function from that PR, but then we would run into
some ownership/lifetime issues: we would need to return a pointer to a
kernel-allocated map
I thought the nicest solution would be to just create a separate visitor
function which avoids any lifetime issues by scoping things to the
visitor callback.
I also considered:
```rust
pub unsafe extern "C" fn visit_domain_metadata(
snapshot: Handle<SharedSnapshot>,
engine: Handle<SharedExternEngine>,
engine_context: NullableCvoid,
visitor: extern "C" fn(
engine_context: NullableCvoid,
map: &CStringMap,
),
)
```
Which would allow reusing the `visit_string_map` function and make this
more in line with how engine is expected to consume other string maps,
but I don't think the extra level of indirection really adds much and
the visitor is very simple anyway.
### This PR affects the following public APIs
- Added new `Snapshot::get_all_domain_metadata` function
- Added new ffi `visit_domain_metadata` to go over all domain metadata
## How was this change tested?
- Testing code added to existing
`kernel::snapshot::tests::test_domain_metadata` test
- Testing code added to existing
`ffi::domain_metadata::tests::test_domain_metadata` test
---------
Co-authored-by: Nick Lanham <nicklan@users.noreply.github.com>1 parent 769157f commit 4442deb
File tree
4 files changed
+143
-4
lines changed- ffi/src
- kernel/src
- actions
4 files changed
+143
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 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 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
40 | 87 | | |
41 | 88 | | |
42 | 89 | | |
| |||
51 | 98 | | |
52 | 99 | | |
53 | 100 | | |
| 101 | + | |
| 102 | + | |
54 | 103 | | |
55 | 104 | | |
56 | 105 | | |
| |||
148 | 197 | | |
149 | 198 | | |
150 | 199 | | |
| 200 | + | |
| 201 | + | |
151 | 202 | | |
152 | 203 | | |
153 | 204 | | |
| |||
160 | 211 | | |
161 | 212 | | |
162 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
163 | 257 | | |
164 | 258 | | |
165 | 259 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | 7 | | |
11 | 8 | | |
12 | 9 | | |
13 | 10 | | |
14 | 11 | | |
15 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
38 | 48 | | |
39 | 49 | | |
40 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1062 | 1062 | | |
1063 | 1063 | | |
1064 | 1064 | | |
| 1065 | + | |
1065 | 1066 | | |
1066 | 1067 | | |
1067 | 1068 | | |
1068 | 1069 | | |
| 1070 | + | |
1069 | 1071 | | |
1070 | 1072 | | |
1071 | 1073 | | |
1072 | 1074 | | |
| 1075 | + | |
1073 | 1076 | | |
1074 | 1077 | | |
1075 | 1078 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
| |||
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
371 | 374 | | |
372 | 375 | | |
373 | 376 | | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
374 | 390 | | |
375 | 391 | | |
376 | 392 | | |
| |||
443 | 459 | | |
444 | 460 | | |
445 | 461 | | |
| 462 | + | |
446 | 463 | | |
447 | 464 | | |
448 | 465 | | |
| |||
1152 | 1169 | | |
1153 | 1170 | | |
1154 | 1171 | | |
| 1172 | + | |
| 1173 | + | |
1155 | 1174 | | |
1156 | 1175 | | |
1157 | 1176 | | |
| |||
1166 | 1185 | | |
1167 | 1186 | | |
1168 | 1187 | | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
1169 | 1201 | | |
1170 | 1202 | | |
1171 | 1203 | | |
| |||
0 commit comments