public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
From: Zorro Lang <zlang@redhat.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: fstests@vger.kernel.org
Subject: Re: [PATCH] idmap: override btrfs_ioctl_vol_args_v2 if system header doesn't have subvolid
Date: Tue, 24 Aug 2021 21:11:00 +0800	[thread overview]
Message-ID: <20210824131100.i75v7jmcekcfbp3h@fedora> (raw)
In-Reply-To: <20210823182138.GF12612@magnolia>

On Mon, Aug 23, 2021 at 11:21:38AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> The struct btrfs_ioctl_vol_args_v2 in /usr/include/linux/btrfs.h on my
> system predates the inclusion of the "subvolid" field.  This causes the
> following build failure:
> 
> idmapped-mounts.c: In function 'btrfs_delete_subvolume_id':
> idmapped-mounts.c:9730:6: error: 'struct btrfs_ioctl_vol_args_v2' has no member named 'subvolid'
>  9730 |  args.subvolid = subvolid;
>       |      ^
> 
> Since this source file contains its own more uptodate copy of that
> structure, add some more autoconf/cpp magic so that we can override the
> struct definition if the system header doesn't have the desired field.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Thanks, I just hit it[1] too. This patch works on my old and new systems,
so good and helpful to me. I'd like to see it can be merged ASAP.

Reviewed-by: Zorro Lang <zlang@redhat.com>

[1]
    [CC]    idmapped-mounts
    [CC]    mount-idmapped
idmapped-mounts.c: In function 'btrfs_delete_subvolume_id':
idmapped-mounts.c:9730:6: error: 'struct btrfs_ioctl_vol_args_v2' has no member named 'subvolid'
  args.subvolid = subvolid;
      ^
gmake[3]: *** [Makefile:30: idmapped-mounts] Error 1
gmake[2]: *** [../include/buildrules:30: idmapped-mounts] Error 2
gmake[1]: *** [include/buildrules:30: src] Error 2



>  configure.ac                          |    2 +-
>  src/idmapped-mounts/idmapped-mounts.c |    6 +++++-
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 4117a302..36960910 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -79,7 +79,7 @@ AC_CHECK_TYPES([struct btrfs_ioctl_ino_lookup_args], [], [], [[#include <linux/b
>  AC_CHECK_TYPES([struct btrfs_ioctl_ino_lookup_user_args], [], [], [[#include <linux/btrfs.h>]])
>  AC_CHECK_TYPES([struct btrfs_ioctl_get_subvol_rootref_args], [], [], [[#include <linux/btrfs.h>]])
>  AC_CHECK_HEADERS([linux/btrfs.h linux/btrfs_tree.h])
> -
> +AC_CHECK_MEMBERS([struct btrfs_ioctl_vol_args_v2.subvolid], [], [], [[#include <linux/btrfs.h>]])
>  
>  AC_CONFIG_HEADER(include/config.h)
>  AC_CONFIG_FILES([include/builddefs])
> diff --git a/src/idmapped-mounts/idmapped-mounts.c b/src/idmapped-mounts/idmapped-mounts.c
> index 78b7cc09..40eb2cc6 100644
> --- a/src/idmapped-mounts/idmapped-mounts.c
> +++ b/src/idmapped-mounts/idmapped-mounts.c
> @@ -23,7 +23,11 @@
>  #include <unistd.h>
>  
>  #ifdef HAVE_LINUX_BTRFS_H
> +# ifndef HAVE_STRUCT_BTRFS_IOCTL_VOL_ARGS_V2_SUBVOLID
> +#  define btrfs_ioctl_vol_args_v2 override_btrfs_ioctl_vol_args_v2
> +# endif
>  #include <linux/btrfs.h>
> +# undef btrfs_ioctl_vol_args_v2
>  #endif
>  
>  #ifdef HAVE_LINUX_BTRFS_TREE_H
> @@ -9570,7 +9574,7 @@ struct btrfs_qgroup_inherit {
>  };
>  #endif
>  
> -#ifndef HAVE_STRUCT_BTRFS_IOCTL_VOL_ARGS_V2
> +#if !defined(HAVE_STRUCT_BTRFS_IOCTL_VOL_ARGS_V2) || !defined(HAVE_STRUCT_BTRFS_IOCTL_VOL_ARGS_V2_SUBVOLID)
>  
>  #ifndef BTRFS_SUBVOL_NAME_MAX
>  #define BTRFS_SUBVOL_NAME_MAX 4039
> 


  parent reply	other threads:[~2021-08-24 12:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23 18:21 [PATCH] idmap: override btrfs_ioctl_vol_args_v2 if system header doesn't have subvolid Darrick J. Wong
2021-08-24 11:54 ` Christian Brauner
2021-08-24 13:11 ` Zorro Lang [this message]
2021-08-25  6:16 ` Anju T Sudhakar

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=20210824131100.i75v7jmcekcfbp3h@fedora \
    --to=zlang@redhat.com \
    --cc=djwong@kernel.org \
    --cc=fstests@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox