sys/kbio.h: make pre-unicode keymap support optional
FreeBSD-9 had introduced support for the full set of Unicode characters to the parsing and processing of keymap character tables. This support has been extended to cover the table for accented characters that are reached via dead key combinations in FreeBSD-13.2. New ioctls have been introduced to support both the pre-Unicode and the Unicode formats and keyboard drivers have been extended to support those ioctls. This commit makes the ABI compatibility functions in the kernel optional and dependent on COMPAT_FREEBSD13 in -CURRENT. The kbdcontrol command in -CURRENT and 13-STABLE (before 13.2) has been made ABI compatible with old kernels to allow a new world to be run on an old kernel (that does not have full Unicode support for keymaps). This commit is not to merged back to 12-STABLE or 13-STABLE. It is part of review D38465, which has been split into 3 separate commits due to different MFC and life-time requirements of either commit. Approved by: imp Differential Revision: https://reviews.freebsd.org/D38465
This commit is contained in:
parent
c2bb66023f
commit
f20058955c
@ -795,10 +795,12 @@ static int akbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t data)
|
||||
break;
|
||||
|
||||
case PIO_KEYMAP:
|
||||
case OPIO_KEYMAP:
|
||||
case PIO_KEYMAPENT:
|
||||
case PIO_DEADKEYMAP:
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OPIO_KEYMAP:
|
||||
case OPIO_DEADKEYMAP:
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
default:
|
||||
return (genkbd_commonioctl(kbd, cmd, data));
|
||||
}
|
||||
|
@ -1088,10 +1088,12 @@ atkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
return error;
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
äifdef COMPAT_FREEBSD13
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table (compat) */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
state->ks_accents = 0;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
|
@ -894,12 +894,15 @@ gpiokeys_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
return (gpiokeys_set_typematic(kbd, *(int *)arg));
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table
|
||||
* (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table
|
||||
* entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table (compat) */
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OPIO_KEYMAP: /* set keyboard translation table
|
||||
* (compat) */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table
|
||||
* (compat) */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
sc->sc_accents = 0;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
|
@ -1635,12 +1635,15 @@ hkbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
return (hkbd_set_typematic(kbd, *(int *)arg));
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table
|
||||
* (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table
|
||||
* entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table (compat) */
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OPIO_KEYMAP: /* set keyboard translation table
|
||||
* (compat) */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table
|
||||
* (compat) */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
sc->sc_accents = 0;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
|
@ -663,10 +663,12 @@ hvkbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
KBD_LED_VAL(kbd) = *(int *)arg;
|
||||
break;
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table (compat) */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
sc->sc_accents = 0;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
|
@ -789,13 +789,16 @@ int
|
||||
genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
{
|
||||
keymap_t *mapp;
|
||||
okeymap_t *omapp;
|
||||
accentmap_t *accentmapp;
|
||||
oaccentmap_t *oaccentmapp;
|
||||
keyarg_t *keyp;
|
||||
fkeyarg_t *fkeyp;
|
||||
int i, j;
|
||||
int error;
|
||||
int i;
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
int j;
|
||||
okeymap_t *omapp;
|
||||
oaccentmap_t *oaccentmapp;
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
|
||||
GIANT_REQUIRED;
|
||||
switch (cmd) {
|
||||
@ -824,6 +827,7 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
error = copyout(kbd->kb_keymap, *(void **)arg,
|
||||
sizeof(keymap_t));
|
||||
return (error);
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OGIO_KEYMAP: /* get keyboard translation table (compat) */
|
||||
mapp = kbd->kb_keymap;
|
||||
omapp = (okeymap_t *)arg;
|
||||
@ -836,10 +840,14 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
omapp->key[i].flgs = mapp->key[i].flgs;
|
||||
}
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
#ifndef KBD_DISABLE_KEYMAP_LOAD
|
||||
mapp = malloc(sizeof *mapp, M_TEMP, M_WAITOK);
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
if (cmd == OPIO_KEYMAP) {
|
||||
omapp = (okeymap_t *)arg;
|
||||
mapp->n_keys = omapp->n_keys;
|
||||
@ -850,7 +858,9 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
mapp->key[i].spcl = omapp->key[i].spcl;
|
||||
mapp->key[i].flgs = omapp->key[i].flgs;
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
{
|
||||
error = copyin(*(void **)arg, mapp, sizeof *mapp);
|
||||
if (error != 0) {
|
||||
free(mapp, M_TEMP);
|
||||
@ -904,6 +914,7 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
sizeof(accentmap_t));
|
||||
return (error);
|
||||
break;
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OGIO_DEADKEYMAP: /* get accent key translation table (compat) */
|
||||
accentmapp = kbd->kb_accentmap;
|
||||
oaccentmapp = (oaccentmap_t *)arg;
|
||||
@ -919,11 +930,15 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table (compat) */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
#ifndef KBD_DISABLE_KEYMAP_LOAD
|
||||
accentmapp = malloc(sizeof(*accentmapp), M_TEMP, M_WAITOK);
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
if (cmd == OPIO_DEADKEYMAP) {
|
||||
oaccentmapp = (oaccentmap_t *)arg;
|
||||
accentmapp->n_accs = oaccentmapp->n_accs;
|
||||
@ -937,7 +952,9 @@ genkbd_commonioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
oaccentmapp->acc[i].accchar;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
{
|
||||
error = copyin(*(void **)arg, accentmapp, sizeof(*accentmapp));
|
||||
if (error != 0) {
|
||||
free(accentmapp, M_TEMP);
|
||||
|
@ -1240,12 +1240,14 @@ kbdmux_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
break;
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table (compat) */
|
||||
KBDMUX_LOCK(state);
|
||||
state->ks_accents = 0;
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
|
||||
/* perform command on all slave keyboards */
|
||||
SLIST_FOREACH(k, &state->ks_kbds, next)
|
||||
|
@ -1594,12 +1594,14 @@ sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td)
|
||||
|
||||
case GIO_KEYMAP: /* get keyboard translation table */
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OGIO_KEYMAP: /* get keyboard translation table (compat) */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case GIO_DEADKEYMAP: /* get accent key translation table */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OGIO_KEYMAP: /* get keyboard translation table (compat) */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case OGIO_DEADKEYMAP: /* get accent key translation table (compat) */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table (compat) */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
case GETFKEY: /* get function key string */
|
||||
case SETFKEY: /* set function key string */
|
||||
error = kbdd_ioctl(sc->kbd, cmd, data);
|
||||
|
@ -1857,12 +1857,15 @@ ukbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
return (ukbd_set_typematic(kbd, *(int *)arg));
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table
|
||||
* (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table
|
||||
* entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table (compat) */
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OPIO_KEYMAP: /* set keyboard translation table
|
||||
* (compat) */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table
|
||||
* (compat) */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
sc->sc_accents = 0;
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
|
@ -1204,10 +1204,12 @@ vkbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg)
|
||||
break;
|
||||
|
||||
case PIO_KEYMAP: /* set keyboard translation table */
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case PIO_KEYMAPENT: /* set keyboard translation table entry */
|
||||
case PIO_DEADKEYMAP: /* set accent key translation table */
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OPIO_KEYMAP: /* set keyboard translation table (compat) */
|
||||
case OPIO_DEADKEYMAP: /* set accent key translation table (compat) */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
state->ks_accents = 0;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
|
@ -2403,9 +2403,11 @@ vtterm_ioctl(struct terminal *tm, u_long cmd, caddr_t data,
|
||||
case GIO_KEYMAP:
|
||||
case PIO_KEYMAP:
|
||||
case GIO_DEADKEYMAP:
|
||||
case OGIO_DEADKEYMAP:
|
||||
case PIO_DEADKEYMAP:
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
case OGIO_DEADKEYMAP:
|
||||
case OPIO_DEADKEYMAP:
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
case GETFKEY:
|
||||
case SETFKEY:
|
||||
case KDGKBINFO:
|
||||
|
@ -120,7 +120,7 @@ struct keymap {
|
||||
};
|
||||
typedef struct keymap keymap_t;
|
||||
|
||||
#ifdef _KERNEL
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
struct okeyent_t {
|
||||
u_char map[NUM_STATES];
|
||||
u_char spcl;
|
||||
@ -132,7 +132,7 @@ struct okeymap {
|
||||
struct okeyent_t key[NUM_KEYS];
|
||||
};
|
||||
typedef struct okeymap okeymap_t;
|
||||
#endif /* _KERNEL */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
|
||||
#endif /* !_KEYMAP_DECLARED */
|
||||
|
||||
@ -209,7 +209,7 @@ struct accentmap {
|
||||
};
|
||||
typedef struct accentmap accentmap_t;
|
||||
|
||||
//#ifdef _KERNEL
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
struct oacc_t {
|
||||
u_char accchar;
|
||||
u_char map[NUM_ACCENTCHARS][2];
|
||||
@ -220,7 +220,7 @@ struct oaccentmap {
|
||||
struct oacc_t acc[NUM_DEADKEYS];
|
||||
};
|
||||
typedef struct oaccentmap oaccentmap_t;
|
||||
//#endif /* _KERNEL */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
|
||||
struct keyarg {
|
||||
u_short keynum;
|
||||
@ -250,17 +250,17 @@ typedef struct fkeyarg fkeyarg_t;
|
||||
/* XXX: Should have keymap_t as an argument, but that's too big for ioctl()! */
|
||||
#define GIO_KEYMAP _IO('k', 6)
|
||||
#define PIO_KEYMAP _IO('k', 7)
|
||||
#ifdef _KERNEL
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
#define OGIO_KEYMAP _IOR('k', 6, okeymap_t)
|
||||
#define OPIO_KEYMAP _IOW('k', 7, okeymap_t)
|
||||
#endif /* _KERNEL */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
/* XXX: Should have accentmap_t as an argument, but that's too big for ioctl()! */
|
||||
#define GIO_DEADKEYMAP _IO('k', 8)
|
||||
#define PIO_DEADKEYMAP _IO('k', 9)
|
||||
//#ifdef _KERNEL
|
||||
#ifdef COMPAT_FREEBSD13
|
||||
#define OGIO_DEADKEYMAP _IOR('k', 8, oaccentmap_t)
|
||||
#define OPIO_DEADKEYMAP _IOW('k', 9, oaccentmap_t)
|
||||
//#endif /* _KERNEL */
|
||||
#endif /* COMPAT_FREEBSD13 */
|
||||
#define GIO_KEYMAPENT _IOWR('k', 10, keyarg_t)
|
||||
#define PIO_KEYMAPENT _IOW('k', 11, keyarg_t)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user