Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4548343imm; Tue, 11 Sep 2018 13:45:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbfvTeTitqF6CbLfdLR7vj7yM+TBQc0KR9Hui8UJrw8SNma9wsqgKxiqeuqF66rq3ECIkxl X-Received: by 2002:aa7:88d3:: with SMTP id p19-v6mr31580572pfo.160.1536698710293; Tue, 11 Sep 2018 13:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536698710; cv=none; d=google.com; s=arc-20160816; b=wKbiHIFwjo6Axae2LeMsY/G6yKwuNEUDJAV4/hAQP04NOSxLqfz3jivBVhb+M/n9lk AibEY5DXgILOSy4b8G+IXJKrkBdw6NiV/T2H+fl33QZ2ahbuJQFnh/c1S/PVyxpGtfj6 SXO4vn9g1emu8CUYDZX7+XYc/gRZRhFGtqO3mFrqaS+9/qhslHTiOsN/tw3IDlBbJsP4 hw/8pfXTRqrnxcy8EXLt9lVx6P0oyYzYtsK+CCG25YizT9TUeznGwbiAEjZWvN/iFpqx wvcJqI0jrFfO3lvvS9rtx/c5SB4z6zeHUhFb2b8rgg2QD6bsCkPYkzbXZ3lOgDux8H2h RdmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=2LVhzlK/CTHn+5Vu/OBJNhTVoLrWyD1fwy2uhLzUhX4=; b=wNDDZIOYytSoDgHy3dHe2EAwt4QEyOueNRwLjPi4yZWjUC24YbnN0yD/9p4uLm9Crd Ies5ZEEfKVrgINUi2B1mZ8rXFcS9Fg0ROmxQogft4VCOSDW1U/dPV62dmLt6vvRX6WJx g57mze7TtN3e5cFJqrtX+TdoHDg1CWWVNslH8i4lqMVgabzoD1vh3U8M8ABZHeOPblYP tMvoYltndU/xZsjLUYOpNMUAgdV7WZ4xrDcdouv6FoT55KI55rxwDu4t+Pf8menb+XtX SPhT/pmQH//SYNRGKrYpS5iZCXNusX4+fQdhfCyaU+ycRfudcV/fYc4HaK3pmgRYMDoi RbdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l1-v6si20347310pld.184.2018.09.11.13.44.55; Tue, 11 Sep 2018 13:45:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727658AbeILBpE (ORCPT + 99 others); Tue, 11 Sep 2018 21:45:04 -0400 Received: from mslow2.mail.gandi.net ([217.70.178.242]:42294 "EHLO mslow2.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726829AbeILBpD (ORCPT ); Tue, 11 Sep 2018 21:45:03 -0400 Received: from relay9-d.mail.gandi.net (unknown [217.70.183.199]) by mslow2.mail.gandi.net (Postfix) with ESMTP id EF9DE3A9FF6 for ; Tue, 11 Sep 2018 22:16:44 +0200 (CEST) X-Originating-IP: 88.190.179.123 Received: from localhost (unknown [88.190.179.123]) (Authenticated sender: repk@triplefau.lt) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 8A80FFF80A; Tue, 11 Sep 2018 20:16:41 +0000 (UTC) From: Remi Pommarel To: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org Cc: Alexander Viro , Kees Cook , Elie Roudninski , Remi Pommarel Subject: [PATCH 0/4] Add specific vt input's key map Date: Tue, 11 Sep 2018 22:23:55 +0200 Message-Id: X-Mailer: git-send-email 2.18.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset adds a way to have a specific keyboard config (i.e. keycode to keysym map) for a vt attached input. Because one can have different keyboards with different layouts on the same VT, it can be useful to be able to associate a different keymap with a different input. In order to do so this patchset introduces three new ioctls: 1) KDGKBIENT Get an input key map's entry. If the input does not have a specific key map the requested entry is fetched from global key map. 2) KDSKBIENT Set an input key map's entry. If the input does not yet have a specific key map, a new one is created with the current global key map content copied in. 3) KDSKBIRST Reset an input key map. The input does not use a specific key map anymore and keycode translations are done with global key map. In order to keep old behavior compatibility and not waste memory, an input uses the global key_maps[] array by default and KDGKBENT/KDSKBENT ioctls still get/set entries in this global key map. The specific key map is only allocated on the first call to KDSKBIENT. A patch for loadkeys is ready to be sent to the ML if this patchset seems sane to you. Here are some questions I had while doing this patchset: - Is it ok to add new ioctl to old legacy code ? I added those ioctl the old way in order to match the header style. Maybe it is better to use the __IO* macros ? - I am not quite sure about the meaning of keymap_count. IIUC, it is a counter of used keymap function arrays statically or dynamically allocated. If it is not the case, the modificiation in kc_setent() that decrements keymap_count even if a statically keymap function is removed with "K_NOSUCHMAP" (in PATCH 2/4) may be wrong ? - kbd_detach_conf is a bit clumsy because it tries to copy a shared sparse pointer array without using GFP_ATOMIC. Remi Pommarel (4): drivers/tty/vt/keyboard.c: refactor getting/setting a keymap entry drivers/tty/vt/keyboard.c: add keyboard config for each vt's input drivers/tty/vt/keyboard.c: Make key_down[] bitmap input dependent drivers/tty/vt: add ioctl to manage input specific keyboard configs drivers/tty/vt/keyboard.c | 531 ++++++++++++++++++++++++++++++-------- drivers/tty/vt/vt_ioctl.c | 9 + fs/compat_ioctl.c | 3 + include/linux/vt_kern.h | 4 + include/uapi/linux/kd.h | 9 + 5 files changed, 452 insertions(+), 104 deletions(-) -- 2.18.0