diff mbox series

[011/104] virtiofsd: Fix common header and define for QEMU builds

Message ID 20191212163904.159893-12-dgilbert@redhat.com
State New
Headers show
Series virtiofs daemon [all] | expand

Commit Message

Dr. David Alan Gilbert Dec. 12, 2019, 4:37 p.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

All of the fuse files include config.h and define GNU_SOURCE
where we don't have either under our build - remove them.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 tools/virtiofsd/buffer.c         |  3 ---
 tools/virtiofsd/fuse_i.h         |  3 +++
 tools/virtiofsd/fuse_loop_mt.c   |  3 +--
 tools/virtiofsd/fuse_lowlevel.c  | 12 +-----------
 tools/virtiofsd/fuse_opt.c       |  1 -
 tools/virtiofsd/fuse_signals.c   |  1 -
 tools/virtiofsd/passthrough_ll.c |  9 ++-------
 7 files changed, 7 insertions(+), 25 deletions(-)

Comments

Daniel P. Berrangé Jan. 3, 2020, 12:22 p.m. UTC | #1
On Thu, Dec 12, 2019 at 04:37:31PM +0000, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> All of the fuse files include config.h and define GNU_SOURCE
> where we don't have either under our build - remove them.

There's a bunch of other random changes in this patch - were these
all fallout from removing the config.h header, or were they meant
for a separate commit ?

> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  tools/virtiofsd/buffer.c         |  3 ---
>  tools/virtiofsd/fuse_i.h         |  3 +++
>  tools/virtiofsd/fuse_loop_mt.c   |  3 +--
>  tools/virtiofsd/fuse_lowlevel.c  | 12 +-----------
>  tools/virtiofsd/fuse_opt.c       |  1 -
>  tools/virtiofsd/fuse_signals.c   |  1 -
>  tools/virtiofsd/passthrough_ll.c |  9 ++-------
>  7 files changed, 7 insertions(+), 25 deletions(-)
> 
> diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
> index 38521f5889..1d7e6d2439 100644
> --- a/tools/virtiofsd/buffer.c
> +++ b/tools/virtiofsd/buffer.c
> @@ -9,9 +9,6 @@
>   * See the file COPYING.LIB
>   */
>  
> -#define _GNU_SOURCE
> -
> -#include "config.h"
>  #include "fuse_i.h"
>  #include "fuse_lowlevel.h"
>  #include <assert.h>
> diff --git a/tools/virtiofsd/fuse_i.h b/tools/virtiofsd/fuse_i.h
> index 1119e85e57..0b5acc8765 100644
> --- a/tools/virtiofsd/fuse_i.h
> +++ b/tools/virtiofsd/fuse_i.h
> @@ -6,6 +6,9 @@
>   * See the file COPYING.LIB
>   */
>  
> +#define FUSE_USE_VERSION 31
> +
> +
>  #include "fuse.h"
>  #include "fuse_lowlevel.h"
>  
> diff --git a/tools/virtiofsd/fuse_loop_mt.c b/tools/virtiofsd/fuse_loop_mt.c
> index 39e080d9ff..00138b2ab3 100644
> --- a/tools/virtiofsd/fuse_loop_mt.c
> +++ b/tools/virtiofsd/fuse_loop_mt.c
> @@ -8,11 +8,10 @@
>   * See the file COPYING.LIB.
>   */
>  
> -#include "config.h"
>  #include "fuse_i.h"
> -#include "fuse_kernel.h"
>  #include "fuse_lowlevel.h"
>  #include "fuse_misc.h"
> +#include "standard-headers/linux/fuse.h"
>  
>  #include <assert.h>
>  #include <errno.h>
> diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
> index 0d7b2c3dc9..497eb25487 100644
> --- a/tools/virtiofsd/fuse_lowlevel.c
> +++ b/tools/virtiofsd/fuse_lowlevel.c
> @@ -9,14 +9,10 @@
>   * See the file COPYING.LIB
>   */
>  
> -#define _GNU_SOURCE
> -
> -#include "config.h"
>  #include "fuse_i.h"
> -#include "fuse_kernel.h"
> +#include "standard-headers/linux/fuse.h"
>  #include "fuse_misc.h"
>  #include "fuse_opt.h"
> -#include "mount_util.h"
>  
>  #include <assert.h>
>  #include <errno.h>
> @@ -2093,7 +2089,6 @@ static struct {
>      [FUSE_RENAME2] = { do_rename2, "RENAME2" },
>      [FUSE_COPY_FILE_RANGE] = { do_copy_file_range, "COPY_FILE_RANGE" },
>      [FUSE_LSEEK] = { do_lseek, "LSEEK" },
> -    [CUSE_INIT] = { cuse_lowlevel_init, "CUSE_INIT" },
>  };
>  
>  #define FUSE_MAXOP (sizeof(fuse_ll_ops) / sizeof(fuse_ll_ops[0]))
> @@ -2220,7 +2215,6 @@ void fuse_lowlevel_version(void)
>  {
>      printf("using FUSE kernel interface version %i.%i\n", FUSE_KERNEL_VERSION,
>             FUSE_KERNEL_MINOR_VERSION);
> -    fuse_mount_version();
>  }
>  
>  void fuse_lowlevel_help(void)
> @@ -2310,10 +2304,6 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
>          goto out4;
>      }
>  
> -    if (se->debug) {
> -        fuse_log(FUSE_LOG_DEBUG, "FUSE library version: %s\n", PACKAGE_VERSION);
> -    }
> -
>      se->bufsize = FUSE_MAX_MAX_PAGES * getpagesize() + FUSE_BUFFER_HEADER_SIZE;
>  
>      list_init_req(&se->list);
> diff --git a/tools/virtiofsd/fuse_opt.c b/tools/virtiofsd/fuse_opt.c
> index edd36f4a3b..1fee55e266 100644
> --- a/tools/virtiofsd/fuse_opt.c
> +++ b/tools/virtiofsd/fuse_opt.c
> @@ -10,7 +10,6 @@
>   */
>  
>  #include "fuse_opt.h"
> -#include "config.h"
>  #include "fuse_i.h"
>  #include "fuse_misc.h"
>  
> diff --git a/tools/virtiofsd/fuse_signals.c b/tools/virtiofsd/fuse_signals.c
> index 19d6791cb9..10a6f88088 100644
> --- a/tools/virtiofsd/fuse_signals.c
> +++ b/tools/virtiofsd/fuse_signals.c
> @@ -8,7 +8,6 @@
>   * See the file COPYING.LIB
>   */
>  
> -#include "config.h"
>  #include "fuse_i.h"
>  #include "fuse_lowlevel.h"
>  
> diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
> index a79ec2c70d..0e543353a4 100644
> --- a/tools/virtiofsd/passthrough_ll.c
> +++ b/tools/virtiofsd/passthrough_ll.c
> @@ -35,15 +35,10 @@
>   * \include passthrough_ll.c
>   */
>  
> -#define _GNU_SOURCE
> -#define FUSE_USE_VERSION 31
> -
> -#include "config.h"
> -
> +#include "fuse_lowlevel.h"
>  #include <assert.h>
>  #include <dirent.h>
>  #include <errno.h>
> -#include <fuse_lowlevel.h>
>  #include <inttypes.h>
>  #include <limits.h>
>  #include <pthread.h>
> @@ -58,6 +53,7 @@
>  
>  #include "passthrough_helpers.h"
>  
> +#define HAVE_POSIX_FALLOCATE 1
>  /*
>   * We are re-using pointers to our `struct lo_inode` and `struct
>   * lo_dirp` elements as inodes. This means that we must be able to
> @@ -1303,7 +1299,6 @@ int main(int argc, char *argv[])
>          ret = 0;
>          goto err_out1;
>      } else if (opts.show_version) {
> -        printf("FUSE library version %s\n", fuse_pkgversion());
>          fuse_lowlevel_version();
>          ret = 0;
>          goto err_out1;
> -- 
> 2.23.0
> 
> 

Regards,
Daniel
Dr. David Alan Gilbert Jan. 6, 2020, 4:29 p.m. UTC | #2
* Daniel P. Berrangé (berrange@redhat.com) wrote:
> On Thu, Dec 12, 2019 at 04:37:31PM +0000, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > 
> > All of the fuse files include config.h and define GNU_SOURCE
> > where we don't have either under our build - remove them.
> 
> There's a bunch of other random changes in this patch - were these
> all fallout from removing the config.h header, or were they meant
> for a separate commit ?

I've moved the removals of cuse_lowlevel_init call and
version printing into the earlier 'Trim down imported files'.
So we're left with header and #define tweaks.

I've added:
   'Fixup path to the kernel's fuse.h in the QEMUs world.'

to the commit message.

Dave


> > 
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> >  tools/virtiofsd/buffer.c         |  3 ---
> >  tools/virtiofsd/fuse_i.h         |  3 +++
> >  tools/virtiofsd/fuse_loop_mt.c   |  3 +--
> >  tools/virtiofsd/fuse_lowlevel.c  | 12 +-----------
> >  tools/virtiofsd/fuse_opt.c       |  1 -
> >  tools/virtiofsd/fuse_signals.c   |  1 -
> >  tools/virtiofsd/passthrough_ll.c |  9 ++-------
> >  7 files changed, 7 insertions(+), 25 deletions(-)
> > 
> > diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
> > index 38521f5889..1d7e6d2439 100644
> > --- a/tools/virtiofsd/buffer.c
> > +++ b/tools/virtiofsd/buffer.c
> > @@ -9,9 +9,6 @@
> >   * See the file COPYING.LIB
> >   */
> >  
> > -#define _GNU_SOURCE
> > -
> > -#include "config.h"
> >  #include "fuse_i.h"
> >  #include "fuse_lowlevel.h"
> >  #include <assert.h>
> > diff --git a/tools/virtiofsd/fuse_i.h b/tools/virtiofsd/fuse_i.h
> > index 1119e85e57..0b5acc8765 100644
> > --- a/tools/virtiofsd/fuse_i.h
> > +++ b/tools/virtiofsd/fuse_i.h
> > @@ -6,6 +6,9 @@
> >   * See the file COPYING.LIB
> >   */
> >  
> > +#define FUSE_USE_VERSION 31
> > +
> > +
> >  #include "fuse.h"
> >  #include "fuse_lowlevel.h"
> >  
> > diff --git a/tools/virtiofsd/fuse_loop_mt.c b/tools/virtiofsd/fuse_loop_mt.c
> > index 39e080d9ff..00138b2ab3 100644
> > --- a/tools/virtiofsd/fuse_loop_mt.c
> > +++ b/tools/virtiofsd/fuse_loop_mt.c
> > @@ -8,11 +8,10 @@
> >   * See the file COPYING.LIB.
> >   */
> >  
> > -#include "config.h"
> >  #include "fuse_i.h"
> > -#include "fuse_kernel.h"
> >  #include "fuse_lowlevel.h"
> >  #include "fuse_misc.h"
> > +#include "standard-headers/linux/fuse.h"
> >  
> >  #include <assert.h>
> >  #include <errno.h>
> > diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
> > index 0d7b2c3dc9..497eb25487 100644
> > --- a/tools/virtiofsd/fuse_lowlevel.c
> > +++ b/tools/virtiofsd/fuse_lowlevel.c
> > @@ -9,14 +9,10 @@
> >   * See the file COPYING.LIB
> >   */
> >  
> > -#define _GNU_SOURCE
> > -
> > -#include "config.h"
> >  #include "fuse_i.h"
> > -#include "fuse_kernel.h"
> > +#include "standard-headers/linux/fuse.h"
> >  #include "fuse_misc.h"
> >  #include "fuse_opt.h"
> > -#include "mount_util.h"
> >  
> >  #include <assert.h>
> >  #include <errno.h>
> > @@ -2093,7 +2089,6 @@ static struct {
> >      [FUSE_RENAME2] = { do_rename2, "RENAME2" },
> >      [FUSE_COPY_FILE_RANGE] = { do_copy_file_range, "COPY_FILE_RANGE" },
> >      [FUSE_LSEEK] = { do_lseek, "LSEEK" },
> > -    [CUSE_INIT] = { cuse_lowlevel_init, "CUSE_INIT" },
> >  };
> >  
> >  #define FUSE_MAXOP (sizeof(fuse_ll_ops) / sizeof(fuse_ll_ops[0]))
> > @@ -2220,7 +2215,6 @@ void fuse_lowlevel_version(void)
> >  {
> >      printf("using FUSE kernel interface version %i.%i\n", FUSE_KERNEL_VERSION,
> >             FUSE_KERNEL_MINOR_VERSION);
> > -    fuse_mount_version();
> >  }
> >  
> >  void fuse_lowlevel_help(void)
> > @@ -2310,10 +2304,6 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
> >          goto out4;
> >      }
> >  
> > -    if (se->debug) {
> > -        fuse_log(FUSE_LOG_DEBUG, "FUSE library version: %s\n", PACKAGE_VERSION);
> > -    }
> > -
> >      se->bufsize = FUSE_MAX_MAX_PAGES * getpagesize() + FUSE_BUFFER_HEADER_SIZE;
> >  
> >      list_init_req(&se->list);
> > diff --git a/tools/virtiofsd/fuse_opt.c b/tools/virtiofsd/fuse_opt.c
> > index edd36f4a3b..1fee55e266 100644
> > --- a/tools/virtiofsd/fuse_opt.c
> > +++ b/tools/virtiofsd/fuse_opt.c
> > @@ -10,7 +10,6 @@
> >   */
> >  
> >  #include "fuse_opt.h"
> > -#include "config.h"
> >  #include "fuse_i.h"
> >  #include "fuse_misc.h"
> >  
> > diff --git a/tools/virtiofsd/fuse_signals.c b/tools/virtiofsd/fuse_signals.c
> > index 19d6791cb9..10a6f88088 100644
> > --- a/tools/virtiofsd/fuse_signals.c
> > +++ b/tools/virtiofsd/fuse_signals.c
> > @@ -8,7 +8,6 @@
> >   * See the file COPYING.LIB
> >   */
> >  
> > -#include "config.h"
> >  #include "fuse_i.h"
> >  #include "fuse_lowlevel.h"
> >  
> > diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
> > index a79ec2c70d..0e543353a4 100644
> > --- a/tools/virtiofsd/passthrough_ll.c
> > +++ b/tools/virtiofsd/passthrough_ll.c
> > @@ -35,15 +35,10 @@
> >   * \include passthrough_ll.c
> >   */
> >  
> > -#define _GNU_SOURCE
> > -#define FUSE_USE_VERSION 31
> > -
> > -#include "config.h"
> > -
> > +#include "fuse_lowlevel.h"
> >  #include <assert.h>
> >  #include <dirent.h>
> >  #include <errno.h>
> > -#include <fuse_lowlevel.h>
> >  #include <inttypes.h>
> >  #include <limits.h>
> >  #include <pthread.h>
> > @@ -58,6 +53,7 @@
> >  
> >  #include "passthrough_helpers.h"
> >  
> > +#define HAVE_POSIX_FALLOCATE 1
> >  /*
> >   * We are re-using pointers to our `struct lo_inode` and `struct
> >   * lo_dirp` elements as inodes. This means that we must be able to
> > @@ -1303,7 +1299,6 @@ int main(int argc, char *argv[])
> >          ret = 0;
> >          goto err_out1;
> >      } else if (opts.show_version) {
> > -        printf("FUSE library version %s\n", fuse_pkgversion());
> >          fuse_lowlevel_version();
> >          ret = 0;
> >          goto err_out1;
> > -- 
> > 2.23.0
> > 
> > 
> 
> Regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox series

Patch

diff --git a/tools/virtiofsd/buffer.c b/tools/virtiofsd/buffer.c
index 38521f5889..1d7e6d2439 100644
--- a/tools/virtiofsd/buffer.c
+++ b/tools/virtiofsd/buffer.c
@@ -9,9 +9,6 @@ 
  * See the file COPYING.LIB
  */
 
