qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] linux-user: Add FICLONE and FICLONERANGE ioctls
@ 2017-01-28 12:03 Helge Deller
  2017-02-01 23:01 ` Laurent Vivier
  0 siblings, 1 reply; 2+ messages in thread
From: Helge Deller @ 2017-01-28 12:03 UTC (permalink / raw)
  To: qemu-devel; +Cc: Richard Henderson

Add missing FICLONE and FICLONERANGE ioctls.

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 2f6e85b..eb1421d 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -112,6 +112,11 @@
 #ifdef FIBMAP
      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
 #endif
+#ifdef FICLONE
+     IOCTL(FICLONE, IOC_W, TYPE_INT)
+     IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 4)))
+#endif
+
 #ifdef FIGETBSZ
      IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
 #endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 4442c22..72ca5b1 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1086,6 +1086,10 @@ struct target_pollfd {
 
 #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
 #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
+
+#define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
+#define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
+
 /* Note that the ioctl numbers claim type "long" but the actual type
  * used by the kernel is "int".
  */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] linux-user: Add FICLONE and FICLONERANGE ioctls
  2017-01-28 12:03 [Qemu-devel] [PATCH] linux-user: Add FICLONE and FICLONERANGE ioctls Helge Deller
@ 2017-02-01 23:01 ` Laurent Vivier
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Vivier @ 2017-02-01 23:01 UTC (permalink / raw)
  To: Helge Deller, qemu-devel; +Cc: Richard Henderson

Le 28/01/2017 à 13:03, Helge Deller a écrit :
> Add missing FICLONE and FICLONERANGE ioctls.
> 
> Signed-off-by: Helge Deller <deller@gmx.de>
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 2f6e85b..eb1421d 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -112,6 +112,11 @@
>  #ifdef FIBMAP
>       IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
>  #endif
> +#ifdef FICLONE
> +     IOCTL(FICLONE, IOC_W, TYPE_INT)
> +     IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 4)))
> +#endif
> +
>  #ifdef FIGETBSZ
>       IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
>  #endif
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 4442c22..72ca5b1 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -1086,6 +1086,10 @@ struct target_pollfd {
>  
>  #define TARGET_FIBMAP     TARGET_IO(0x00,1)  /* bmap access */
>  #define TARGET_FIGETBSZ   TARGET_IO(0x00,2)  /* get the block size used for bmap */
> +
> +#define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
> +#define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
> +
>  /* Note that the ioctl numbers claim type "long" but the actual type
>   * used by the kernel is "int".
>   */
> 

I think it should be cleaner to define STRUCT_file_clone_range in
linux-user/syscall_types.h with STRUCT() macro, and then to use it:

STRUCT(file_clone_range,
       TYPE_LONGLONG, /* src_fd */
       TYPE_ULONGLONG, /* src_offset */
       TYPE_ULONGLONG, /* src_length */
       TYPE_ULONGLONG) /* dest_offset */

IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))

Laurent

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-01 23:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-28 12:03 [Qemu-devel] [PATCH] linux-user: Add FICLONE and FICLONERANGE ioctls Helge Deller
2017-02-01 23:01 ` Laurent Vivier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).