mbox series

[PULL,0/8] Linux user for 5.2 patches

Message ID 20200831110716.536808-1-laurent@vivier.eu
Headers show
Series Linux user for 5.2 patches | expand

Message

Laurent Vivier Aug. 31, 2020, 11:07 a.m. UTC
The following changes since commit 39335fab59e11cfda9b7cf63929825db2dd3a3e0:

  Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.2-pull-=
request' into staging (2020-08-28 22:30:11 +0100)

are available in the Git repository at:

  git://github.com/vivier/qemu.git tags/linux-user-for-5.2-pull-request

for you to fetch changes up to d6676fc62a52e020df32abf927c2e7183781a2e3:

  linux-user: Add support for btrfs ioctls used to scrub a filesystem (2020-0=
8-29 10:14:52 +0200)

----------------------------------------------------------------
Add btrfs support

----------------------------------------------------------------

Filip Bozuta (8):
  linux-user: Add support for a group of btrfs ioctls used for
    subvolumes
  linux-user: Add support for a group of btrfs ioctls used for snapshots
  linux-user: Add support for btrfs ioctls used to manipulate with
    devices
  linux-user: Add support for btrfs ioctls used to get/set features
  linux-user: Add support for a group of btrfs inode ioctls
  linux-user: Add support for two btrfs ioctls used for subvolume
  linux-user: Add support for btrfs ioctls used to manage quota
  linux-user: Add support for btrfs ioctls used to scrub a filesystem

 configure                  |   9 ++
 linux-user/ioctls.h        | 124 ++++++++++++++++++++++++++++
 linux-user/syscall.c       |   3 +
 linux-user/syscall_defs.h  |  37 +++++++++
 linux-user/syscall_types.h | 163 +++++++++++++++++++++++++++++++++++++
 5 files changed, 336 insertions(+)

--=20
2.26.2

Comments

Laurent Vivier Sept. 1, 2020, 2:02 p.m. UTC | #1
Le 01/09/2020 à 15:06, Peter Maydell a écrit :
> On Mon, 31 Aug 2020 at 12:08, Laurent Vivier <laurent@vivier.eu> wrote:
>>
>> The following changes since commit 39335fab59e11cfda9b7cf63929825db2dd3a3e0:
>>
>>   Merge remote-tracking branch 'remotes/vivier2/tags/linux-user-for-5.2-pull-=
>> request' into staging (2020-08-28 22:30:11 +0100)
>>
>> are available in the Git repository at:
>>
>>   git://github.com/vivier/qemu.git tags/linux-user-for-5.2-pull-request
>>
>> for you to fetch changes up to d6676fc62a52e020df32abf927c2e7183781a2e3:
>>
>>   linux-user: Add support for btrfs ioctls used to scrub a filesystem (2020-0=
>> 8-29 10:14:52 +0200)
>>
>> ----------------------------------------------------------------
>> Add btrfs support
> 
> Fails to build with clang, I'm afraid:
> 
> In file included from ../../linux-user/syscall.c:4561:
> ../../linux-user/syscall_types.h:485:33: error: implicit conversion
> from enumeration type 'enum btrfs_dev_stat_values' to different
> enumeration type 'argtype' (aka 'enum argtype')
> [-Werror,-Wenum-conversion]
>        MK_ARRAY(TYPE_ULONGLONG, BTRFS_DEV_STAT_VALUES_MAX), /* values */
>        ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /home/petmay01/linaro/qemu-for-merges/include/exec/user/thunk.h:45:42:
> note: expanded from macro 'MK_ARRAY'
> #define MK_ARRAY(type, size) TYPE_ARRAY, size, type
>                                          ^~~~
> ../../linux-user/syscall.c:4559:79: note: expanded from macro 'STRUCT'
> #define STRUCT(name, ...) static const argtype struct_ ## name ##
> _def[] = {  __VA_ARGS__, TYPE_NULL };
> 
>     ~  ^~~~~~~~~~~
> 1 error generated.
> 

Thank you Peter.

I think the fix might be to introduce a new patch to cast "size" to
"unsigned int" in:

    #define MK_ARRAY(type, size) TYPE_ARRAY, size, type

