1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

Kernel: Stop using LibKeyboard's CharacterMap in HIDManagement

This was easily done, as the Kernel and Userland don't actually share
any of the APIs exposed by it, so instead the Kernel APIs were moved to
the Kernel, and the Userland APIs stayed in LibKeyboard.

This has multiple advantages:
 * The non OOM-fallible String is not longer used for storing the
   character map name in the Kernel
 * The kernel no longer has to link to the userland LibKeyboard code
 * A lot of #ifdef KERNEL cruft can be removed from LibKeyboard
This commit is contained in:
Idan Horowitz 2022-01-21 15:22:36 +02:00 committed by Andreas Kling
parent cecfd42916
commit 0adee378fd
7 changed files with 58 additions and 89 deletions

View file

@ -33,7 +33,7 @@ ErrorOr<FlatPtr> Process::sys$setkeymap(Userspace<const Syscall::SC_setkeymap_pa
if (map_name->length() > map_name_max_size)
return ENAMETOOLONG;
HIDManagement::the().set_maps(character_map_data, map_name->view());
HIDManagement::the().set_maps(move(map_name), character_map_data);
return 0;
}
@ -44,7 +44,7 @@ ErrorOr<FlatPtr> Process::sys$getkeymap(Userspace<const Syscall::SC_getkeymap_pa
auto params = TRY(copy_typed_from_user(user_params));
String keymap_name = HIDManagement::the().keymap_name();
const Keyboard::CharacterMapData& character_maps = HIDManagement::the().character_maps();
Keyboard::CharacterMapData const& character_maps = HIDManagement::the().character_map();
TRY(copy_to_user(params.map, character_maps.map, CHAR_MAP_SIZE * sizeof(u32)));
TRY(copy_to_user(params.shift_map, character_maps.shift_map, CHAR_MAP_SIZE * sizeof(u32)));