[Qemu-devel] [for-2.10 PATCH] fsdev: move stub to libqemustub.a

Greg Kurz posted 1 patch 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/149096834395.26958.7919143982719167728.stgit@bahia.lan
Test checkpatch passed
Test docker passed
Test s390x passed
fsdev/Makefile.objs      |    6 ------
fsdev/qemu-fsdev-dummy.c |   21 ---------------------
stubs/Makefile.objs      |    1 +
stubs/qemu-fsdev-dummy.c |   21 +++++++++++++++++++++
4 files changed, 22 insertions(+), 27 deletions(-)
delete mode 100644 fsdev/qemu-fsdev-dummy.c
create mode 100644 stubs/qemu-fsdev-dummy.c
[Qemu-devel] [for-2.10 PATCH] fsdev: move stub to libqemustub.a
Posted by Greg Kurz 7 years ago
The qemu_fsdev_add() stub is used by targets that don't build VirtFS, like
CRIS for example. This can be handled by libqemustub.a.

Signed-off-by: Greg Kurz <groug@kaod.org>
---
 fsdev/Makefile.objs      |    6 ------
 fsdev/qemu-fsdev-dummy.c |   21 ---------------------
 stubs/Makefile.objs      |    1 +
 stubs/qemu-fsdev-dummy.c |   21 +++++++++++++++++++++
 4 files changed, 22 insertions(+), 27 deletions(-)
 delete mode 100644 fsdev/qemu-fsdev-dummy.c
 create mode 100644 stubs/qemu-fsdev-dummy.c

diff --git a/fsdev/Makefile.objs b/fsdev/Makefile.objs
index 659df6e18767..e2eea86d680a 100644
--- a/fsdev/Makefile.objs
+++ b/fsdev/Makefile.objs
@@ -2,11 +2,5 @@ ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
 # Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add.
 # only pull in the actual virtio-9p device if we also enabled virtio.
 common-obj-y = qemu-fsdev.o 9p-marshal.o 9p-iov-marshal.o
-else
-common-obj-y = qemu-fsdev-dummy.o
 endif
 common-obj-y += qemu-fsdev-opts.o qemu-fsdev-throttle.o
-
-# Toplevel always builds this; targets without virtio will put it in
-# common-obj-y
-common-obj-$(CONFIG_ALL) += qemu-fsdev-dummy.o
diff --git a/fsdev/qemu-fsdev-dummy.c b/fsdev/qemu-fsdev-dummy.c
deleted file mode 100644
index 6dc0fbc4c402..000000000000
--- a/fsdev/qemu-fsdev-dummy.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * 9p
- *
- * Copyright IBM, Corp. 2010
- *
- * Authors:
- *  Gautham R Shenoy <ego@in.ibm.com>
- *
- * This work is licensed under the terms of the GNU GPL, version 2.  See
- * the COPYING file in the top-level directory.
- *
- */
-#include "qemu/osdep.h"
-#include "qemu-fsdev.h"
-#include "qemu/config-file.h"
-#include "qemu/module.h"
-
-int qemu_fsdev_add(QemuOpts *opts)
-{
-    return 0;
-}
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 224f04ba6970..f67943da20e9 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -37,3 +37,4 @@ stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += vmgenid.o
+stub-obj-$(CONFIG_VIRTFS) += qemu-fsdev-dummy.o
diff --git a/stubs/qemu-fsdev-dummy.c b/stubs/qemu-fsdev-dummy.c
new file mode 100644
index 000000000000..12f2be21f915
--- /dev/null
+++ b/stubs/qemu-fsdev-dummy.c
@@ -0,0 +1,21 @@
+/*
+ * 9p
+ *
+ * Copyright IBM, Corp. 2010
+ *
+ * Authors:
+ *  Gautham R Shenoy <ego@in.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ */
+#include "qemu/osdep.h"
+#include "fsdev/qemu-fsdev.h"
+#include "qemu/config-file.h"
+#include "qemu/module.h"
+
+int qemu_fsdev_add(QemuOpts *opts)
+{
+    return 0;
+}


Re: [Qemu-devel] [for-2.10 PATCH] fsdev: move stub to libqemustub.a
Posted by Paolo Bonzini 7 years ago

On 31/03/2017 15:52, Greg Kurz wrote:
> The qemu_fsdev_add() stub is used by targets that don't build VirtFS, like
> CRIS for example. This can be handled by libqemustub.a.

