Page MenuHomeFreeBSD

libvmm: use a const char pointer for vm name in struct vmctx
ClosedPublic

Authored by rew on Feb 15 2022, 11:08 PM.
Tags
None
Referenced Files
Unknown Object (File)
Apr 1 2024, 3:01 AM
Unknown Object (File)
Mar 22 2024, 5:26 PM
Unknown Object (File)
Mar 22 2024, 5:26 PM
Unknown Object (File)
Mar 22 2024, 5:25 PM
Unknown Object (File)
Mar 22 2024, 5:25 PM
Unknown Object (File)
Mar 22 2024, 5:25 PM
Unknown Object (File)
Mar 8 2024, 9:07 AM
Unknown Object (File)
Mar 7 2024, 4:56 PM

Details

Summary

Allow callers of vm_get_name() to retrieve the vm name without having to
allocate a buffer.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

rew requested review of this revision.Feb 15 2022, 11:08 PM
jhb added inline comments.
lib/libvmmapi/vmmapi.c
499–500

Note that you could just change this function and still leave 'ctx->name' as char * so you don't have to change around the code around the strcpy in vm_open.

usr.sbin/bhyve/snapshot.c
1129

I would maybe just axe the vmname_buf variable entirely (it's a bit odd now as it's a pointer rather than a buffer) and just inline the function call here.

1520–1521

Similarly.

usr.sbin/bhyvectl/bhyvectl.c
1691 ↗(On Diff #102813)

It seems a bit odd that this even takes the ctx as an arg btw rather than just passing through the string from the --vm argument directly?

updated per feedback from jhb

I split out the bhyvectl changes into a separate review:

https://reviews.freebsd.org/D34399

This revision is now accepted and ready to land.Mar 3 2022, 5:39 PM
This revision was automatically updated to reflect the committed changes.