All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Marco A L Barbosa <malbarbo@gmail.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH] linux-user: Add random ioctls
Date: Thu, 5 Oct 2017 09:12:21 +0200	[thread overview]
Message-ID: <43071208-759c-6476-0cb0-c4e7e0daaf77@redhat.com> (raw)
In-Reply-To: <CAHpsRN-XzxjJZb=rb0iHMv4Afv=2H3N5U7p4+NNJFPkxgSLMXg@mail.gmail.com>

On 05/10/2017 00:06, Marco A L Barbosa wrote:
> I don't know how (and if it is necessary) to add buf field to
> rand_pool_info struct. See
> https://github.com/torvalds/linux/blob/5924bbecd0267d87c24110cbe2041b5075173a25/include/uapi/linux/random.h#L17

I doesn't look really trivial...

To manage the buf field you must read buf_size and it cannot be done in 
a generic way: you must define a function to translate the buffer, use 
IOCTL_SPECIAL() with RNDADDENTROPY and RNDGETPOOL.

You should send your patch using "git send-email" or "git publish" 
instead of adding it in you email client.

> Signed-off-by: Marco A L Barbosa <malbarbo@gmail.com
> <mailto:malbarbo@gmail.com>>
> ---
>  linux-user/ioctls.h        | 7 +++++++
>  linux-user/syscall.c       | 1 +
>  linux-user/syscall_defs.h  | 9 +++++++++
>  linux-user/syscall_types.h | 4 ++++
>  4 files changed, 21 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index e6997ff230..9240a83f30 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -173,6 +173,13 @@
>    IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
>    IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
>  
> +  IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
> +  IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rand_pool_info)))

..., MK_PTR(TYPE_INT)

> +  IOCTL(RNDGETPOOL, IOC_R, MK_PTR(TYPE_INT))

... MK_PTR(MK_STRUCT(STRUCT_rand_pool_info))

Thanks,
Laurent


WARNING: multiple messages have this Message-ID (diff)
From: Laurent Vivier <lvivier@redhat.com>
To: Marco A L Barbosa <malbarbo@gmail.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH] linux-user: Add random ioctls
Date: Thu, 5 Oct 2017 09:12:21 +0200	[thread overview]
Message-ID: <43071208-759c-6476-0cb0-c4e7e0daaf77@redhat.com> (raw)
In-Reply-To: <CAHpsRN-XzxjJZb=rb0iHMv4Afv=2H3N5U7p4+NNJFPkxgSLMXg@mail.gmail.com>

On 05/10/2017 00:06, Marco A L Barbosa wrote:
> I don't know how (and if it is necessary) to add buf field to
> rand_pool_info struct. See
> https://github.com/torvalds/linux/blob/5924bbecd0267d87c24110cbe2041b5075173a25/include/uapi/linux/random.h#L17

I doesn't look really trivial...

To manage the buf field you must read buf_size and it cannot be done in 
a generic way: you must define a function to translate the buffer, use 
IOCTL_SPECIAL() with RNDADDENTROPY and RNDGETPOOL.

You should send your patch using "git send-email" or "git publish" 
instead of adding it in you email client.

> Signed-off-by: Marco A L Barbosa <malbarbo@gmail.com
> <mailto:malbarbo@gmail.com>>
> ---
>  linux-user/ioctls.h        | 7 +++++++
>  linux-user/syscall.c       | 1 +
>  linux-user/syscall_defs.h  | 9 +++++++++
>  linux-user/syscall_types.h | 4 ++++
>  4 files changed, 21 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index e6997ff230..9240a83f30 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -173,6 +173,13 @@
>    IOCTL(SIOCGSTAMP, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timeval)))
>    IOCTL(SIOCGSTAMPNS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_timespec)))
>  
> +  IOCTL(RNDGETENTCNT, IOC_R, MK_PTR(TYPE_INT))
> +  IOCTL(RNDADDTOENTCNT, IOC_W, MK_PTR(MK_STRUCT(STRUCT_rand_pool_info)))

..., MK_PTR(TYPE_INT)

> +  IOCTL(RNDGETPOOL, IOC_R, MK_PTR(TYPE_INT))

... MK_PTR(MK_STRUCT(STRUCT_rand_pool_info))

Thanks,
Laurent

  reply	other threads:[~2017-10-05  7:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-04 22:06 [Qemu-trivial] [PATCH] linux-user: Add random ioctls Marco A L Barbosa
2017-10-04 22:06 ` [Qemu-devel] " Marco A L Barbosa
2017-10-05  7:12 ` Laurent Vivier [this message]
2017-10-05  7:12   ` [Qemu-devel] [Qemu-trivial] " Laurent Vivier
2017-10-05 10:24   ` Marco A L Barbosa
2017-10-05 10:24     ` [Qemu-devel] " Marco A L Barbosa
2017-10-05 10:35     ` Laurent Vivier
2017-10-05 10:35       ` [Qemu-devel] " Laurent Vivier
2017-10-05 13:22       ` Marco A L Barbosa
2017-10-05 13:22         ` [Qemu-devel] " Marco A L Barbosa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43071208-759c-6476-0cb0-c4e7e0daaf77@redhat.com \
    --to=lvivier@redhat.com \
    --cc=malbarbo@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.