git: 1579c6e2dc9b - stable/13 - bhyve: Sprinkle const qualifiers where appropriate

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 23 Aug 2022 20:46:56 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=1579c6e2dc9bc9d6eefa519ec105f20b729a0f14

commit 1579c6e2dc9bc9d6eefa519ec105f20b729a0f14
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-08-16 17:13:12 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-08-23 20:06:19 +0000

    bhyve: Sprinkle const qualifiers where appropriate
    
    No functional change intended.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit d06bf11c06a0c2a6f52ba23f9b5204912cfd6fc5)
---
 usr.sbin/bhyve/acpi.c     | 2 +-
 usr.sbin/bhyve/pci_emul.h | 2 +-
 usr.sbin/bhyve/pci_hda.c  | 4 ++--
 usr.sbin/bhyve/pci_hda.h  | 2 +-
 usr.sbin/bhyve/rfb.c      | 6 +++---
 usr.sbin/bhyve/rfb.h      | 3 ++-
 6 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/usr.sbin/bhyve/acpi.c b/usr.sbin/bhyve/acpi.c
index 360191ac6c4d..c9583e3fa218 100644
--- a/usr.sbin/bhyve/acpi.c
+++ b/usr.sbin/bhyve/acpi.c
@@ -858,7 +858,7 @@ basl_compile(struct vmctx *ctx, int (*fwrite_section)(FILE *), uint64_t offset)
 {
 	struct basl_fio io[2];
 	static char iaslbuf[3*MAXPATHLEN + 10];
-	char *fmt;
+	const char *fmt;
 	int err;
 
 	err = basl_start(&io[0], &io[1]);
diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h
index fff70530c66c..28f4fc422bee 100644
--- a/usr.sbin/bhyve/pci_emul.h
+++ b/usr.sbin/bhyve/pci_emul.h
@@ -51,7 +51,7 @@ struct memory_region;
 struct vm_snapshot_meta;
 
 struct pci_devemu {
-	char      *pe_emu;		/* Name of device emulation */
+	const char      *pe_emu;	/* Name of device emulation */
 
 	/* instance creation */
 	int       (*pe_init)(struct vmctx *, struct pci_devinst *,
diff --git a/usr.sbin/bhyve/pci_hda.c b/usr.sbin/bhyve/pci_hda.c
index e7c54f01159f..1a2a3844ab20 100644
--- a/usr.sbin/bhyve/pci_hda.c
+++ b/usr.sbin/bhyve/pci_hda.c
@@ -94,7 +94,7 @@ struct hda_bdle_desc {
 };
 
 struct hda_codec_cmd_ctl {
-	char *name;
+	const char *name;
 	void *dma_vaddr;
 	uint8_t run;
 	uint16_t rp;
@@ -729,7 +729,7 @@ static inline void
 hda_print_cmd_ctl_data(struct hda_codec_cmd_ctl *p)
 {
 #if DEBUG_HDA == 1
-	char *name = p->name;
+	const char *name = p->name;
 #endif
 	DPRINTF("%s size: %d", name, p->size);
 	DPRINTF("%s dma_vaddr: %p", name, p->dma_vaddr);
diff --git a/usr.sbin/bhyve/pci_hda.h b/usr.sbin/bhyve/pci_hda.h
index 65a85f6d603d..da473800bd80 100644
--- a/usr.sbin/bhyve/pci_hda.h
+++ b/usr.sbin/bhyve/pci_hda.h
@@ -70,7 +70,7 @@ struct hda_codec_inst {
 };
 
 struct hda_codec_class {
-	char *name;
+	const char *name;
 	int (*init)(struct hda_codec_inst *hci, const char *play,
 		const char *rec);
 	int (*reset)(struct hda_codec_inst *hci);
diff --git a/usr.sbin/bhyve/rfb.c b/usr.sbin/bhyve/rfb.c
index dc728aa46b64..4a550bca975b 100644
--- a/usr.sbin/bhyve/rfb.c
+++ b/usr.sbin/bhyve/rfb.c
@@ -113,7 +113,7 @@ struct rfb_softc {
 
 	int		width, height;
 
-	char		*password;
+	const char	*password;
 
 	bool		enc_raw_ok;
 	bool		enc_zlib_ok;
@@ -795,7 +795,7 @@ rfb_handle(struct rfb_softc *rc, int cfd)
 {
 	const char *vbuf = "RFB 003.008\n";
 	unsigned char buf[80];
-	unsigned char *message = NULL;
+	unsigned const char *message;
 
 #ifndef NO_OPENSSL
 	unsigned char challenge[AUTH_LENGTH];
@@ -1060,7 +1060,7 @@ sse42_supported(void)
 }
 
 int
-rfb_init(char *hostname, int port, int wait, char *password)
+rfb_init(const char *hostname, int port, int wait, const char *password)
 {
 	int e;
 	char servname[6];
diff --git a/usr.sbin/bhyve/rfb.h b/usr.sbin/bhyve/rfb.h
index dae43b2ec395..5a5785af41b0 100644
--- a/usr.sbin/bhyve/rfb.h
+++ b/usr.sbin/bhyve/rfb.h
@@ -33,6 +33,7 @@
 
 #define	RFB_PORT	5900
 
-int	rfb_init(char *hostname, int port, int wait, char *password);
+int	rfb_init(const char *hostname, int port, int wait,
+	    const char *password);
 
 #endif /* _RFB_H_ */