It can, the question is do we want them to. :)

The original purpose of the stubs was for function residing in files
that aren't easily separated from the rest of the build.  Putting
everything in stubs/ easily leads to dead code in libqemustub.a, though
I understand that it's somewhat easier (no need to use if/else and
CONFIG_ALL).

Paolo

> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
>  fsdev/Makefile.objs      |    6 ------
>  fsdev/qemu-fsdev-dummy.c |   21 ---------------------
>  stubs/Makefile.objs      |    1 +
>  stubs/qemu-fsdev-dummy.c |   21 +++++++++++++++++++++
>  4 files changed, 22 insertions(+), 27 deletions(-)
>  delete mode 100644 fsdev/qemu-fsdev-dummy.c
>  create mode 100644 stubs/qemu-fsdev-dummy.c
> 
> diff --git a/fsdev/Makefile.objs b/fsdev/Makefile.objs
> index 659df6e18767..e2eea86d680a 100644
> --- a/fsdev/Makefile.objs
> +++ b/fsdev/Makefile.objs
> @@ -2,11 +2,5 @@ ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
>  # Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add.
>  # only pull in the actual virtio-9p device if we also enabled virtio.
>  common-obj-y = qemu-fsdev.o 9p-marshal.o 9p-iov-marshal.o
> -else
> -common-obj-y = qemu-fsdev-dummy.o
>  endif
>  common-obj-y += qemu-fsdev-opts.o qemu-fsdev-throttle.o
> -
> -# Toplevel always builds this; targets without virtio will put it in
> -# common-obj-y
> -common-obj-$(CONFIG_ALL) += qemu-fsdev-dummy.o
> diff --git a/fsdev/qemu-fsdev-dummy.c b/fsdev/qemu-fsdev-dummy.c
> deleted file mode 100644
> index 6dc0fbc4c402..000000000000
> --- a/fsdev/qemu-fsdev-dummy.c
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/*
> - * 9p
> - *
> - * Copyright IBM, Corp. 2010
> - *
> - * Authors:
> - *  Gautham R Shenoy <ego@in.ibm.com>
> - *
> - * This work is licensed under the terms of the GNU GPL, version 2.  See
> - * the COPYING file in the top-level directory.
> - *
> - */
> -#include "qemu/osdep.h"
> -#include "qemu-fsdev.h"
> -#include "qemu/config-file.h"
> -#include "qemu/module.h"
> -
> -int qemu_fsdev_add(QemuOpts *opts)
> -{
> -    return 0;
> -}
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index 224f04ba6970..f67943da20e9 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -37,3 +37,4 @@ stub-obj-y += target-monitor-defs.o
>  stub-obj-y += target-get-monitor-def.o
>  stub-obj-y += pc_madt_cpu_entry.o
>  stub-obj-y += vmgenid.o
> +stub-obj-$(CONFIG_VIRTFS) += qemu-fsdev-dummy.o
> diff --git a/stubs/qemu-fsdev-dummy.c b/stubs/qemu-fsdev-dummy.c
> new file mode 100644
> index 000000000000..12f2be21f915
> --- /dev/null
> +++ b/stubs/qemu-fsdev-dummy.c
> @@ -0,0 +1,21 @@
> +/*
> + * 9p
> + *
> + * Copyright IBM, Corp. 2010
> + *
> + * Authors:
> + *  Gautham R Shenoy <ego@in.ibm.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2.  See
> + * the COPYING file in the top-level directory.
> + *
> + */
> +#include "qemu/osdep.h"
> +#include "fsdev/qemu-fsdev.h"
> +#include "qemu/config-file.h"
> +#include "qemu/module.h"
> +
> +int qemu_fsdev_add(QemuOpts *opts)
> +{
> +    return 0;
> +}
> 

Re: [Qemu-devel] [for-2.10 PATCH] fsdev: move stub to libqemustub.a
Posted by Greg Kurz 7 years ago
On Fri, 31 Mar 2017 16:06:35 +0200
Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 31/03/2017 15:52, Greg Kurz wrote:
> > The qemu_fsdev_add() stub is used by targets that don't build VirtFS, like
> > CRIS for example. This can be handled by libqemustub.a.  
> 
> It can, the question is do we want them to. :)
> 
> The original purpose of the stubs was for function residing in files
> that aren't easily separated from the rest of the build.  Putting
> everything in stubs/ easily leads to dead code in libqemustub.a, though
> I understand that it's somewhat easier (no need to use if/else and
> CONFIG_ALL).
> 

