diff mbox series

[2/4] linux-user: remove conditionals for many fs.h ioctls

Message ID 20221004093206.652431-3-berrange@redhat.com
State New
Headers show
Series linux-user: fix regression with some ioctls with newest glibc | expand

Commit Message

Daniel P. Berrangé Oct. 4, 2022, 9:32 a.m. UTC
These ioctls have been defined in linux/fs.h for a long time

  * BLKGETSIZE64 - <2.6.12 (linux.git epoch)
  * BLKDISCARD - 2.6.28 (d30a2605be9d5132d95944916e8f578fcfe4f976)
  * BLKIOMIN - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
  * BLKIOOPT - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
  * BLKALIGNOFF - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
  * BLKPBSZGET - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
  * BLKDISCARDZEROES - 2.6.32 (98262f2762f0067375f83824d81ea929e37e6bfe)
  * BLKSECDISCARD - 2.6.36 (8d57a98ccd0b4489003473979da8f5a1363ba7a3)
  * BLKROTATIONAL - 3.2 (ef00f59c95fe6e002e7c6e3663cdea65e253f4cc)
  * BLKZEROOUT - 3.6 (66ba32dc167202c3cf8c86806581a9393ec7f488)
  * FIBMAP - <2.6.12 (linux.git epoch)
  * FIGETBSZ - <2.6.12 (linux.git epoch)

and when building with latest glibc, we'll see compat definitions
in syscall.c anyway thanks to the previous patch. Thus we can
assume they always exist and remove the conditional checks.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 linux-user/ioctls.h | 24 ------------------------
 1 file changed, 24 deletions(-)

Comments

