linux-user: implement more loop ioctls
PATCH 1/1 linux-user: implement more loop ioctls
LOOP_CONFIGURE is now used by losetup, and it cannot cope with ENOSYS.
Signed-off-by Andreas Schwab <[email protected]>
--- linux-user/ioctls.h | 4 ++++ linux-user/linux_loop.h | 2 ++ linux-user/syscall_defs.h | 4 ++++ linux-user/syscall_types.h | 6 ++++++ 4 files changed, 16 insertions(+)
linux-user/ioctls.h +4 -0
@@ -637,6 +637,10 @@ IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT) + IOCTL(LOOP_SET_CAPACITY, 0, TYPE_INT) + IOCTL(LOOP_SET_DIRECT_IO, 0, TYPE_INT) + IOCTL(LOOP_SET_BLOCK_SIZE, 0, TYPE_INT) + IOCTL(LOOP_CONFIGURE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_configure))) IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)IOCTL (LOOP_CTL_REMOVE ,0 ,TYPE_INT )
linux-user/linux_loop.h +2 -0
@@ -96,6 +96,8 @@ struct loop_info64 {#define LOOP_CHANGE_FD 0x4C06#define LOOP_SET_CAPACITY 0x4C07#define LOOP_SET_DIRECT_IO 0x4C08 +#define LOOP_SET_BLOCK_SIZE 0x4C09 +#define LOOP_CONFIGURE 0x4C0A/* /dev/loop-control interface */ #define LOOP_CTL_ADD 0x4C80
linux-user/syscall_defs.h +4 -0
@@ -1219,6 +1219,10 @@ struct target_rtc_pll_info {#define TARGET_LOOP_SET_STATUS64 0x4C04#define TARGET_LOOP_GET_STATUS64 0x4C05#define TARGET_LOOP_CHANGE_FD 0x4C06 +#define TARGET_LOOP_SET_CAPACITY 0x4C07 +#define TARGET_LOOP_SET_DIRECT_IO 0x4C08 +#define TARGET_LOOP_SET_BLOCK_SIZE 0x4C09 +#define TARGET_LOOP_CONFIGURE 0x4C0A#define TARGET_LOOP_CTL_ADD 0x4C80#define TARGET_LOOP_CTL_REMOVE 0x4C81
linux-user/syscall_types.h +6 -0
@@ -201,6 +201,12 @@ STRUCT(loop_info64, MK_ARRAY(TYPE_CHAR, 32), /* lo_encrypt_key */ MK_ARRAY(TYPE_ULONGLONG, 2)) /* lo_init */ +STRUCT (loop_configure, +TYPE_INT ,/* fd */ +TYPE_INT ,/* block_size */ +MK_STRUCT (STRUCT_loop_info64),/* info */ +MK_ARRAY (TYPE_ULONGLONG ,8 ))/* __reserved */ + /* mag tape ioctls */ STRUCT(mtop, TYPE_SHORT, TYPE_INT) STRUCT(mtget, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG,
Signature · 1 line
2.34.0
Le 22/11/2021 à 15:18, Andreas Schwab a écrit :
Quoted 58 lines
LOOP_CONFIGUREis now used by losetup, and it cannot cope with ENOSYS.Signed-off-by Andreas Schwab <[email protected]>--- linux-user/ioctls.h | 4 ++++ linux-user/linux_loop.h | 2 ++ linux-user/syscall_defs.h | 4 ++++ linux-user/syscall_types.h | 6 ++++++ 4 files changed, 16 insertions(+)linux-user/ioctls.h +4
-0@@ -637,6 +637,10 @@ IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT) + IOCTL(LOOP_SET_CAPACITY, 0, TYPE_INT) + IOCTL(LOOP_SET_DIRECT_IO, 0, TYPE_INT) + IOCTL(LOOP_SET_BLOCK_SIZE, 0, TYPE_INT) + IOCTL(LOOP_CONFIGURE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_configure))) IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)IOCTL (LOOP_CTL_REMOVE ,0 ,TYPE_INT )linux-user/linux_loop.h +2
-0@@ -96,6 +96,8 @@ struct loop_info64 {#define LOOP_CHANGE_FD 0x4C06#define LOOP_SET_CAPACITY 0x4C07#define LOOP_SET_DIRECT_IO 0x4C08 +#define LOOP_SET_BLOCK_SIZE 0x4C09 +#define LOOP_CONFIGURE 0x4C0A/* /dev/loop-control interface */ #define LOOP_CTL_ADD 0x4C80linux-user/syscall_defs.h +4
-0@@ -1219,6 +1219,10 @@ struct target_rtc_pll_info {#define TARGET_LOOP_SET_STATUS64 0x4C04#define TARGET_LOOP_GET_STATUS64 0x4C05#define TARGET_LOOP_CHANGE_FD 0x4C06 +#define TARGET_LOOP_SET_CAPACITY 0x4C07 +#define TARGET_LOOP_SET_DIRECT_IO 0x4C08 +#define TARGET_LOOP_SET_BLOCK_SIZE 0x4C09 +#define TARGET_LOOP_CONFIGURE 0x4C0A#define TARGET_LOOP_CTL_ADD 0x4C80#define TARGET_LOOP_CTL_REMOVE 0x4C81linux-user/syscall_types.h +0
-0
linux-user/syscall_types.h STRUCT(loop_info64, · line 204
Quoted 4 lines
linux-user/syscall_types.h +1
-0@@ -201,6 +201,12 @@ STRUCT(loop_info64, MK_ARRAY(TYPE_CHAR, 32), /* lo_encrypt_key */ MK_ARRAY(TYPE_ULONGLONG, 2)) /* lo_init */ +STRUCT(loop_configure,
It should be named "loop_config", like int he kernel.
Except that:
Reviewed-by Laurent Vivier <[email protected]>
Quoted 9 lines
linux-user/syscall_types.h +5
-0+ TYPE_INT, /* fd */ + TYPE_INT, /* block_size */ + MK_STRUCT(STRUCT_loop_info64), /* info */ + MK_ARRAY(TYPE_ULONGLONG, 8)) /* __reserved */ +/* mag tape ioctls */ STRUCT(mtop, TYPE_SHORT, TYPE_INT) STRUCT(mtget, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG,
PATCH v2 1/1 linux-user: implement more loop ioctls
LOOP_CONFIGURE is now used by losetup, and it cannot cope with ENOSYS.
Signed-off-by Andreas Schwab <[email protected]>
---
v2: fix s/loop_configure/loop_config/ typo
linux-user/ioctls.h | 4 ++++ linux-user/linux_loop.h | 2 ++ linux-user/syscall_defs.h | 4 ++++ linux-user/syscall_types.h | 6 ++++++ 4 files changed, 16 insertions(+)
linux-user/ioctls.h +4 -0
@@ -637,6 +637,10 @@ IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT) + IOCTL(LOOP_SET_CAPACITY, 0, TYPE_INT) + IOCTL(LOOP_SET_DIRECT_IO, 0, TYPE_INT) + IOCTL(LOOP_SET_BLOCK_SIZE, 0, TYPE_INT) + IOCTL(LOOP_CONFIGURE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_config))) IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)IOCTL (LOOP_CTL_REMOVE ,0 ,TYPE_INT )
linux-user/linux_loop.h +2 -0
@@ -96,6 +96,8 @@ struct loop_info64 {#define LOOP_CHANGE_FD 0x4C06#define LOOP_SET_CAPACITY 0x4C07#define LOOP_SET_DIRECT_IO 0x4C08 +#define LOOP_SET_BLOCK_SIZE 0x4C09 +#define LOOP_CONFIGURE 0x4C0A/* /dev/loop-control interface */ #define LOOP_CTL_ADD 0x4C80
linux-user/syscall_defs.h +4 -0
@@ -1219,6 +1219,10 @@ struct target_rtc_pll_info {#define TARGET_LOOP_SET_STATUS64 0x4C04#define TARGET_LOOP_GET_STATUS64 0x4C05#define TARGET_LOOP_CHANGE_FD 0x4C06 +#define TARGET_LOOP_SET_CAPACITY 0x4C07 +#define TARGET_LOOP_SET_DIRECT_IO 0x4C08 +#define TARGET_LOOP_SET_BLOCK_SIZE 0x4C09 +#define TARGET_LOOP_CONFIGURE 0x4C0A#define TARGET_LOOP_CTL_ADD 0x4C80#define TARGET_LOOP_CTL_REMOVE 0x4C81
linux-user/syscall_types.h +6 -0
@@ -201,6 +201,12 @@ STRUCT(loop_info64, MK_ARRAY(TYPE_CHAR, 32), /* lo_encrypt_key */ MK_ARRAY(TYPE_ULONGLONG, 2)) /* lo_init */ +STRUCT (loop_config, +TYPE_INT ,/* fd */ +TYPE_INT ,/* block_size */ +MK_STRUCT (STRUCT_loop_info64),/* info */ +MK_ARRAY (TYPE_ULONGLONG ,8 ))/* __reserved */ + /* mag tape ioctls */ STRUCT(mtop, TYPE_SHORT, TYPE_INT) STRUCT(mtget, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG,
Signature · 1 line
2.34.0
Le 22/11/2021 à 16:56, Andreas Schwab a écrit :
Quoted 63 lines
LOOP_CONFIGUREis now used by losetup, and it cannot cope with ENOSYS.Signed-off-by Andreas Schwab <[email protected]>---
v2: fix s/loop_configure/loop_config/ typolinux-user/ioctls.h | 4 ++++ linux-user/linux_loop.h | 2 ++ linux-user/syscall_defs.h | 4 ++++ linux-user/syscall_types.h | 6 ++++++ 4 files changed, 16 insertions(+)linux-user/ioctls.h +4
-0@@ -637,6 +637,10 @@ IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) IOCTL(LOOP_GET_STATUS64, IOC_R, MK_PTR(MK_STRUCT(STRUCT_loop_info64))) IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT) + IOCTL(LOOP_SET_CAPACITY, 0, TYPE_INT) + IOCTL(LOOP_SET_DIRECT_IO, 0, TYPE_INT) + IOCTL(LOOP_SET_BLOCK_SIZE, 0, TYPE_INT) + IOCTL(LOOP_CONFIGURE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_config))) IOCTL(LOOP_CTL_ADD, 0, TYPE_INT)IOCTL (LOOP_CTL_REMOVE ,0 ,TYPE_INT )linux-user/linux_loop.h +2
-0@@ -96,6 +96,8 @@ struct loop_info64 {#define LOOP_CHANGE_FD 0x4C06#define LOOP_SET_CAPACITY 0x4C07#define LOOP_SET_DIRECT_IO 0x4C08 +#define LOOP_SET_BLOCK_SIZE 0x4C09 +#define LOOP_CONFIGURE 0x4C0A/* /dev/loop-control interface */ #define LOOP_CTL_ADD 0x4C80linux-user/syscall_defs.h +4
-0@@ -1219,6 +1219,10 @@ struct target_rtc_pll_info {#define TARGET_LOOP_SET_STATUS64 0x4C04#define TARGET_LOOP_GET_STATUS64 0x4C05#define TARGET_LOOP_CHANGE_FD 0x4C06 +#define TARGET_LOOP_SET_CAPACITY 0x4C07 +#define TARGET_LOOP_SET_DIRECT_IO 0x4C08 +#define TARGET_LOOP_SET_BLOCK_SIZE 0x4C09 +#define TARGET_LOOP_CONFIGURE 0x4C0A#define TARGET_LOOP_CTL_ADD 0x4C80#define TARGET_LOOP_CTL_REMOVE 0x4C81linux-user/syscall_types.h +0
-0@@ -201,6 +201,12 @@ STRUCT(loop_info64,MK_ARRAY (TYPE_CHAR ,32 ),/* lo_encrypt_key */ MK_ARRAY(TYPE_ULONGLONG, 2)) /* lo_init */
linux-user/syscall_types.h STRUCT(loop_info64, · line 212
Quoted 10 lines
linux-user/syscall_types.h +6
-0+STRUCT (loop_config, +TYPE_INT ,/* fd */ +TYPE_INT ,/* block_size */ +MK_STRUCT (STRUCT_loop_info64),/* info */ +MK_ARRAY (TYPE_ULONGLONG ,8 ))/* __reserved */ + /* mag tape ioctls */ STRUCT(mtop, TYPE_SHORT, TYPE_INT) STRUCT(mtget, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG,
Reviewed-by Laurent Vivier <[email protected]>