All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gary Thomas <gary@mlbassoc.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Add loop device ioctls
Date: Mon, 17 Mar 2008 11:09:31 -0600	[thread overview]
Message-ID: <47DEA5CB.5090901@mlbassoc.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

These changes add the ioctl() calls used by loop devices.

Note: using Thunderbird, it seems much easier to attach files
than include them inline.  Most email readers will still show
them (AFAIK)

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 3585 bytes --]

Index: linux-user/syscall_types.h
===================================================================
--- linux-user/syscall_types.h	(revision 4113)
+++ linux-user/syscall_types.h	(revision 4114)
@@ -79,3 +79,33 @@
 
 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 */
+    )
Index: linux-user/syscall.c
===================================================================
--- linux-user/syscall.c	(revision 4113)
+++ linux-user/syscall.c	(revision 4114)
@@ -68,6 +68,7 @@
 #include <linux/soundcard.h>
 #include <linux/dirent.h>
 #include <linux/kd.h>
+#include <linux/loop.h>
 
 #include "qemu.h"
 
Index: linux-user/ioctls.h
===================================================================
--- linux-user/ioctls.h	(revision 4113)
+++ linux-user/ioctls.h	(revision 4114)
@@ -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)
Index: linux-user/syscall_defs.h
===================================================================
--- linux-user/syscall_defs.h	(revision 4113)
+++ linux-user/syscall_defs.h	(revision 4114)
@@ -830,7 +830,16 @@
 #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 */
 
 #define TARGET_NCC 8

                 reply	other threads:[~2008-03-17 17:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=47DEA5CB.5090901@mlbassoc.com \
    --to=gary@mlbassoc.com \
    --cc=qemu-devel@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.