qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] linux-user: Add support for fs and fd ioctls
@ 2020-01-24 15:47 Aleksandar Markovic
  2020-01-24 15:47 ` [PATCH v2 1/4] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Aleksandar Markovic @ 2020-01-24 15:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

This series is a spin-off of v5 of earlier series "linux-user: Misc
patches for 5.0", that became too large to manage. I will submit the
rest of that large series separately.

The only difference between patches in this series and in the former
series is that all Laurent's comments and concerns were addressed.

The summary of the patches is as follows:

Patches 1-3: Adding support for some filesystem-related ioctls
Patch 4: Adding support for a floppy-drive-related ioctls

v1->v2:

  - removed patches that have been already merged
  - recheck that I addressed all Laurent's concerns
  - rebased to the latest upstram code

Aleksandar Markovic (4):
  linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls
  linux-user: Add support for FITRIM ioctl
  linux-user: Add support for FIFREEZE and FITHAW ioctls
  linux-user: Add support for FDGETFDCSTAT ioctl

 linux-user/ioctls.h        | 18 ++++++++++++++++++
 linux-user/syscall_defs.h  | 29 +++++++++++++++++++++++++++++
 linux-user/syscall_types.h | 17 +++++++++++++++++
 3 files changed, 64 insertions(+)

-- 
2.7.4



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

* [PATCH v2 1/4] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls
  2020-01-24 15:47 [PATCH v2 0/4] linux-user: Add support for fs and fd ioctls Aleksandar Markovic
@ 2020-01-24 15:47 ` Aleksandar Markovic
  2020-02-18 20:47   ` Laurent Vivier
  2020-01-24 15:47 ` [PATCH v2 2/4] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Aleksandar Markovic @ 2020-01-24 15:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Both FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR accept a pointer to
the structure

struct fsxattr {
    __u32         fsx_xflags;     /* xflags field value (get/set) */
    __u32         fsx_extsize;    /* extsize field value (get/set)*/
    __u32         fsx_nextents;   /* nextents field value (get)	*/
    __u32         fsx_projid;     /* project identifier (get/set) */
    __u32         fsx_cowextsize; /* CoW extsize field value (get/set)*/
    unsigned char fsx_pad[8];
};

as their third argument.

