Both devices and kernel structs can use the same 'lookup_dev' function instead of having duplicated code.
Sponsored by: vStack
Related to multiple devices support.
Differential D40105
bhyve: [snapshot] Simplify restore kernel structs gusev.vitaliy_gmail.com on May 15 2023, 1:50 PM. Authored by Tags Referenced Files
Details
Both devices and kernel structs can use the same 'lookup_dev' function instead of having duplicated code. Sponsored by: vStack Related to multiple devices support.
Diff Detail
Event Timeline
Comment Actions Can you provide more description of what this change is doing? From what I can tell it uses err directly to abort quicker if it fails to restore an in-kernel structure, it inlines vm_restore_kern_struct into the loop in vm_restore_kern_structs. It renames vm_snapshot_kern_structs which is somewhat gratuitous IMO as it now no longer matches the other function names like vm_snapshot_user_devs. But I think the big change is not using lookup_struct and instead using meta->dev_name instead of meta->dev_req as the main key for the JSON for a given kernel struct? I think this means you can avoid lookup_struct because now instead of a flat array of all kernel structures they are separate objects with unique names? Can you expand on that more perhaps maybe with some examples of before/after JSON snippets? I would also suggest perhaps only doing the JSON change in this commit and not mixing in the other changes that I think obscure the real change you are making (e.g. the function rename, or inlining the function). Comment Actions @jhb In short: Both devices and kernel struct can use the same 'lookup_dev' function instead of having duplicated code. It removes vm_restore_kern_struct, lookup_struct as duplicated code. |