diff mbox

[1/2] linux-user: Add loop control ioctls

Message ID 1467648378-26630-2-git-send-email-peter.maydell@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Maydell July 4, 2016, 4:06 p.m. UTC
Add support for the /dev/loop-control ioctls:
 LOOP_CTL_ADD
 LOOP_CTL_REMOVE
 LOOP_CTL_GET_FREE

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/ioctls.h       |  4 ++++
 linux-user/linux_loop.h   | 11 ++++++++++-
 linux-user/syscall_defs.h |  4 ++++
 3 files changed, 18 insertions(+), 1 deletion(-)

Comments

Laurent Vivier July 5, 2016, 7:45 a.m. UTC | #1
Le 04/07/2016 à 18:06, Peter Maydell a écrit :
> Add support for the /dev/loop-control ioctls:
>  LOOP_CTL_ADD
>  LOOP_CTL_REMOVE
>  LOOP_CTL_GET_FREE
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Laurent Vivier <laurent@vivier.eu>

> ---
>  linux-user/ioctls.h       |  4 ++++
>  linux-user/linux_loop.h   | 11 ++++++++++-
>  linux-user/syscall_defs.h |  4 ++++
>  3 files changed, 18 insertions(+), 1 deletion(-)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 804f099..72cd32a 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -356,6 +356,10 @@
>    IOCTL(LOOP_GET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
>    IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT)
>  
> +  IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)
> +  IOCTL(LOOP_CTL_REMOVE, 0, TYPE_INT)
> +  IOCTL(LOOP_CTL_GET_FREE, 0, TYPE_NULL)
> +
>    IOCTL(MTIOCTOP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_mtop)))
>    IOCTL(MTIOCGET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtget)))
>    IOCTL(MTIOCPOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtpos)))
> diff --git a/linux-user/linux_loop.h b/linux-user/linux_loop.h
> index 8974caa..fd7608b 100644
> --- a/linux-user/linux_loop.h
> +++ b/linux-user/linux_loop.h
> @@ -1,4 +1,6 @@
> -/* Copied from 2.6.25 kernel headers to avoid problems on older hosts.  */
> +/* Copied from 2.6.25 kernel headers to avoid problems on older hosts,
> + * and subsequently updated to match newer additions to the API.
> + */
>  #ifndef _LINUX_LOOP_H
>  #define _LINUX_LOOP_H
>  
> @@ -91,5 +93,12 @@ struct loop_info64 {
>  #define LOOP_SET_STATUS64	0x4C04
>  #define LOOP_GET_STATUS64	0x4C05
>  #define LOOP_CHANGE_FD		0x4C06
> +#define LOOP_SET_CAPACITY       0x4C07
> +#define LOOP_SET_DIRECT_IO      0x4C08
> +
> +/* /dev/loop-control interface */
> +#define LOOP_CTL_ADD            0x4C80
> +#define LOOP_CTL_REMOVE         0x4C81
> +#define LOOP_CTL_GET_FREE       0x4C82
>  
>  #endif
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 6650e26..0591abc 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -1129,6 +1129,10 @@ struct target_pollfd {
>  #define TARGET_LOOP_GET_STATUS64      0x4C05
>  #define TARGET_LOOP_CHANGE_FD         0x4C06
>  
> +#define TARGET_LOOP_CTL_ADD           0x4C80
> +#define TARGET_LOOP_CTL_REMOVE        0x4C81
> +#define TARGET_LOOP_CTL_GET_FREE      0x4C82
> +
>  /* fb ioctls */
>  #define TARGET_FBIOGET_VSCREENINFO    0x4600
>  #define TARGET_FBIOPUT_VSCREENINFO    0x4601
>
diff mbox

Patch

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 804f099..72cd32a 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -356,6 +356,10 @@ 
   IOCTL(LOOP_GET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
   IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT)
 
+  IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)
+  IOCTL(LOOP_CTL_REMOVE, 0, TYPE_INT)
+  IOCTL(LOOP_CTL_GET_FREE, 0, TYPE_NULL)
+
   IOCTL(MTIOCTOP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_mtop)))
   IOCTL(MTIOCGET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtget)))
   IOCTL(MTIOCPOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtpos)))
diff --git a/linux-user/linux_loop.h b/linux-user/linux_loop.h
index 8974caa..fd7608b 100644
--- a/linux-user/linux_loop.h
+++ b/linux-user/linux_loop.h
@@ -1,4 +1,6 @@ 
-/* Copied from 2.6.25 kernel headers to avoid problems on older hosts.  */
+/* Copied from 2.6.25 kernel headers to avoid problems on older hosts,
+ * and subsequently updated to match newer additions to the API.
+ */
 #ifndef _LINUX_LOOP_H
 #define _LINUX_LOOP_H
 
@@ -91,5 +93,12 @@  struct loop_info64 {
 #define LOOP_SET_STATUS64	0x4C04
 #define LOOP_GET_STATUS64	0x4C05
 #define LOOP_CHANGE_FD		0x4C06
+#define LOOP_SET_CAPACITY       0x4C07
+#define LOOP_SET_DIRECT_IO      0x4C08
+
+/* /dev/loop-control interface */
+#define LOOP_CTL_ADD            0x4C80
+#define LOOP_CTL_REMOVE         0x4C81
+#define LOOP_CTL_GET_FREE       0x4C82
 
 #endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 6650e26..0591abc 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1129,6 +1129,10 @@  struct target_pollfd {
 #define TARGET_LOOP_GET_STATUS64      0x4C05
 #define TARGET_LOOP_CHANGE_FD         0x4C06
 
+#define TARGET_LOOP_CTL_ADD           0x4C80
+#define TARGET_LOOP_CTL_REMOVE        0x4C81
+#define TARGET_LOOP_CTL_GET_FREE      0x4C82
+
 /* fb ioctls */
 #define TARGET_FBIOGET_VSCREENINFO    0x4600
 #define TARGET_FBIOPUT_VSCREENINFO    0x4601