-#define _GNU_SOURCE
-
-#include "config.h"
 #include "fuse_i.h"
 #include "fuse_lowlevel.h"
 #include <assert.h>
diff --git a/tools/virtiofsd/fuse_i.h b/tools/virtiofsd/fuse_i.h
index 1119e85e57..0b5acc8765 100644
--- a/tools/virtiofsd/fuse_i.h
+++ b/tools/virtiofsd/fuse_i.h
@@ -6,6 +6,9 @@ 
  * See the file COPYING.LIB
  */
 
+#define FUSE_USE_VERSION 31
+
+
 #include "fuse.h"
 #include "fuse_lowlevel.h"
 
diff --git a/tools/virtiofsd/fuse_loop_mt.c b/tools/virtiofsd/fuse_loop_mt.c
index 39e080d9ff..00138b2ab3 100644
--- a/tools/virtiofsd/fuse_loop_mt.c
+++ b/tools/virtiofsd/fuse_loop_mt.c
@@ -8,11 +8,10 @@ 
  * See the file COPYING.LIB.
  */
 
-#include "config.h"
 #include "fuse_i.h"
-#include "fuse_kernel.h"
 #include "fuse_lowlevel.h"
 #include "fuse_misc.h"
+#include "standard-headers/linux/fuse.h"
 
 #include <assert.h>
 #include <errno.h>
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
index 0d7b2c3dc9..497eb25487 100644
--- a/tools/virtiofsd/fuse_lowlevel.c
+++ b/tools/virtiofsd/fuse_lowlevel.c
@@ -9,14 +9,10 @@ 
  * See the file COPYING.LIB
  */
 
