Author: kevans
Date: Tue Dec 17 03:30:49 2019
New Revision: 355842
URL: https://svnweb.freebsd.org/changeset/base/355842

Log:
  kbd: const'ify a couple of keyboard_driver fields
  
  Nothing modifies these things, but const'ify out of an abundance of caution.
  If we could const'ify the definition in each keyboard driver, I likely
  would- improper mutations here can lead to misbehavior or slightly more
  annoying to debug state.

Modified:
  head/sys/dev/kbd/kbdreg.h

Modified: head/sys/dev/kbd/kbdreg.h
==============================================================================
--- head/sys/dev/kbd/kbdreg.h   Tue Dec 17 03:20:37 2019        (r355841)
+++ head/sys/dev/kbd/kbdreg.h   Tue Dec 17 03:30:49 2019        (r355842)
@@ -96,12 +96,17 @@ typedef struct keyboard_switch {
        kbd_diag_t      *diag;
 } keyboard_switch_t;
 
-/* keyboard driver */
+/*
+ * Keyboard driver definition.  Some of these be immutable after definition
+ * time, e.g. one shouldn't be able to rename a driver or use a different kbdsw
+ * entirely, but patching individual methods is acceptable.
+ */
 typedef struct keyboard_driver {
     SLIST_ENTRY(keyboard_driver) link;
-    char               *name;
-    keyboard_switch_t  *kbdsw;
-    int                        (*configure)(int); /* backdoor for the console 
driver */
+    const char * const         name;
+    keyboard_switch_t * const  kbdsw;
+    /* backdoor for the console driver */
+    int                                (* const configure)(int);
 } keyboard_driver_t;
 
 /* keyboard */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to