From nobody Thu Oct 13 00:51:23 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MnrYm247Dz4fW42; Thu, 13 Oct 2022 00:51:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MnrYl6fDQz3FVt; Thu, 13 Oct 2022 00:51:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665622283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wB2+TzUwmSpqsWMSMD27mYMj6HtzMc0ia2ksdpywxbw=; b=JSLOcPNFKumKCUpOjBOswnEPfe6tmUxv2lGKXKYl+DV5aJTMwPZEUJOyD9F/789EG8TKqH ITszWDrd32lyH/9HsRHEXjDpDp36vYrX9zRi043QOESbFZXXxrHFu25hY2kvzgfTtfDpFJ eOvjxRkBKAU9ibiQP7itbuASN84Tt8iZ2iZd9kfvzvEau/nT98ZLP1d5OXt1AVk+recJ34 2K+dlP0RqsKdKgsnGjQvIXkhM0JCh7LycBzVy5VbTzeanIVXH2bKx+nqN4zshMWSrYZgj1 r+46ZCqpWWYwtAkB+C08zErTrfqSyJCMyWcqLicEwVQEn/NUhOxLcCtFtajIeQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4MnrYl5llzzFvY; Thu, 13 Oct 2022 00:51:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29D0pN32015138; Thu, 13 Oct 2022 00:51:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29D0pNQh015137; Thu, 13 Oct 2022 00:51:23 GMT (envelope-from git) Date: Thu, 13 Oct 2022 00:51:23 GMT Message-Id: <202210130051.29D0pNQh015137@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b3fb2082be89 - stable/13 - bhyve: Make smbios tables local to smbiostbl.c List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b3fb2082be89f282320fcf7b2fee719dc4416069 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665622283; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wB2+TzUwmSpqsWMSMD27mYMj6HtzMc0ia2ksdpywxbw=; b=soyMXYfDrdgJXX0XcVziqgxNsjs4QHTf5mVFOnHOGN6X84gb1+KDkQ1xVRMWtSmI7yxyxu 0W7divORDV7hzf09PjpITS26oWrQNgEiotH0VDh9pKlMFL1msUtJ+vqn8U4IyGLqKlIyr5 TbTZ7YMnniIX4jz3/E69t8aHDUy3nYZ/quo4ByjrEFuWLKMJnSkPGAlAlFGQhTSSZP6bKf jP2eyp9XcYleZXg2ntBYRDqVXe1ypiLexI62dYvJgygzBt7yPXPtGY92kKdCKrL7kBik1z TL8a7IiheDVqTxdU6FMWK1bWCX3sT5XjmKIuYJOBOgJ4Fn0Uypv+WhJsvvqyTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665622283; a=rsa-sha256; cv=none; b=mA4z1P+lItFfPsdo9hoh+PUq/0dcXt98Z9BS2XxdgHx8Ew8o38leYSxyCsil9aq6bOz9Sc bSW5AJ0heJHAk0BJRwrEZUNCv+im96tDhMIWCK7A4dyYcZVhCxJ7OvTlZi4AnSnFvSx4e7 t3PVxnfl1mKxsYvEZkKftDI/qCEF341TuMJM0NkiILe9azzSFhjE4xgWXpkoqJS+v8YA2R X2cuf/I2i3QrjQBR5sTzqhQxp9O4ju2ngjLqjEQUWcaVoNKwc0C1QubAPuKZY8NtybGIqn dSM9e74ROSZMUL+u4jlxI7JTTIM1u3e8cAocPOTadRFnEa6XevmCHeIbPmoE9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b3fb2082be89f282320fcf7b2fee719dc4416069 commit b3fb2082be89f282320fcf7b2fee719dc4416069 Author: Mark Johnston AuthorDate: 2022-09-09 03:26:47 +0000 Commit: Mark Johnston CommitDate: 2022-10-13 00:45:49 +0000 bhyve: Make smbios tables local to smbiostbl.c Also flag them as const. (cherry picked from commit 889cec66d39d60d0a00cd249614924291759fb82) --- usr.sbin/bhyve/smbiostbl.c | 119 +++++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 57 deletions(-) diff --git a/usr.sbin/bhyve/smbiostbl.c b/usr.sbin/bhyve/smbiostbl.c index 9bb7b569eda4..c1b7652d90bf 100644 --- a/usr.sbin/bhyve/smbiostbl.c +++ b/usr.sbin/bhyve/smbiostbl.c @@ -81,14 +81,14 @@ struct smbios_string { const char *value; }; -typedef int (*initializer_func_t)(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +typedef int (*initializer_func_t)(const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size); struct smbios_template_entry { - struct smbios_structure *entry; - struct smbios_string *strings; - initializer_func_t initializer; + const struct smbios_structure *entry; + const struct smbios_string *strings; + initializer_func_t initializer; }; /* @@ -339,7 +339,7 @@ struct smbios_table_type127 { struct smbios_structure header; } __packed; -struct smbios_table_type0 smbios_type0_template = { +static const struct smbios_table_type0 smbios_type0_template = { { SMBIOS_TYPE_BIOS, sizeof (struct smbios_table_type0), 0 }, 1, /* bios vendor string */ 2, /* bios version string */ @@ -355,14 +355,14 @@ struct smbios_table_type0 smbios_type0_template = { 0xff /* embedded controller firmware minor release */ }; -struct smbios_string smbios_type0_strings[] = { +static const struct smbios_string smbios_type0_strings[] = { { "bios.vendor", "BHYVE" }, /* vendor string */ { "bios.version", FIRMWARE_VERSION }, /* bios version string */ { "bios.release_date", FIRMWARE_RELEASE_DATE }, /* bios release date string */ { 0 } }; -struct smbios_table_type1 smbios_type1_template = { +static const struct smbios_table_type1 smbios_type1_template = { { SMBIOS_TYPE_SYSTEM, sizeof (struct smbios_table_type1), 0 }, 1, /* manufacturer string */ 2, /* product string */ @@ -374,11 +374,11 @@ struct smbios_table_type1 smbios_type1_template = { 6 /* family string */ }; -static int smbios_type1_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +static int smbios_type1_initializer(const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size); -struct smbios_string smbios_type1_strings[] = { +static const struct smbios_string smbios_type1_strings[] = { { "system.manufacturer", "FreeBSD" }, /* manufacturer string */ { "system.product_name", "BHYVE" }, /* product string */ { "system.version", "1.0" }, /* version string */ @@ -388,7 +388,7 @@ struct smbios_string smbios_type1_strings[] = { { 0 } }; -struct smbios_table_type2 smbios_type2_template = { +static const struct smbios_table_type2 smbios_type2_template = { { SMBIOS_TYPE_BOARD, sizeof (struct smbios_table_type2), 0 }, 1, /* manufacturer string */ 2, /* product string */ @@ -402,7 +402,7 @@ struct smbios_table_type2 smbios_type2_template = { 0 }; -struct smbios_string smbios_type2_strings[] = { +static const struct smbios_string smbios_type2_strings[] = { { "board.manufacturer", "FreeBSD" }, /* manufacturer string */ { "board.product_name", "BHYVE" }, /* product name string */ { "board.version", "1.0" }, /* version string */ @@ -412,7 +412,7 @@ struct smbios_string smbios_type2_strings[] = { { 0 } }; -struct smbios_table_type3 smbios_type3_template = { +static const struct smbios_table_type3 smbios_type3_template = { { SMBIOS_TYPE_CHASSIS, sizeof (struct smbios_table_type3), 0 }, 1, /* manufacturer string */ SMBIOS_CHT_UNKNOWN, @@ -431,7 +431,7 @@ struct smbios_table_type3 smbios_type3_template = { 5 /* sku number string */ }; -struct smbios_string smbios_type3_strings[] = { +static const struct smbios_string smbios_type3_strings[] = { { "chassis.manufacturer", "FreeBSD" }, /* manufacturer string */ { "chassis.version", "1.0" }, /* version string */ { "chassis.serial_number", "None" }, /* serial number string */ @@ -440,7 +440,7 @@ struct smbios_string smbios_type3_strings[] = { { 0 } }; -struct smbios_table_type4 smbios_type4_template = { +static const struct smbios_table_type4 smbios_type4_template = { { SMBIOS_TYPE_PROCESSOR, sizeof (struct smbios_table_type4), 0 }, 1, /* socket designation string */ SMBIOS_PRT_CENTRAL, @@ -467,7 +467,7 @@ struct smbios_table_type4 smbios_type4_template = { SMBIOS_PRF_OTHER }; -struct smbios_string smbios_type4_strings[] = { +static const struct smbios_string smbios_type4_strings[] = { { NULL, " " }, /* socket designation string */ { NULL, " " }, /* manufacturer string */ { NULL, " " }, /* version string */ @@ -477,11 +477,12 @@ struct smbios_string smbios_type4_strings[] = { { 0 } }; -static int smbios_type4_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +static int smbios_type4_initializer( + const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size); -struct smbios_table_type16 smbios_type16_template = { +static const struct smbios_table_type16 smbios_type16_template = { { SMBIOS_TYPE_MEMARRAY, sizeof (struct smbios_table_type16), 0 }, SMBIOS_MAL_SYSMB, SMBIOS_MAU_SYSTEM, @@ -492,11 +493,12 @@ struct smbios_table_type16 smbios_type16_template = { 0 /* extended maximum memory capacity in bytes (TBD) */ }; -static int smbios_type16_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +static int smbios_type16_initializer( + const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size); -struct smbios_table_type17 smbios_type17_template = { +static const struct smbios_table_type17 smbios_type17_template = { { SMBIOS_TYPE_MEMDEVICE, sizeof (struct smbios_table_type17), 0 }, -1, /* handle of physical memory array */ -1, /* handle of memory error data */ @@ -522,7 +524,7 @@ struct smbios_table_type17 smbios_type17_template = { 0 /* configured voltage in mv (0=unknown) */ }; -struct smbios_string smbios_type17_strings[] = { +static const struct smbios_string smbios_type17_strings[] = { { NULL, " " }, /* device locator string */ { NULL, " " }, /* physical bank locator string */ { NULL, " " }, /* manufacturer string */ @@ -532,11 +534,12 @@ struct smbios_string smbios_type17_strings[] = { { 0 } }; -static int smbios_type17_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +static int smbios_type17_initializer( + const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size); -struct smbios_table_type19 smbios_type19_template = { +static const struct smbios_table_type19 smbios_type19_template = { { SMBIOS_TYPE_MEMARRAYMAP, sizeof (struct smbios_table_type19), 0 }, 0xffffffff, /* starting phys addr in kb (0xffffffff=use ext) */ 0xffffffff, /* ending phys addr in kb (0xffffffff=use ext) */ @@ -546,53 +549,55 @@ struct smbios_table_type19 smbios_type19_template = { 0 /* extended ending phys addr in bytes (TDB) */ }; -static int smbios_type19_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +static int smbios_type19_initializer( + const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size); -struct smbios_table_type32 smbios_type32_template = { +static struct smbios_table_type32 smbios_type32_template = { { SMBIOS_TYPE_BOOT, sizeof (struct smbios_table_type32), 0 }, { 0, 0, 0, 0, 0, 0 }, SMBIOS_BOOT_NORMAL }; -struct smbios_table_type127 smbios_type127_template = { +static const struct smbios_table_type127 smbios_type127_template = { { SMBIOS_TYPE_EOT, sizeof (struct smbios_table_type127), 0 } }; -static int smbios_generic_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +static int smbios_generic_initializer( + const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size); static struct smbios_template_entry smbios_template[] = { - { (struct smbios_structure *)&smbios_type0_template, + { (const struct smbios_structure *)&smbios_type0_template, smbios_type0_strings, smbios_generic_initializer }, - { (struct smbios_structure *)&smbios_type1_template, + { (const struct smbios_structure *)&smbios_type1_template, smbios_type1_strings, smbios_type1_initializer }, - { (struct smbios_structure *)&smbios_type2_template, + { (const struct smbios_structure *)&smbios_type2_template, smbios_type2_strings, smbios_generic_initializer }, - { (struct smbios_structure *)&smbios_type3_template, + { (const struct smbios_structure *)&smbios_type3_template, smbios_type3_strings, smbios_generic_initializer }, - { (struct smbios_structure *)&smbios_type4_template, + { (const struct smbios_structure *)&smbios_type4_template, smbios_type4_strings, smbios_type4_initializer }, - { (struct smbios_structure *)&smbios_type16_template, + { (const struct smbios_structure *)&smbios_type16_template, NULL, smbios_type16_initializer }, - { (struct smbios_structure *)&smbios_type17_template, + { (const struct smbios_structure *)&smbios_type17_template, smbios_type17_strings, smbios_type17_initializer }, - { (struct smbios_structure *)&smbios_type19_template, + { (const struct smbios_structure *)&smbios_type19_template, NULL, smbios_type19_initializer }, - { (struct smbios_structure *)&smbios_type32_template, + { (const struct smbios_structure *)&smbios_type32_template, NULL, smbios_generic_initializer }, - { (struct smbios_structure *)&smbios_type127_template, + { (const struct smbios_structure *)&smbios_type127_template, NULL, smbios_generic_initializer }, { NULL,NULL, NULL } @@ -602,8 +607,8 @@ static uint64_t guest_lomem, guest_himem; static uint16_t type16_handle; static int -smbios_generic_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +smbios_generic_initializer(const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size) { struct smbios_structure *entry; @@ -649,8 +654,8 @@ smbios_generic_initializer(struct smbios_structure *template_entry, } static int -smbios_type1_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +smbios_type1_initializer(const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size) { struct smbios_table_type1 *type1; @@ -705,8 +710,8 @@ smbios_type1_initializer(struct smbios_structure *template_entry, } static int -smbios_type4_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +smbios_type4_initializer(const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size) { int i; @@ -747,8 +752,8 @@ smbios_type4_initializer(struct smbios_structure *template_entry, } static int -smbios_type16_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +smbios_type16_initializer(const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size) { struct smbios_table_type16 *type16; @@ -764,8 +769,8 @@ smbios_type16_initializer(struct smbios_structure *template_entry, } static int -smbios_type17_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +smbios_type17_initializer(const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size) { struct smbios_table_type17 *type17; @@ -808,8 +813,8 @@ smbios_type17_initializer(struct smbios_structure *template_entry, } static int -smbios_type19_initializer(struct smbios_structure *template_entry, - struct smbios_string *template_strings, char *curaddr, char **endaddr, +smbios_type19_initializer(const struct smbios_structure *template_entry, + const struct smbios_string *template_strings, char *curaddr, char **endaddr, uint16_t *n, uint16_t *size) { struct smbios_table_type19 *type19; @@ -905,8 +910,8 @@ smbios_build(struct vmctx *ctx) n = 0; maxssize = 0; for (i = 0; smbios_template[i].entry != NULL; i++) { - struct smbios_structure *entry; - struct smbios_string *strings; + const struct smbios_structure *entry; + const struct smbios_string *strings; initializer_func_t initializer; char *endaddr; uint16_t size;