These ioctls were relatively recently introduced, so the "#ifdef"
guards are used in this implementation.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 7 +++++++
 linux-user/syscall_defs.h | 6 ++++++
 2 files changed, 13 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 73dcc76..9fb9d6f 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -173,6 +173,13 @@
      IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
      IOCTL(FS_IOC32_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
      IOCTL(FS_IOC32_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
+#ifdef FS_IOC_FSGETXATTR
+     IOCTL(FS_IOC_FSGETXATTR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fsxattr)))
+#endif
+#ifdef FS_IOC_FSSETXATTR
+     IOCTL(FS_IOC_FSSETXATTR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fsxattr)))
+#endif
+
 
 #ifdef CONFIG_USBFS
   /* USB ioctls */
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 9b61ae8..ed5068f 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -966,6 +966,12 @@ struct target_rtc_pll_info {
 #define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int)
 #define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int)
 #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
+#ifdef FS_IOC_FSGETXATTR
+#define TARGET_FS_IOC_FSGETXATTR TARGET_IOR('X', 31, struct fsxattr)
+#endif
+#ifdef FS_IOC_FSSETXATTR
+#define TARGET_FS_IOC_FSSETXATTR TARGET_IOR('X', 32, struct fsxattr)
+#endif
 
 /* usb ioctls */
 #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
-- 
2.7.4



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

* [PATCH v2 2/4] linux-user: Add support for FITRIM ioctl
  2020-01-24 15:47 [PATCH v2 0/4] linux-user: Add support for fs and fd ioctls Aleksandar Markovic
  2020-01-24 15:47 ` [PATCH v2 1/4] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
@ 2020-01-24 15:47 ` Aleksandar Markovic
  2020-02-18 20:53   ` Laurent Vivier
  2020-01-24 15:47 ` [PATCH v2 3/4] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
  2020-01-24 15:47 ` [PATCH v2 4/4] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
  3 siblings, 1 reply; 10+ messages in thread
From: Aleksandar Markovic @ 2020-01-24 15:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

FITRIM ioctl accepts a pointer to the structure

struct fstrim_range {
    __u64 start;
    __u64 len;
    __u64 minlen;
};

as its third argument.

All ioctls in this group (FI* ioctl) are guarded with "#ifdef", so the
guards are used in this implementation too for consistency (however,
many of ioctls in FI* group became old enough that their #ifdef guards
could be removed, bit this is out of the scope of this patch).

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h        | 3 +++
 linux-user/syscall_defs.h  | 1 +
 linux-user/syscall_types.h | 5 +++++
 3 files changed, 9 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 9fb9d6f..944fbeb 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -152,6 +152,9 @@
 #ifdef FIBMAP
      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
 #endif
+#ifdef FITRIM
+     IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range)))
+#endif
 #ifdef FICLONE
      IOCTL(FICLONE, IOC_W, TYPE_INT)
      IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index ed5068f..8761841 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -950,6 +950,7 @@ struct target_rtc_pll_info {
 #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_FITRIM     TARGET_IOWR('X', 121, struct fstrim_range)
 #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
 #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
 
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index 5ba4155..dfd7608 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -226,6 +226,11 @@ STRUCT(dm_target_versions,
 STRUCT(dm_target_msg,
        TYPE_ULONGLONG) /* sector */
 
+STRUCT(fstrim_range,
+       TYPE_LONGLONG, /* start */
+       TYPE_LONGLONG, /* len */
+       TYPE_LONGLONG) /* minlen */
+
 STRUCT(file_clone_range,
        TYPE_LONGLONG, /* src_fd */
        TYPE_ULONGLONG, /* src_offset */
-- 
2.7.4



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

* [PATCH v2 3/4] linux-user: Add support for FIFREEZE and FITHAW ioctls
  2020-01-24 15:47 [PATCH v2 0/4] linux-user: Add support for fs and fd ioctls Aleksandar Markovic
  2020-01-24 15:47 ` [PATCH v2 1/4] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
  2020-01-24 15:47 ` [PATCH v2 2/4] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
@ 2020-01-24 15:47 ` Aleksandar Markovic
  2020-02-18 21:13   ` Laurent Vivier
  2020-01-24 15:47 ` [PATCH v2 4/4] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
  3 siblings, 1 reply; 10+ messages in thread
From: Aleksandar Markovic @ 2020-01-24 15:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

Both FIFREEZE and FITHAW ioctls accept an integer as their third
argument.

All ioctls in this group (FI* ioctl) are guarded with "#ifdef", so the
guards are used in this implementation too for consistency (however,
many of ioctls in FI* group became old enough that their #ifdef guards
could be removed, bit this is out of the scope of this patch).

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h       | 6 ++++++
 linux-user/syscall_defs.h | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 944fbeb..adc07ad 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -152,6 +152,12 @@
 #ifdef FIBMAP
      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
 #endif
+#ifdef FIFREEZE
+     IOCTL(FIFREEZE, IOC_W | IOC_R, TYPE_INT)
+#endif
+#ifdef FITHAW
+     IOCTL(FITHAW, IOC_W | IOC_R, TYPE_INT)
+#endif
 #ifdef FITRIM
      IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range)))
 #endif
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 8761841..ae4c048 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -950,7 +950,11 @@ struct target_rtc_pll_info {
 #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_FIFREEZE   TARGET_IOWR('X', 119, int)    /* Freeze */
+#define TARGET_FITHAW     TARGET_IOWR('X', 120, int)    /* Thaw */
+#ifdef FITRIM
 #define TARGET_FITRIM     TARGET_IOWR('X', 121, struct fstrim_range)
+#endif
 #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
 #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
 
-- 
2.7.4



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

* [PATCH v2 4/4] linux-user: Add support for FDGETFDCSTAT ioctl
  2020-01-24 15:47 [PATCH v2 0/4] linux-user: Add support for fs and fd ioctls Aleksandar Markovic
                   ` (2 preceding siblings ...)
  2020-01-24 15:47 ` [PATCH v2 3/4] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
@ 2020-01-24 15:47 ` Aleksandar Markovic
  2020-02-18 21:18   ` Laurent Vivier
  3 siblings, 1 reply; 10+ messages in thread
From: Aleksandar Markovic @ 2020-01-24 15:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent, amarkovic

From: Aleksandar Markovic <amarkovic@wavecomp.com>

FDGETFDCSTAT's third agrument is a pointer to the structure:

struct floppy_fdc_state {
    int spec1;
    int spec2;
    int dtr;
    unsigned char version;
    unsigned char dor;
    unsigned long address;
    unsigned int rawcmd:2;
    unsigned int reset:1;
    unsigned int need_configure:1;
    unsigned int perp_mode:2;
    unsigned int has_fifo:1;
    unsigned int driver_version;
    unsigned char track[4];
};

defined in Linux kernel header <linux/fd.h>.

Since there is a fields of the structure of type 'unsigned long', there is
a need to define "target_format_descr". Also, five fields rawcmd, reset,
need_configure, perp_mode, and has_fifo are all just bitfields and are
part od a single 'unsigned int' field.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
---
 linux-user/ioctls.h        |  2 ++
 linux-user/syscall_defs.h  | 18 ++++++++++++++++++
 linux-user/syscall_types.h | 12 ++++++++++++
 3 files changed, 32 insertions(+)

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index adc07ad..b3bbe6a 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -145,6 +145,8 @@
      IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
      IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
      IOCTL(FDRESET, 0, TYPE_NULL)
+     IOCTL(FDGETFDCSTAT, IOC_R,
+           MK_PTR(MK_STRUCT(STRUCT_target_floppy_fdc_state)))
      IOCTL(FDRAWCMD, 0, TYPE_NULL)
      IOCTL(FDTWADDLE, 0, TYPE_NULL)
      IOCTL(FDEJECT, 0, TYPE_NULL)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index ae4c048..e08e5bc 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -933,6 +933,23 @@ struct target_rtc_pll_info {
 
 /* From <linux/fd.h> */
 
+struct target_floppy_fdc_state {
+    int spec1;                      /* spec1 value last used */
+    int spec2;                      /* spec2 value last used */
+    int dtr;
+    unsigned char version;          /* FDC version code */
+    unsigned char dor;
+    abi_ulong address;              /* io address */
+    unsigned int rawcmd:2;
+    unsigned int reset:1;
+    unsigned int need_configure:1;
+    unsigned int perp_mode:2;
+    unsigned int has_fifo:1;
+    unsigned int driver_version;    /* version code for floppy driver */
+    unsigned char track[4];
+};
+
+
 #define TARGET_FDMSGON        TARGET_IO(2, 0x45)
 #define TARGET_FDMSGOFF       TARGET_IO(2, 0x46)
 #define TARGET_FDFMTBEG       TARGET_IO(2, 0x47)
@@ -943,6 +960,7 @@ struct target_rtc_pll_info {
 #define TARGET_FDSETMAXERRS  TARGET_IOW(2, 0x4c, struct floppy_max_errors)
 #define TARGET_FDGETMAXERRS  TARGET_IOR(2, 0x0e, struct floppy_max_errors)
 #define TARGET_FDRESET        TARGET_IO(2, 0x54)
+#define TARGET_FDGETFDCSTAT  TARGET_IOR(2, 0x15, struct target_floppy_fdc_state)
 #define TARGET_FDRAWCMD       TARGET_IO(2, 0x58)
 #define TARGET_FDTWADDLE      TARGET_IO(2, 0x59)
 #define TARGET_FDEJECT        TARGET_IO(2, 0x5a)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index dfd7608..e8f8984 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -303,6 +303,18 @@ STRUCT(floppy_max_errors,
        TYPE_INT, /* recal */
        TYPE_INT) /* reporting */
 
+STRUCT(target_floppy_fdc_state,
+       TYPE_INT, /* spec1 */
+       TYPE_INT, /* spec2 */
+       TYPE_INT, /* dtr */
+       TYPE_CHAR, /* version */
+       TYPE_CHAR, /* dor */
+       TYPE_ULONG, /* address */
+       TYPE_INT, /* bit field for rawcmd:2, reset:1, need_configure:1, */
+                 /* perp_mode:2, and has_fifo:1 */
+       TYPE_INT, /* driver_version */
+       MK_ARRAY(TYPE_CHAR, 4)) /* track */
+
 #if defined(CONFIG_USBFS)
 /* usb device ioctls */
 STRUCT(usbdevfs_ctrltransfer,
-- 
2.7.4



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

* Re: [PATCH v2 1/4] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls
  2020-01-24 15:47 ` [PATCH v2 1/4] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
@ 2020-02-18 20:47   ` Laurent Vivier
  0 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2020-02-18 20:47 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 24/01/2020 à 16:47, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Both FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR accept a pointer to
> the structure
> 
> struct fsxattr {
>     __u32         fsx_xflags;     /* xflags field value (get/set) */
>     __u32         fsx_extsize;    /* extsize field value (get/set)*/
>     __u32         fsx_nextents;   /* nextents field value (get)	*/
>     __u32         fsx_projid;     /* project identifier (get/set) */
>     __u32         fsx_cowextsize; /* CoW extsize field value (get/set)*/
>     unsigned char fsx_pad[8];
> };
> 
> as their third argument.
> 
> These ioctls were relatively recently introduced, so the "#ifdef"
> guards are used in this implementation.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 7 +++++++
>  linux-user/syscall_defs.h | 6 ++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 73dcc76..9fb9d6f 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -173,6 +173,13 @@
>       IOCTL(FS_IOC32_SETFLAGS, IOC_W, MK_PTR(TYPE_INT))
>       IOCTL(FS_IOC32_GETVERSION, IOC_R, MK_PTR(TYPE_INT))
>       IOCTL(FS_IOC32_SETVERSION, IOC_W, MK_PTR(TYPE_INT))
> +#ifdef FS_IOC_FSGETXATTR
> +     IOCTL(FS_IOC_FSGETXATTR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fsxattr)))

kernel declares that as IOC_R

> +#endif
> +#ifdef FS_IOC_FSSETXATTR
> +     IOCTL(FS_IOC_FSSETXATTR, IOC_W, MK_PTR(MK_STRUCT(STRUCT_fsxattr)))
> +#endif
> +
>  
>  #ifdef CONFIG_USBFS
>    /* USB ioctls */
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 9b61ae8..ed5068f 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -966,6 +966,12 @@ struct target_rtc_pll_info {
>  #define TARGET_FS_IOC32_SETFLAGS TARGET_IOW('f', 2, int)
>  #define TARGET_FS_IOC32_GETVERSION TARGET_IOR('v', 1, int)
>  #define TARGET_FS_IOC32_SETVERSION TARGET_IOW('v', 2, int)
> +#ifdef FS_IOC_FSGETXATTR
> +#define TARGET_FS_IOC_FSGETXATTR TARGET_IOR('X', 31, struct fsxattr)
> +#endif
> +#ifdef FS_IOC_FSSETXATTR
> +#define TARGET_FS_IOC_FSSETXATTR TARGET_IOR('X', 32, struct fsxattr)

kernel declares that as _IOW

> +#endif
>  
>  /* usb ioctls */
>  #define TARGET_USBDEVFS_CONTROL TARGET_IOWRU('U', 0)
> 

where is defined STRUCT(fsxattr, ...)?

Thanks,
Laurent


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

* Re: [PATCH v2 2/4] linux-user: Add support for FITRIM ioctl
  2020-01-24 15:47 ` [PATCH v2 2/4] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
@ 2020-02-18 20:53   ` Laurent Vivier
  2020-02-18 20:55     ` Laurent Vivier
  0 siblings, 1 reply; 10+ messages in thread
From: Laurent Vivier @ 2020-02-18 20:53 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 24/01/2020 à 16:47, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> FITRIM ioctl accepts a pointer to the structure
> 
> struct fstrim_range {
>     __u64 start;
>     __u64 len;
>     __u64 minlen;
> };
> 
> as its third argument.
> 
> All ioctls in this group (FI* ioctl) are guarded with "#ifdef", so the
> guards are used in this implementation too for consistency (however,
> many of ioctls in FI* group became old enough that their #ifdef guards
> could be removed, bit this is out of the scope of this patch).
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h        | 3 +++
>  linux-user/syscall_defs.h  | 1 +
>  linux-user/syscall_types.h | 5 +++++
>  3 files changed, 9 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 9fb9d6f..944fbeb 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -152,6 +152,9 @@
>  #ifdef FIBMAP
>       IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
>  #endif
> +#ifdef FITRIM
> +     IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range)))
> +#endif
>  #ifdef FICLONE
>       IOCTL(FICLONE, IOC_W, TYPE_INT)
>       IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index ed5068f..8761841 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -950,6 +950,7 @@ struct target_rtc_pll_info {
>  #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_FITRIM     TARGET_IOWR('X', 121, struct fstrim_range)
>  #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
>  #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
>  
> diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
> index 5ba4155..dfd7608 100644
> --- a/linux-user/syscall_types.h
> +++ b/linux-user/syscall_types.h
> @@ -226,6 +226,11 @@ STRUCT(dm_target_versions,
>  STRUCT(dm_target_msg,
>         TYPE_ULONGLONG) /* sector */
>  
> +STRUCT(fstrim_range,
> +       TYPE_LONGLONG, /* start */
> +       TYPE_LONGLONG, /* len */
> +       TYPE_LONGLONG) /* minlen */

they are __u64, use TYPE_ULONGLONG.

With that changed, you can add my:

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



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

* Re: [PATCH v2 2/4] linux-user: Add support for FITRIM ioctl
  2020-02-18 20:53   ` Laurent Vivier
@ 2020-02-18 20:55     ` Laurent Vivier
  0 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2020-02-18 20:55 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 18/02/2020 à 21:53, Laurent Vivier a écrit :
> Le 24/01/2020 à 16:47, Aleksandar Markovic a écrit :
>> From: Aleksandar Markovic <amarkovic@wavecomp.com>
>>
>> FITRIM ioctl accepts a pointer to the structure
>>
>> struct fstrim_range {
>>     __u64 start;
>>     __u64 len;
>>     __u64 minlen;
>> };
>>
>> as its third argument.
>>
>> All ioctls in this group (FI* ioctl) are guarded with "#ifdef", so the
>> guards are used in this implementation too for consistency (however,
>> many of ioctls in FI* group became old enough that their #ifdef guards
>> could be removed, bit this is out of the scope of this patch).
>>
>> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
>> ---
>>  linux-user/ioctls.h        | 3 +++
>>  linux-user/syscall_defs.h  | 1 +
>>  linux-user/syscall_types.h | 5 +++++
>>  3 files changed, 9 insertions(+)
>>
>> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
>> index 9fb9d6f..944fbeb 100644
>> --- a/linux-user/ioctls.h
>> +++ b/linux-user/ioctls.h
>> @@ -152,6 +152,9 @@
>>  #ifdef FIBMAP
>>       IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
>>  #endif
>> +#ifdef FITRIM
>> +     IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range)))
>> +#endif
>>  #ifdef FICLONE
>>       IOCTL(FICLONE, IOC_W, TYPE_INT)
>>       IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
>> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
>> index ed5068f..8761841 100644
>> --- a/linux-user/syscall_defs.h
>> +++ b/linux-user/syscall_defs.h
>> @@ -950,6 +950,7 @@ struct target_rtc_pll_info {
>>  #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_FITRIM     TARGET_IOWR('X', 121, struct fstrim_range)

You need also the "#ifdef" that is in the next patch.

>>  #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
>>  #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
>>  
>> diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
>> index 5ba4155..dfd7608 100644
>> --- a/linux-user/syscall_types.h
>> +++ b/linux-user/syscall_types.h
>> @@ -226,6 +226,11 @@ STRUCT(dm_target_versions,
>>  STRUCT(dm_target_msg,
>>         TYPE_ULONGLONG) /* sector */
>>  
>> +STRUCT(fstrim_range,
>> +       TYPE_LONGLONG, /* start */
>> +       TYPE_LONGLONG, /* len */
>> +       TYPE_LONGLONG) /* minlen */
> 
> they are __u64, use TYPE_ULONGLONG.
> 
> With that changed, you can add my:
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> 
> 



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

* Re: [PATCH v2 3/4] linux-user: Add support for FIFREEZE and FITHAW ioctls
  2020-01-24 15:47 ` [PATCH v2 3/4] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
@ 2020-02-18 21:13   ` Laurent Vivier
  0 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2020-02-18 21:13 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 24/01/2020 à 16:47, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> Both FIFREEZE and FITHAW ioctls accept an integer as their third
> argument.
> 
> All ioctls in this group (FI* ioctl) are guarded with "#ifdef", so the
> guards are used in this implementation too for consistency (however,
> many of ioctls in FI* group became old enough that their #ifdef guards
> could be removed, bit this is out of the scope of this patch).

They have been added in v2.6.29

Could you add this information coming from the kernel commit adding them:

   o Freeze the filesystem
      int ioctl(int fd, int FIFREEZE, arg)
        fd: The file descriptor of the mountpoint
        FIFREEZE: request code for the freeze
        arg: Ignored
        Return value: 0 if the operation succeeds. Otherwise, -1

    o Unfreeze the filesystem
      int ioctl(int fd, int FITHAW, arg)
        fd: The file descriptor of the mountpoint
        FITHAW: request code for unfreeze
        arg: Ignored
        Return value: 0 if the operation succeeds. Otherwise, -1
        Error number: If the filesystem has already been unfrozen,
                      errno is set to EINVAL.

> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h       | 6 ++++++
>  linux-user/syscall_defs.h | 4 ++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index 944fbeb..adc07ad 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -152,6 +152,12 @@
>  #ifdef FIBMAP
>       IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
>  #endif
> +#ifdef FIFREEZE
> +     IOCTL(FIFREEZE, IOC_W | IOC_R, TYPE_INT)
> +#endif
> +#ifdef FITHAW
> +     IOCTL(FITHAW, IOC_W | IOC_R, TYPE_INT)
> +#endif
>  #ifdef FITRIM
>       IOCTL(FITRIM, IOC_W | IOC_R, MK_PTR(MK_STRUCT(STRUCT_fstrim_range)))
>  #endif
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index 8761841..ae4c048 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -950,7 +950,11 @@ struct target_rtc_pll_info {
>  #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_FIFREEZE   TARGET_IOWR('X', 119, int)    /* Freeze */
> +#define TARGET_FITHAW     TARGET_IOWR('X', 120, int)    /* Thaw */
> +#ifdef FITRIM
>  #define TARGET_FITRIM     TARGET_IOWR('X', 121, struct fstrim_range)
> +#endif

move "#ifdef FITRIM" to previous patch.

>  #define TARGET_FICLONE    TARGET_IOW(0x94, 9, int)
>  #define TARGET_FICLONERANGE TARGET_IOW(0x94, 13, struct file_clone_range)
>  
> 



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

* Re: [PATCH v2 4/4] linux-user: Add support for FDGETFDCSTAT ioctl
  2020-01-24 15:47 ` [PATCH v2 4/4] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
@ 2020-02-18 21:18   ` Laurent Vivier
  0 siblings, 0 replies; 10+ messages in thread
From: Laurent Vivier @ 2020-02-18 21:18 UTC (permalink / raw)
  To: Aleksandar Markovic, qemu-devel; +Cc: amarkovic

Le 24/01/2020 à 16:47, Aleksandar Markovic a écrit :
> From: Aleksandar Markovic <amarkovic@wavecomp.com>
> 
> FDGETFDCSTAT's third agrument is a pointer to the structure:
> 
> struct floppy_fdc_state {
>     int spec1;
>     int spec2;
>     int dtr;
>     unsigned char version;
>     unsigned char dor;
>     unsigned long address;
>     unsigned int rawcmd:2;
>     unsigned int reset:1;
>     unsigned int need_configure:1;
>     unsigned int perp_mode:2;
>     unsigned int has_fifo:1;
>     unsigned int driver_version;
>     unsigned char track[4];
> };
> 
> defined in Linux kernel header <linux/fd.h>.
> 
> Since there is a fields of the structure of type 'unsigned long', there is
> a need to define "target_format_descr". Also, five fields rawcmd, reset,
> need_configure, perp_mode, and has_fifo are all just bitfields and are
> part od a single 'unsigned int' field.
> 
> Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
> ---
>  linux-user/ioctls.h        |  2 ++
>  linux-user/syscall_defs.h  | 18 ++++++++++++++++++
>  linux-user/syscall_types.h | 12 ++++++++++++
>  3 files changed, 32 insertions(+)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index adc07ad..b3bbe6a 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -145,6 +145,8 @@
>       IOCTL(FDSETMAXERRS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
>       IOCTL(FDGETMAXERRS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_floppy_max_errors)))
>       IOCTL(FDRESET, 0, TYPE_NULL)
> +     IOCTL(FDGETFDCSTAT, IOC_R,
> +           MK_PTR(MK_STRUCT(STRUCT_target_floppy_fdc_state)))
>       IOCTL(FDRAWCMD, 0, TYPE_NULL)
>       IOCTL(FDTWADDLE, 0, TYPE_NULL)
>       IOCTL(FDEJECT, 0, TYPE_NULL)
> diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
> index ae4c048..e08e5bc 100644
> --- a/linux-user/syscall_defs.h
> +++ b/linux-user/syscall_defs.h
> @@ -933,6 +933,23 @@ struct target_rtc_pll_info {
>  
>  /* From <linux/fd.h> */
>  
> +struct target_floppy_fdc_state {
> +    int spec1;                      /* spec1 value last used */
> +    int spec2;                      /* spec2 value last used */
> +    int dtr;
> +    unsigned char version;          /* FDC version code */
> +    unsigned char dor;
> +    abi_ulong address;              /* io address */
> +    unsigned int rawcmd:2;
> +    unsigned int reset:1;
> +    unsigned int need_configure:1;
> +    unsigned int perp_mode:2;
> +    unsigned int has_fifo:1;
> +    unsigned int driver_version;    /* version code for floppy driver */
> +    unsigned char track[4];
> +};
> +

use abi_int/abi_uint rather than "int/unsigned int".

Thanks,
Laurent


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

end of thread, other threads:[~2020-02-18 21:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24 15:47 [PATCH v2 0/4] linux-user: Add support for fs and fd ioctls Aleksandar Markovic
2020-01-24 15:47 ` [PATCH v2 1/4] linux-user: Add support for FS_IOC_FS<GET|SET>XATTR ioctls Aleksandar Markovic
2020-02-18 20:47   ` Laurent Vivier
2020-01-24 15:47 ` [PATCH v2 2/4] linux-user: Add support for FITRIM ioctl Aleksandar Markovic
2020-02-18 20:53   ` Laurent Vivier
2020-02-18 20:55     ` Laurent Vivier
2020-01-24 15:47 ` [PATCH v2 3/4] linux-user: Add support for FIFREEZE and FITHAW ioctls Aleksandar Markovic
2020-02-18 21:13   ` Laurent Vivier
2020-01-24 15:47 ` [PATCH v2 4/4] linux-user: Add support for FDGETFDCSTAT ioctl Aleksandar Markovic
2020-02-18 21:18   ` 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).