-#define _GNU_SOURCE
-
-#include "config.h"
 #include "fuse_i.h"
-#include "fuse_kernel.h"
+#include "standard-headers/linux/fuse.h"
 #include "fuse_misc.h"
 #include "fuse_opt.h"
-#include "mount_util.h"
 
 #include <assert.h>
 #include <errno.h>
@@ -2093,7 +2089,6 @@  static struct {
     [FUSE_RENAME2] = { do_rename2, "RENAME2" },
     [FUSE_COPY_FILE_RANGE] = { do_copy_file_range, "COPY_FILE_RANGE" },
     [FUSE_LSEEK] = { do_lseek, "LSEEK" },
-    [CUSE_INIT] = { cuse_lowlevel_init, "CUSE_INIT" },
 };
 
 #define FUSE_MAXOP (sizeof(fuse_ll_ops) / sizeof(fuse_ll_ops[0]))
@@ -2220,7 +2215,6 @@  void fuse_lowlevel_version(void)
 {
     printf("using FUSE kernel interface version %i.%i\n", FUSE_KERNEL_VERSION,
            FUSE_KERNEL_MINOR_VERSION);
-    fuse_mount_version();
 }
 
 void fuse_lowlevel_help(void)
@@ -2310,10 +2304,6 @@  struct fuse_session *fuse_session_new(struct fuse_args *args,
         goto out4;
     }
 
