[ktap] Re: [PATCH 3/4] ktap: add support for write() operation

  • From: Yann Droneaud <ydroneaud@xxxxxxxxxx>
  • To: ktap@xxxxxxxxxxxxx
  • Date: Mon, 04 Nov 2013 22:27:48 +0100

Hi,

Some fixes after late proof reading:

Le lundi 04 novembre 2013 à 22:22 +0100, Yann Droneaud a écrit :
> Instead of using ioctls, new driver should use read/write
> operations when applicable.
> 
> Here, uploading opcodes seems to fit well with a write
> operation.
> 
> Signed-off-by: Yann Droneaud <ydroneaud@xxxxxxxxxx>
> ---
>  interpreter/ktap.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/interpreter/ktap.c b/interpreter/ktap.c
> index 646d8a1..1cbcba1 100644
> --- a/interpreter/ktap.c
> +++ b/interpreter/ktap.c
> @@ -137,6 +137,36 @@ static void print_version(void)

> +static ssize_t ktapvm_write(struct file *filp, const char __user *buf, 
> size_t count, loff_t *pos)
> +{
> +     ktap_parm parm;
> +
> +     if (count < sizeo(ktap_parm))
> +             return -EINVAL;
> +
> +     ret = copy_from_user(&parm, buf,
> +                          sizeof(ktap_parm));
> +     if (ret != 0)
> +             return -EFAULT;
> +
> +     ret = ktap_main(file, &parm);
                         ^^^^
                         it's filp here

> +
> +     if (ret != 0)
> +             return ret;
> +
> +     return size;
                ^^^^^
                it's count here

> +}
> +

Regards.

-- 
Yann Droneaud
OPTEYA



Other related posts: