aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-04-26 14:44:49 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2008-04-26 14:44:49 +0000
commitb80059146a170ea5111a55f3757b8de4cf0c729b (patch)
tree265a946845240f46776ad8d6f230a37792a1bd26
parentc38b6e259165597d9fee6965616e1ac3245bf476 (diff)
Add loop device ioctls (Gary Thomas).
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4257 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--linux-user/ioctls.h10
-rw-r--r--linux-user/syscall.c1
-rw-r--r--linux-user/syscall_defs.h8
-rw-r--r--linux-user/syscall_types.h29
4 files changed, 48 insertions, 0 deletions
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index dae3efaa97..c1ca2d528d 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -300,3 +300,13 @@
IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
+
+ IOCTL(LOOP_SET_FD, 0, TYPE_INT)
+ IOCTL(LOOP_CLR_FD, 0, TYPE_INT)
+ IOCTL(LOOP_SET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
+ IOCTL(LOOP_GET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
+#if 0 /* These have some problems - not fully tested */
+ IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
+ IOCTL(LOOP_GET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
+#endif
+ IOCTL(LOOP_CHANGE_FD, 0, TYPE_INT)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3946d61b67..a62bd9bd6b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -68,6 +68,7 @@
#include <linux/soundcard.h>
#include <linux/dirent.h>
#include <linux/kd.h>
+#include <linux/loop.h>
#include "qemu.h"
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 73e54dede2..d2810f27cb 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -830,6 +830,14 @@ struct target_pollfd {
#define TARGET_HDIO_SET_DMA 0x0326 /* change use-dma flag */
#define TARGET_HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
+/* loop ioctls */
+#define TARGET_LOOP_SET_FD 0x4C00
+#define TARGET_LOOP_CLR_FD 0x4C01
+#define TARGET_LOOP_SET_STATUS 0x4C02
+#define TARGET_LOOP_GET_STATUS 0x4C03
+#define TARGET_LOOP_SET_STATUS64 0x4C04
+#define TARGET_LOOP_GET_STATUS64 0x4C05
+#define TARGET_LOOP_CHANGE_FD 0x4C06
/* from asm/termbits.h */
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index f73aabc1d8..bb4fb4e3d3 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -79,3 +79,32 @@ STRUCT(count_info,
STRUCT(mixer_info,
MK_ARRAY(TYPE_CHAR, 16), MK_ARRAY(TYPE_CHAR, 32), TYPE_INT, MK_ARRAY(TYPE_INT, 10))
+
+/* loop device ioctls */
+STRUCT(loop_info,
+ TYPE_INT, /* lo_number */
+ TYPE_SHORT, /* lo_device */
+ TYPE_ULONG, /* lo_inode */
+ TYPE_SHORT, /* lo_rdevice */
+ TYPE_INT, /* lo_offset */
+ TYPE_INT, /* lo_encrypt_type */
+ TYPE_INT, /* lo_encrypt_key_size */
+ TYPE_INT, /* lo_flags */
+ MK_ARRAY(TYPE_CHAR, 64), /* lo_name */
+ MK_ARRAY(TYPE_CHAR, 32), /* lo_encrypt_key */
+ MK_ARRAY(TYPE_ULONG, 2), /* lo_init */
+ MK_ARRAY(TYPE_CHAR, 4)) /* reserved */
+
+STRUCT(loop_info64,
+ TYPE_ULONGLONG, /* lo_device */
+ TYPE_ULONGLONG, /* lo_inode */
+ TYPE_ULONGLONG, /* lo_rdevice */
+ TYPE_ULONGLONG, /* lo_offset */
+ TYPE_ULONG, /* lo_number */
+ TYPE_ULONG, /* lo_encrypt_type */
+ TYPE_ULONG, /* lo_encrypt_key_size */
+ TYPE_ULONG, /* lo_flags */
+ MK_ARRAY(TYPE_CHAR, 64), /* lo_name */
+ MK_ARRAY(TYPE_CHAR, 64), /* lo_crypt_name */
+ MK_ARRAY(TYPE_CHAR, 32), /* lo_encrypt_key */
+ MK_ARRAY(TYPE_ULONGLONG, 2)) /* lo_init */