-    if (se->debug) {
-        fuse_log(FUSE_LOG_DEBUG, "FUSE library version: %s\n", PACKAGE_VERSION);
-    }
-
     se->bufsize = FUSE_MAX_MAX_PAGES * getpagesize() + FUSE_BUFFER_HEADER_SIZE;
 
     list_init_req(&se->list);
diff --git a/tools/virtiofsd/fuse_opt.c b/tools/virtiofsd/fuse_opt.c
index edd36f4a3b..1fee55e266 100644
--- a/tools/virtiofsd/fuse_opt.c
+++ b/tools/virtiofsd/fuse_opt.c
@@ -10,7 +10,6 @@ 
  */
 
 #include "fuse_opt.h"
-#include "config.h"
 #include "fuse_i.h"
 #include "fuse_misc.h"
 
diff --git a/tools/virtiofsd/fuse_signals.c b/tools/virtiofsd/fuse_signals.c
index 19d6791cb9..10a6f88088 100644
--- a/tools/virtiofsd/fuse_signals.c
+++ b/tools/virtiofsd/fuse_signals.c
@@ -8,7 +8,6 @@ 
  * See the file COPYING.LIB
  */
 
-#include "config.h"
 #include "fuse_i.h"
 #include "fuse_lowlevel.h"
 
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index a79ec2c70d..0e543353a4 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -35,15 +35,10 @@ 
  * \include passthrough_ll.c
  */
 
-#define _GNU_SOURCE
-#define FUSE_USE_VERSION 31
-
-#include "config.h"
-
+#include "fuse_lowlevel.h"
 #include <assert.h>
 #include <dirent.h>
 #include <errno.h>
-#include <fuse_lowlevel.h>
 #include <inttypes.h>
 #include <limits.h>
 #include <pthread.h>
@@ -58,6 +53,7 @@ 
 
 #include "passthrough_helpers.h"
 
+#define HAVE_POSIX_FALLOCATE 1
 /*
  * We are re-using pointers to our `struct lo_inode` and `struct
  * lo_dirp` elements as inodes. This means that we must be able to
@@ -1303,7 +1299,6 @@  int main(int argc, char *argv[])
         ret = 0;
         goto err_out1;
     } else if (opts.show_version) {
-        printf("FUSE library version %s\n", fuse_pkgversion());
         fuse_lowlevel_version();
         ret = 0;
         goto err_out1;