HomeFreeBSD

bhyve: add cmdline option for user defined fw_cfg items

Description

bhyve: add cmdline option for user defined fw_cfg items

Some guest allow to configure themself by fw_cfg. E.g. Fedora CoreOs can
be provisioned by adding a JSON file as fw_cfg item.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38338

(cherry picked from commit ca14781c8170f3517ae79e198c0c880dbc3142dd)

bhyve: error out if fwcfg user file isn't read completely

At the moment, fwcfg reads the file once at startup and passes these
data to the guest. Therefore, we should always read the whole file.
Otherwise we should error out.

Additionally, GCC12 complains that the comparison whether
fwcfg_file->size is lower than 0 is always false due to the limited
range of data type.

Reviewed by: markj
Fixes: ca14781c8170f3517ae79e198c0c880dbc3142dd ("bhyve: add cmdline option for user defined fw_cfg items")
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40076

(cherry picked from commit 26d9f973d8691eccc098ded7326137d6f76ad243)