as size in the case of btrfs is BTRFS_DEV_STAT_VALUES_MAX that is
defined as an enum of btrfs_dev_stat_values, and MK_ARRAY() values are
put in an array of argtype enum.

Laurent
Laurent Vivier Sept. 1, 2020, 2:40 p.m. UTC | #2
Le 01/09/2020 à 15:54, Filip Bozuta a écrit :
> 
> On 1.9.20. 15:06, Peter Maydell wrote:
>> On Mon, 31 Aug 2020 at 12:08, Laurent Vivier <laurent@vivier.eu> wrote:
>>> The following changes since commit
>>> 39335fab59e11cfda9b7cf63929825db2dd3a3e0:
>>>
>>>    Merge remote-tracking branch
>>> 'remotes/vivier2/tags/linux-user-for-5.2-pull-=
>>> request' into staging (2020-08-28 22:30:11 +0100)
>>>
>>> are available in the Git repository at:
>>>
>>>    git://github.com/vivier/qemu.git tags/linux-user-for-5.2-pull-request
>>>
>>> for you to fetch changes up to d6676fc62a52e020df32abf927c2e7183781a2e3:
>>>
>>>    linux-user: Add support for btrfs ioctls used to scrub a
>>> filesystem (2020-0=
>>> 8-29 10:14:52 +0200)
>>>
>>> ----------------------------------------------------------------
>>> Add btrfs support
>> Fails to build with clang, I'm afraid:
>>
>> In file included from ../../linux-user/syscall.c:4561:
>> ../../linux-user/syscall_types.h:485:33: error: implicit conversion
>> from enumeration type 'enum btrfs_dev_stat_values' to different
>> enumeration type 'argtype' (aka 'enum argtype')
>> [-Werror,-Wenum-conversion]
>>         MK_ARRAY(TYPE_ULONGLONG, BTRFS_DEV_STAT_VALUES_MAX), /* values */
>>         ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> /home/petmay01/linaro/qemu-for-merges/include/exec/user/thunk.h:45:42:
>> note: expanded from macro 'MK_ARRAY'
>> #define MK_ARRAY(type, size) TYPE_ARRAY, size, type
>>                                           ^~~~
>> ../../linux-user/syscall.c:4559:79: note: expanded from macro 'STRUCT'
>> #define STRUCT(name, ...) static const argtype struct_ ## name ##
>> _def[] = {  __VA_ARGS__, TYPE_NULL };
>>
>>      ~  ^~~~~~~~~~~
>> 1 error generated.
> 
> There seems to be a problem because 'BTRFS_DEV_STAT_VALUES_MAX' is not a
> predefined value but an enum value from from 'enum btrfs_dev_stat_values':
> 
> https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/btrfs.h#L668
> 
> 
> The build problem arises probably when 'thunk_convert()' tries to
> convert this enum value to the thunk enum values 'argtype'. I will see
> about finding a work around for this or maybe use a STRUCT_SPECIAL() for
> 'struct btrfs_ioctl_get_dev_stats' to define an explicit converting
> function.
> 
> Just curious, on what linux distro are you building on? I didn't come
> accross this build issue on my system.

You can reproduce the problem by using clang rather than gcc (at least
on Fedora 32):

.../configure ... --cc=clang ...

Compiling C object libqemu-aarch64_be-linux-user.fa.p/linux-user_syscall.c.o
In file included from.../qemu/linux-user/syscall.c:4561:
.../qemu/linux-user/syscall_types.h:485:33: error: implicit conversion
from enumeration type 'enum btrfs_dev_stat_values' to different
enumeration type 'argtype' (aka 'enum argtype') [-Werror,-Wenum-conversion]
       MK_ARRAY(TYPE_ULONGLONG, BTRFS_DEV_STAT_VALUES_MAX), /* values */
       ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../qemu/include/exec/user/thunk.h:45:42: note: expanded from macro
'MK_ARRAY'
#define MK_ARRAY(type, size) TYPE_ARRAY, size, type
                                         ^~~~
..../qemu/linux-user/syscall.c:4559:79: note: expanded from macro 'STRUCT'
#define STRUCT(name, ...) static const argtype struct_ ## name ## _def[]
= {  __VA_ARGS__, TYPE_NULL };

   ~  ^~~~~~~~~~~
1 error generated.

Thanks,
Laurent