Laurent Vivier Oct. 21, 2022, 2:21 p.m. UTC | #1
Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> These ioctls have been defined in linux/fs.h for a long time
> 
>    * BLKGETSIZE64 - <2.6.12 (linux.git epoch)
>    * BLKDISCARD - 2.6.28 (d30a2605be9d5132d95944916e8f578fcfe4f976)
>    * BLKIOMIN - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
>    * BLKIOOPT - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
>    * BLKALIGNOFF - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
>    * BLKPBSZGET - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
>    * BLKDISCARDZEROES - 2.6.32 (98262f2762f0067375f83824d81ea929e37e6bfe)
>    * BLKSECDISCARD - 2.6.36 (8d57a98ccd0b4489003473979da8f5a1363ba7a3)
>    * BLKROTATIONAL - 3.2 (ef00f59c95fe6e002e7c6e3663cdea65e253f4cc)
>    * BLKZEROOUT - 3.6 (66ba32dc167202c3cf8c86806581a9393ec7f488)
>    * FIBMAP - <2.6.12 (linux.git epoch)
>    * FIGETBSZ - <2.6.12 (linux.git epoch)
> 
> and when building with latest glibc, we'll see compat definitions
> in syscall.c anyway thanks to the previous patch. Thus we can
> assume they always exist and remove the conditional checks.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   linux-user/ioctls.h | 24 ------------------------
>   1 file changed, 24 deletions(-)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index f182d40190..071f7ca253 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -96,9 +96,7 @@
>        IOCTL(BLKROGET, IOC_R, MK_PTR(TYPE_INT))
>        IOCTL(BLKRRPART, 0, TYPE_NULL)
>        IOCTL(BLKGETSIZE, IOC_R, MK_PTR(TYPE_ULONG))
> -#ifdef BLKGETSIZE64
>        IOCTL(BLKGETSIZE64, IOC_R, MK_PTR(TYPE_ULONGLONG))
> -#endif
>        IOCTL(BLKFLSBUF, 0, TYPE_NULL)
>        IOCTL(BLKRASET, 0, TYPE_INT)
>        IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
> @@ -107,33 +105,15 @@
>        IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg,
>                      MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg)))
>   
> -#ifdef BLKDISCARD
>        IOCTL(BLKDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
> -#ifdef BLKIOMIN
>        IOCTL(BLKIOMIN, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKIOOPT
>        IOCTL(BLKIOOPT, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKALIGNOFF
>        IOCTL(BLKALIGNOFF, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKPBSZGET
>        IOCTL(BLKPBSZGET, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKDISCARDZEROES
>        IOCTL(BLKDISCARDZEROES, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKSECDISCARD
>        IOCTL(BLKSECDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
> -#ifdef BLKROTATIONAL
>        IOCTL(BLKROTATIONAL, IOC_R, MK_PTR(TYPE_SHORT))
> -#endif
> -#ifdef BLKZEROOUT
>        IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
>   
>        IOCTL(FDMSGON, 0, TYPE_NULL)
>        IOCTL(FDMSGOFF, 0, TYPE_NULL)
> @@ -149,17 +129,13 @@
>        IOCTL(FDTWADDLE, 0, TYPE_NULL)
>        IOCTL(FDEJECT, 0, TYPE_NULL)
>   
> -#ifdef FIBMAP
>        IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
> -#endif
>   #ifdef FICLONE
>        IOCTL(FICLONE, IOC_W, TYPE_INT)
>        IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
>   #endif
>   
> -#ifdef FIGETBSZ
>        IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
> -#endif
>   #ifdef CONFIG_FIEMAP
>        IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
>                      MK_PTR(MK_STRUCT(STRUCT_fiemap)))

Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Laurent Vivier Oct. 21, 2022, 3:17 p.m. UTC | #2
Le 04/10/2022 à 11:32, Daniel P. Berrangé a écrit :
> These ioctls have been defined in linux/fs.h for a long time
> 
>    * BLKGETSIZE64 - <2.6.12 (linux.git epoch)
>    * BLKDISCARD - 2.6.28 (d30a2605be9d5132d95944916e8f578fcfe4f976)
>    * BLKIOMIN - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
>    * BLKIOOPT - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
>    * BLKALIGNOFF - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
>    * BLKPBSZGET - 2.6.32 (ac481c20ef8f6c6f2be75d581863f40c43874ef7)
>    * BLKDISCARDZEROES - 2.6.32 (98262f2762f0067375f83824d81ea929e37e6bfe)
>    * BLKSECDISCARD - 2.6.36 (8d57a98ccd0b4489003473979da8f5a1363ba7a3)
>    * BLKROTATIONAL - 3.2 (ef00f59c95fe6e002e7c6e3663cdea65e253f4cc)
>    * BLKZEROOUT - 3.6 (66ba32dc167202c3cf8c86806581a9393ec7f488)
>    * FIBMAP - <2.6.12 (linux.git epoch)
>    * FIGETBSZ - <2.6.12 (linux.git epoch)
> 
> and when building with latest glibc, we'll see compat definitions
> in syscall.c anyway thanks to the previous patch. Thus we can
> assume they always exist and remove the conditional checks.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   linux-user/ioctls.h | 24 ------------------------
>   1 file changed, 24 deletions(-)
> 
> diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
> index f182d40190..071f7ca253 100644
> --- a/linux-user/ioctls.h
> +++ b/linux-user/ioctls.h
> @@ -96,9 +96,7 @@
>        IOCTL(BLKROGET, IOC_R, MK_PTR(TYPE_INT))
>        IOCTL(BLKRRPART, 0, TYPE_NULL)
>        IOCTL(BLKGETSIZE, IOC_R, MK_PTR(TYPE_ULONG))
> -#ifdef BLKGETSIZE64
>        IOCTL(BLKGETSIZE64, IOC_R, MK_PTR(TYPE_ULONGLONG))
> -#endif
>        IOCTL(BLKFLSBUF, 0, TYPE_NULL)
>        IOCTL(BLKRASET, 0, TYPE_INT)
>        IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
> @@ -107,33 +105,15 @@
>        IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg,
>                      MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg)))
>   
> -#ifdef BLKDISCARD
>        IOCTL(BLKDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
> -#ifdef BLKIOMIN
>        IOCTL(BLKIOMIN, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKIOOPT
>        IOCTL(BLKIOOPT, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKALIGNOFF
>        IOCTL(BLKALIGNOFF, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKPBSZGET
>        IOCTL(BLKPBSZGET, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKDISCARDZEROES
>        IOCTL(BLKDISCARDZEROES, IOC_R, MK_PTR(TYPE_INT))
> -#endif
> -#ifdef BLKSECDISCARD
>        IOCTL(BLKSECDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
> -#ifdef BLKROTATIONAL
>        IOCTL(BLKROTATIONAL, IOC_R, MK_PTR(TYPE_SHORT))
> -#endif
> -#ifdef BLKZEROOUT
>        IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
> -#endif
>   
>        IOCTL(FDMSGON, 0, TYPE_NULL)
>        IOCTL(FDMSGOFF, 0, TYPE_NULL)
> @@ -149,17 +129,13 @@
>        IOCTL(FDTWADDLE, 0, TYPE_NULL)
>        IOCTL(FDEJECT, 0, TYPE_NULL)
>   
> -#ifdef FIBMAP
>        IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
> -#endif
>   #ifdef FICLONE
>        IOCTL(FICLONE, IOC_W, TYPE_INT)
>        IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
>   #endif
>   
> -#ifdef FIGETBSZ
>        IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
> -#endif
>   #ifdef CONFIG_FIEMAP
>        IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
>                      MK_PTR(MK_STRUCT(STRUCT_fiemap)))

Applied to my linux-user-for-7.2 branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index f182d40190..071f7ca253 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -96,9 +96,7 @@ 
      IOCTL(BLKROGET, IOC_R, MK_PTR(TYPE_INT))
      IOCTL(BLKRRPART, 0, TYPE_NULL)
      IOCTL(BLKGETSIZE, IOC_R, MK_PTR(TYPE_ULONG))
-#ifdef BLKGETSIZE64
      IOCTL(BLKGETSIZE64, IOC_R, MK_PTR(TYPE_ULONGLONG))
-#endif
      IOCTL(BLKFLSBUF, 0, TYPE_NULL)
      IOCTL(BLKRASET, 0, TYPE_INT)
      IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
@@ -107,33 +105,15 @@ 
      IOCTL_SPECIAL(BLKPG, IOC_W, do_ioctl_blkpg,
                    MK_PTR(MK_STRUCT(STRUCT_blkpg_ioctl_arg)))
 
-#ifdef BLKDISCARD
      IOCTL(BLKDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
-#endif
-#ifdef BLKIOMIN
      IOCTL(BLKIOMIN, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKIOOPT
      IOCTL(BLKIOOPT, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKALIGNOFF
      IOCTL(BLKALIGNOFF, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKPBSZGET
      IOCTL(BLKPBSZGET, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKDISCARDZEROES
      IOCTL(BLKDISCARDZEROES, IOC_R, MK_PTR(TYPE_INT))
-#endif
-#ifdef BLKSECDISCARD
      IOCTL(BLKSECDISCARD, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
-#endif
-#ifdef BLKROTATIONAL
      IOCTL(BLKROTATIONAL, IOC_R, MK_PTR(TYPE_SHORT))
-#endif
-#ifdef BLKZEROOUT
      IOCTL(BLKZEROOUT, IOC_W, MK_PTR(MK_ARRAY(TYPE_ULONGLONG, 2)))
-#endif
 
      IOCTL(FDMSGON, 0, TYPE_NULL)
      IOCTL(FDMSGOFF, 0, TYPE_NULL)
@@ -149,17 +129,13 @@ 
      IOCTL(FDTWADDLE, 0, TYPE_NULL)
      IOCTL(FDEJECT, 0, TYPE_NULL)
 
-#ifdef FIBMAP
      IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
-#endif
 #ifdef FICLONE
      IOCTL(FICLONE, IOC_W, TYPE_INT)
      IOCTL(FICLONERANGE, IOC_W, MK_PTR(MK_STRUCT(STRUCT_file_clone_range)))
 #endif
 
-#ifdef FIGETBSZ
      IOCTL(FIGETBSZ, IOC_R, MK_PTR(TYPE_LONG))
-#endif
 #ifdef CONFIG_FIEMAP
      IOCTL_SPECIAL(FS_IOC_FIEMAP, IOC_W | IOC_R, do_ioctl_fs_ioc_fiemap,
                    MK_PTR(MK_STRUCT(STRUCT_fiemap)))