Fair enough :)

> Paolo
> 
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> >  fsdev/Makefile.objs      |    6 ------
> >  fsdev/qemu-fsdev-dummy.c |   21 ---------------------
> >  stubs/Makefile.objs      |    1 +
> >  stubs/qemu-fsdev-dummy.c |   21 +++++++++++++++++++++
> >  4 files changed, 22 insertions(+), 27 deletions(-)
> >  delete mode 100644 fsdev/qemu-fsdev-dummy.c
> >  create mode 100644 stubs/qemu-fsdev-dummy.c
> > 
> > diff --git a/fsdev/Makefile.objs b/fsdev/Makefile.objs
> > index 659df6e18767..e2eea86d680a 100644
> > --- a/fsdev/Makefile.objs
> > +++ b/fsdev/Makefile.objs
> > @@ -2,11 +2,5 @@ ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
> >  # Lots of the fsdev/9pcode is pulled in by vl.c via qemu_fsdev_add.
> >  # only pull in the actual virtio-9p device if we also enabled virtio.
> >  common-obj-y = qemu-fsdev.o 9p-marshal.o 9p-iov-marshal.o
> > -else
> > -common-obj-y = qemu-fsdev-dummy.o
> >  endif
> >  common-obj-y += qemu-fsdev-opts.o qemu-fsdev-throttle.o
> > -
> > -# Toplevel always builds this; targets without virtio will put it in
> > -# common-obj-y
> > -common-obj-$(CONFIG_ALL) += qemu-fsdev-dummy.o
> > diff --git a/fsdev/qemu-fsdev-dummy.c b/fsdev/qemu-fsdev-dummy.c
> > deleted file mode 100644
> > index 6dc0fbc4c402..000000000000
> > --- a/fsdev/qemu-fsdev-dummy.c
> > +++ /dev/null
> > @@ -1,21 +0,0 @@
> > -/*
> > - * 9p
> > - *
> > - * Copyright IBM, Corp. 2010
> > - *
> > - * Authors:
> > - *  Gautham R Shenoy <ego@in.ibm.com>
> > - *
> > - * This work is licensed under the terms of the GNU GPL, version 2.  See
> > - * the COPYING file in the top-level directory.
> > - *
> > - */
> > -#include "qemu/osdep.h"
> > -#include "qemu-fsdev.h"
> > -#include "qemu/config-file.h"
> > -#include "qemu/module.h"
> > -
> > -int qemu_fsdev_add(QemuOpts *opts)
> > -{
> > -    return 0;
> > -}
> > diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> > index 224f04ba6970..f67943da20e9 100644
> > --- a/stubs/Makefile.objs
> > +++ b/stubs/Makefile.objs
> > @@ -37,3 +37,4 @@ stub-obj-y += target-monitor-defs.o
> >  stub-obj-y += target-get-monitor-def.o
> >  stub-obj-y += pc_madt_cpu_entry.o
> >  stub-obj-y += vmgenid.o
> > +stub-obj-$(CONFIG_VIRTFS) += qemu-fsdev-dummy.o
> > diff --git a/stubs/qemu-fsdev-dummy.c b/stubs/qemu-fsdev-dummy.c
> > new file mode 100644
> > index 000000000000..12f2be21f915
> > --- /dev/null
> > +++ b/stubs/qemu-fsdev-dummy.c
> > @@ -0,0 +1,21 @@
> > +/*
> > + * 9p
> > + *
> > + * Copyright IBM, Corp. 2010
> > + *
> > + * Authors:
> > + *  Gautham R Shenoy <ego@in.ibm.com>
> > + *
> > + * This work is licensed under the terms of the GNU GPL, version 2.  See
> > + * the COPYING file in the top-level directory.
> > + *
> > + */
> > +#include "qemu/osdep.h"
> > +#include "fsdev/qemu-fsdev.h"
> > +#include "qemu/config-file.h"
> > +#include "qemu/module.h"
> > +
> > +int qemu_fsdev_add(QemuOpts *opts)
> > +{
> > +    return 0;
> > +}
> >