[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190416113740.GA18054@kroah.com>
Date: Tue, 16 Apr 2019 13:37:40 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Okash Khawaja <okash.khawaja@...il.com>
Cc: Samuel Thibault <samuel.thibault@...-lyon.org>,
Gregory Nowak <greg@...gn.net>, linux-kernel@...r.kernel.org,
devel@...verdev.osuosl.org, Kirk Reiser <kirk@...sers.ca>,
Peter Hurley <peter@...leysoftware.com>,
Jiri Slaby <jslaby@...e.com>, speakup@...ux-speakup.org,
John Covici <covici@....covici.com>,
Ben Hutchings <ben@...adent.org.uk>,
Chris Brannon <chris@...-brannons.com>
Subject: Re: [PATCH 1/2] vt: selection: allow functions to be called from
inside kernel
On Thu, Apr 04, 2019 at 08:45:29PM +0100, Okash Khawaja wrote:
> This patch breaks set_selection() into two functions so that when
> called from kernel, copy_from_user() can be avoided. It also exports
> set_selection() and paste_selection().
>
> These changes are used the following patch where speakup's selection
> functionality calls into the above functions, thereby doing away with
> parallel implementation.
>
> Signed-off-by: Okash Khawaja <okash.khawaja@...il.com>
> Reviewed-by: Samuel Thibault <samuel.thibault@...-lyon.org>
> Tested-by: Gregory Nowak <greg@...gn.net>
> ---
> drivers/tty/vt/selection.c | 37 ++++++++++++++++++++++++-------------
> include/linux/selection.h | 3 +--
> 2 files changed, 25 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
> index 07496c711d7d..a43f9cd9bdd6 100644
> --- a/drivers/tty/vt/selection.c
> +++ b/drivers/tty/vt/selection.c
> @@ -80,6 +80,7 @@ void clear_selection(void)
> sel_start = -1;
> }
> }
> +EXPORT_SYMBOL_GPL(clear_selection);
>
> /*
> * User settable table: what characters are to be considered alphabetic?
> @@ -164,34 +165,42 @@ static int store_utf8(u32 c, char *p)
> * a lot under the lock but its hardly a performance path
> */
> int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty)
> +{
> + struct tiocl_selection v;
> +
> + if (copy_from_user(&v, sel, sizeof(*sel)))
> + return -EFAULT;
> +
> + return do_set_selection(&v, tty);
> +}
> +
> +int do_set_selection(struct tiocl_selection *v, struct tty_struct *tty)
I have no idea what the difference is between set_selection() and
do_set_selection() is now. Naming is hard, I know :(
How about set_selection_kernel()? set_selection_tiocl()?
Something to show that one takes a userspace pointer, and the other a
kernel pointer, how about:
set_selection_user()
set_selection_kernel()
making it more obvious?
thanks,
greg k-h
Powered by blists - more mailing lists