git: d06bf11c06a0 - main - bhyve: Sprinkle const qualifiers where appropriate

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 16 Aug 2022 18:22:10 UTC
The branch main has been updated by markj:

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

commit d06bf11c06a0c2a6f52ba23f9b5204912cfd6fc5
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-08-16 17:13:12 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-08-16 18:21:44 +0000

    bhyve: Sprinkle const qualifiers where appropriate
    
    No functional change intended.
    
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 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 35dbf4704aab..695354b2ac0e 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 14a8fe936341..3d7b420e2bdf 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 a34366dedc5a..e86867192193 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 b55a64318e3a..88094a4f461f 100644
--- a/usr.sbin/bhyve/rfb.c
+++ b/usr.sbin/bhyve/rfb.c
@@ -114,7 +114,7 @@ struct rfb_softc {
 
 	int		width, height;
 
-	char		*password;
+	const char	*password;
 
 	bool		enc_raw_ok;
 	bool		enc_zlib_ok;
@@ -859,7 +859,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];
@@ -1130,7 +1130,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_ */