diff mbox

[PULL,v2,059/106] libqemustub: add stubs to be able to use qemu-char.c

Message ID 1403108034-32054-60-git-send-email-mst@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin June 18, 2014, 4:19 p.m. UTC
From: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>

chardev depends on lots of external symbols that are not necessarily
needed to be able to use, for example, 'socket chardev'. So add stubs
for these functions:

 - bdrv_commit_all
 - qemu_chr_open_msmouse
 - is_daemonized
 - qemu_add_machine_init_done_notifier
 - monitor_init
 - qemu_notify_event
 - vc_init

and this array:

 - serial_hds

Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 stubs/bdrv-commit-all.c   | 7 +++++++
 stubs/chr-msmouse.c       | 7 +++++++
 stubs/get-next-serial.c   | 3 +++
 stubs/is-daemonized.c     | 7 +++++++
 stubs/machine-init-done.c | 6 ++++++
 stubs/monitor-init.c      | 6 ++++++
 stubs/notify-event.c      | 6 ++++++
 stubs/vc-init.c           | 7 +++++++
 stubs/Makefile.objs       | 8 ++++++++
 9 files changed, 57 insertions(+)
 create mode 100644 stubs/bdrv-commit-all.c
 create mode 100644 stubs/chr-msmouse.c
 create mode 100644 stubs/get-next-serial.c
 create mode 100644 stubs/is-daemonized.c
 create mode 100644 stubs/machine-init-done.c
 create mode 100644 stubs/monitor-init.c
 create mode 100644 stubs/notify-event.c
 create mode 100644 stubs/vc-init.c

Comments

Riku Voipio June 23, 2014, 6:15 a.m. UTC | #1
Hi,

On Wed, Jun 18, 2014 at 07:19:17PM +0300, Michael S. Tsirkin wrote:
> From: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> 
> chardev depends on lots of external symbols that are not necessarily
> needed to be able to use, for example, 'socket chardev'. So add stubs
> for these functions:
> 
>  - bdrv_commit_all
>  - qemu_chr_open_msmouse
>  - is_daemonized
>  - qemu_add_machine_init_done_notifier
>  - monitor_init
>  - qemu_notify_event
>  - vc_init

This broke user build of user tools only. With:

./configure --disable-tools --disable-docs --target-list=arm-linux-user
...
pixman            none
...
make
...
In file included from /data/home/nchip/linaro/qemu/include/ui/console.h:4:0,
                 from /data/home/nchip/linaro/qemu/stubs/vc-init.c:2:
/data/home/nchip/linaro/qemu/include/ui/qemu-pixman.h:14:20: fatal error: pixman.h: No such file or directory
 #include <pixman.h>
                    ^
compilation terminated.

I'm not familiar with this area of Qemu - perhaps the following would be a good fix:

-stub-obj-y += vc-init.o
+stub-obj-$(CONFIG_SOFTMMU) += vc-init.o

Riku

> 
> and this array:
> 
>  - serial_hds
> 
> Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
> Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  stubs/bdrv-commit-all.c   | 7 +++++++
>  stubs/chr-msmouse.c       | 7 +++++++
>  stubs/get-next-serial.c   | 3 +++
>  stubs/is-daemonized.c     | 7 +++++++
>  stubs/machine-init-done.c | 6 ++++++
>  stubs/monitor-init.c      | 6 ++++++
>  stubs/notify-event.c      | 6 ++++++
>  stubs/vc-init.c           | 7 +++++++
>  stubs/Makefile.objs       | 8 ++++++++
>  9 files changed, 57 insertions(+)
>  create mode 100644 stubs/bdrv-commit-all.c
>  create mode 100644 stubs/chr-msmouse.c
>  create mode 100644 stubs/get-next-serial.c
>  create mode 100644 stubs/is-daemonized.c
>  create mode 100644 stubs/machine-init-done.c
>  create mode 100644 stubs/monitor-init.c
>  create mode 100644 stubs/notify-event.c
>  create mode 100644 stubs/vc-init.c
> 
> diff --git a/stubs/bdrv-commit-all.c b/stubs/bdrv-commit-all.c
> new file mode 100644
> index 0000000..a8e0a95
> --- /dev/null
> +++ b/stubs/bdrv-commit-all.c
> @@ -0,0 +1,7 @@
> +#include "qemu-common.h"
> +#include "block/block.h"
> +
> +int bdrv_commit_all(void)
> +{
> +    return 0;
> +}
> diff --git a/stubs/chr-msmouse.c b/stubs/chr-msmouse.c
> new file mode 100644
> index 0000000..812f8b0
> --- /dev/null
> +++ b/stubs/chr-msmouse.c
> @@ -0,0 +1,7 @@
> +#include "qemu-common.h"
> +#include "sysemu/char.h"
> +
> +CharDriverState *qemu_chr_open_msmouse(void)
> +{
> +    return 0;
> +}
> diff --git a/stubs/get-next-serial.c b/stubs/get-next-serial.c
> new file mode 100644
> index 0000000..40c56d1
> --- /dev/null
> +++ b/stubs/get-next-serial.c
> @@ -0,0 +1,3 @@
> +#include "qemu-common.h"
> +
> +CharDriverState *serial_hds[0];
> diff --git a/stubs/is-daemonized.c b/stubs/is-daemonized.c
> new file mode 100644
> index 0000000..16ce7c7
> --- /dev/null
> +++ b/stubs/is-daemonized.c
> @@ -0,0 +1,7 @@
> +#include "qemu-common.h"
> +#include "sysemu/os-posix.h"
> +
> +bool is_daemonized(void)
> +{
> +    return true;
> +}
> diff --git a/stubs/machine-init-done.c b/stubs/machine-init-done.c
> new file mode 100644
> index 0000000..28a9255
> --- /dev/null
> +++ b/stubs/machine-init-done.c
> @@ -0,0 +1,6 @@
> +#include "qemu-common.h"
> +#include "sysemu/sysemu.h"
> +
> +void qemu_add_machine_init_done_notifier(Notifier *notify)
> +{
> +}
> diff --git a/stubs/monitor-init.c b/stubs/monitor-init.c
> new file mode 100644
> index 0000000..563902b
> --- /dev/null
> +++ b/stubs/monitor-init.c
> @@ -0,0 +1,6 @@
> +#include "qemu-common.h"
> +#include "monitor/monitor.h"
> +
> +void monitor_init(CharDriverState *chr, int flags)
> +{
> +}
> diff --git a/stubs/notify-event.c b/stubs/notify-event.c
> new file mode 100644
> index 0000000..32f7289
> --- /dev/null
> +++ b/stubs/notify-event.c
> @@ -0,0 +1,6 @@
> +#include "qemu-common.h"
> +#include "qemu/main-loop.h"
> +
> +void qemu_notify_event(void)
> +{
> +}
> diff --git a/stubs/vc-init.c b/stubs/vc-init.c
> new file mode 100644
> index 0000000..2af054f
> --- /dev/null
> +++ b/stubs/vc-init.c
> @@ -0,0 +1,7 @@
> +#include "qemu-common.h"
> +#include "ui/console.h"
> +
> +CharDriverState *vc_init(ChardevVC *vc)
> +{
> +    return 0;
> +}
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index d99e2b9..5a0b917 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -1,4 +1,6 @@
>  stub-obj-y += arch-query-cpu-def.o
> +stub-obj-y += bdrv-commit-all.o
> +stub-obj-y += chr-msmouse.o
>  stub-obj-y += clock-warp.o
>  stub-obj-y += cpu-get-clock.o
>  stub-obj-y += cpu-get-icount.o
> @@ -9,13 +11,18 @@ stub-obj-y += fdset-get-fd.o
>  stub-obj-y += fdset-remove-fd.o
>  stub-obj-y += gdbstub.o
>  stub-obj-y += get-fd.o
> +stub-obj-y += get-next-serial.o
>  stub-obj-y += get-vm-name.o
>  stub-obj-y += iothread-lock.o
> +stub-obj-y += is-daemonized.o
> +stub-obj-y += machine-init-done.o
>  stub-obj-y += migr-blocker.o
>  stub-obj-y += mon-is-qmp.o
>  stub-obj-y += mon-printf.o
>  stub-obj-y += mon-protocol-event.o
>  stub-obj-y += mon-set-error.o
> +stub-obj-y += monitor-init.o
> +stub-obj-y += notify-event.o
>  stub-obj-y += pci-drive-hot-add.o
>  stub-obj-y += qtest.o
>  stub-obj-y += reset.o
> @@ -24,6 +31,7 @@ stub-obj-y += set-fd-handler.o
>  stub-obj-y += slirp.o
>  stub-obj-y += sysbus.o
>  stub-obj-y += uuid.o
> +stub-obj-y += vc-init.o
>  stub-obj-y += vm-stop.o
>  stub-obj-y += vmstate.o
>  stub-obj-$(CONFIG_WIN32) += fd-register.o
> -- 
> MST
>
Michael S. Tsirkin June 23, 2014, 7:20 a.m. UTC | #2
On Mon, Jun 23, 2014 at 09:15:34AM +0300, Riku Voipio wrote:
> Hi,
> 
> On Wed, Jun 18, 2014 at 07:19:17PM +0300, Michael S. Tsirkin wrote:
> > From: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> > 
> > chardev depends on lots of external symbols that are not necessarily
> > needed to be able to use, for example, 'socket chardev'. So add stubs
> > for these functions:
> > 
> >  - bdrv_commit_all
> >  - qemu_chr_open_msmouse
> >  - is_daemonized
> >  - qemu_add_machine_init_done_notifier
> >  - monitor_init
> >  - qemu_notify_event
> >  - vc_init
> 
> This broke user build of user tools only. With:
> 
> ./configure --disable-tools --disable-docs --target-list=arm-linux-user
> ...
> pixman            none
> ...
> make
> ...
> In file included from /data/home/nchip/linaro/qemu/include/ui/console.h:4:0,
>                  from /data/home/nchip/linaro/qemu/stubs/vc-init.c:2:
> /data/home/nchip/linaro/qemu/include/ui/qemu-pixman.h:14:20: fatal error: pixman.h: No such file or directory
>  #include <pixman.h>
>                     ^
> compilation terminated.
> 
> I'm not familiar with this area of Qemu - perhaps the following would be a good fix:
> 
> -stub-obj-y += vc-init.o
> +stub-obj-$(CONFIG_SOFTMMU) += vc-init.o
> 
> Riku

Hmm qemu-char.o needs it - and that's in common-obj-y, so I doubt that will work.
I think we should just avoid including ui bits from stubs.
Will send a patch shortly.

> > 
> > and this array:
> > 
> >  - serial_hds
> > 
> > Signed-off-by: Antonios Motakis <a.motakis@virtualopensystems.com>
> > Signed-off-by: Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > ---
> >  stubs/bdrv-commit-all.c   | 7 +++++++
> >  stubs/chr-msmouse.c       | 7 +++++++
> >  stubs/get-next-serial.c   | 3 +++
> >  stubs/is-daemonized.c     | 7 +++++++
> >  stubs/machine-init-done.c | 6 ++++++
> >  stubs/monitor-init.c      | 6 ++++++
> >  stubs/notify-event.c      | 6 ++++++
> >  stubs/vc-init.c           | 7 +++++++
> >  stubs/Makefile.objs       | 8 ++++++++
> >  9 files changed, 57 insertions(+)
> >  create mode 100644 stubs/bdrv-commit-all.c
> >  create mode 100644 stubs/chr-msmouse.c
> >  create mode 100644 stubs/get-next-serial.c
> >  create mode 100644 stubs/is-daemonized.c
> >  create mode 100644 stubs/machine-init-done.c
> >  create mode 100644 stubs/monitor-init.c
> >  create mode 100644 stubs/notify-event.c
> >  create mode 100644 stubs/vc-init.c
> > 
> > diff --git a/stubs/bdrv-commit-all.c b/stubs/bdrv-commit-all.c
> > new file mode 100644
> > index 0000000..a8e0a95
> > --- /dev/null
> > +++ b/stubs/bdrv-commit-all.c
> > @@ -0,0 +1,7 @@
> > +#include "qemu-common.h"
> > +#include "block/block.h"
> > +
> > +int bdrv_commit_all(void)
> > +{
> > +    return 0;
> > +}
> > diff --git a/stubs/chr-msmouse.c b/stubs/chr-msmouse.c
> > new file mode 100644
> > index 0000000..812f8b0
> > --- /dev/null
> > +++ b/stubs/chr-msmouse.c
> > @@ -0,0 +1,7 @@
> > +#include "qemu-common.h"
> > +#include "sysemu/char.h"
> > +
> > +CharDriverState *qemu_chr_open_msmouse(void)
> > +{
> > +    return 0;
> > +}
> > diff --git a/stubs/get-next-serial.c b/stubs/get-next-serial.c
> > new file mode 100644
> > index 0000000..40c56d1
> > --- /dev/null
> > +++ b/stubs/get-next-serial.c
> > @@ -0,0 +1,3 @@
> > +#include "qemu-common.h"
> > +
> > +CharDriverState *serial_hds[0];
> > diff --git a/stubs/is-daemonized.c b/stubs/is-daemonized.c
> > new file mode 100644
> > index 0000000..16ce7c7
> > --- /dev/null
> > +++ b/stubs/is-daemonized.c
> > @@ -0,0 +1,7 @@
> > +#include "qemu-common.h"
> > +#include "sysemu/os-posix.h"
> > +
> > +bool is_daemonized(void)
> > +{
> > +    return true;
> > +}
> > diff --git a/stubs/machine-init-done.c b/stubs/machine-init-done.c
> > new file mode 100644
> > index 0000000..28a9255
> > --- /dev/null
> > +++ b/stubs/machine-init-done.c
> > @@ -0,0 +1,6 @@
> > +#include "qemu-common.h"
> > +#include "sysemu/sysemu.h"
> > +
> > +void qemu_add_machine_init_done_notifier(Notifier *notify)
> > +{
> > +}
> > diff --git a/stubs/monitor-init.c b/stubs/monitor-init.c
> > new file mode 100644
> > index 0000000..563902b
> > --- /dev/null
> > +++ b/stubs/monitor-init.c
> > @@ -0,0 +1,6 @@
> > +#include "qemu-common.h"
> > +#include "monitor/monitor.h"
> > +
> > +void monitor_init(CharDriverState *chr, int flags)
> > +{
> > +}
> > diff --git a/stubs/notify-event.c b/stubs/notify-event.c
> > new file mode 100644
> > index 0000000..32f7289
> > --- /dev/null
> > +++ b/stubs/notify-event.c
> > @@ -0,0 +1,6 @@
> > +#include "qemu-common.h"
> > +#include "qemu/main-loop.h"
> > +
> > +void qemu_notify_event(void)
> > +{
> > +}
> > diff --git a/stubs/vc-init.c b/stubs/vc-init.c
> > new file mode 100644
> > index 0000000..2af054f
> > --- /dev/null
> > +++ b/stubs/vc-init.c
> > @@ -0,0 +1,7 @@
> > +#include "qemu-common.h"
> > +#include "ui/console.h"
> > +
> > +CharDriverState *vc_init(ChardevVC *vc)
> > +{
> > +    return 0;
> > +}
> > diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> > index d99e2b9..5a0b917 100644
> > --- a/stubs/Makefile.objs
> > +++ b/stubs/Makefile.objs
> > @@ -1,4 +1,6 @@
> >  stub-obj-y += arch-query-cpu-def.o
> > +stub-obj-y += bdrv-commit-all.o
> > +stub-obj-y += chr-msmouse.o
> >  stub-obj-y += clock-warp.o
> >  stub-obj-y += cpu-get-clock.o
> >  stub-obj-y += cpu-get-icount.o
> > @@ -9,13 +11,18 @@ stub-obj-y += fdset-get-fd.o
> >  stub-obj-y += fdset-remove-fd.o
> >  stub-obj-y += gdbstub.o
> >  stub-obj-y += get-fd.o
> > +stub-obj-y += get-next-serial.o
> >  stub-obj-y += get-vm-name.o
> >  stub-obj-y += iothread-lock.o
> > +stub-obj-y += is-daemonized.o
> > +stub-obj-y += machine-init-done.o
> >  stub-obj-y += migr-blocker.o
> >  stub-obj-y += mon-is-qmp.o
> >  stub-obj-y += mon-printf.o
> >  stub-obj-y += mon-protocol-event.o
> >  stub-obj-y += mon-set-error.o
> > +stub-obj-y += monitor-init.o
> > +stub-obj-y += notify-event.o
> >  stub-obj-y += pci-drive-hot-add.o
> >  stub-obj-y += qtest.o
> >  stub-obj-y += reset.o
> > @@ -24,6 +31,7 @@ stub-obj-y += set-fd-handler.o
> >  stub-obj-y += slirp.o
> >  stub-obj-y += sysbus.o
> >  stub-obj-y += uuid.o
> > +stub-obj-y += vc-init.o
> >  stub-obj-y += vm-stop.o
> >  stub-obj-y += vmstate.o
> >  stub-obj-$(CONFIG_WIN32) += fd-register.o
> > -- 
> > MST
> >
diff mbox

Patch

diff --git a/stubs/bdrv-commit-all.c b/stubs/bdrv-commit-all.c
new file mode 100644
index 0000000..a8e0a95
--- /dev/null
+++ b/stubs/bdrv-commit-all.c
@@ -0,0 +1,7 @@ 
+#include "qemu-common.h"
+#include "block/block.h"
+
+int bdrv_commit_all(void)
+{
+    return 0;
+}
diff --git a/stubs/chr-msmouse.c b/stubs/chr-msmouse.c
new file mode 100644
index 0000000..812f8b0
--- /dev/null
+++ b/stubs/chr-msmouse.c
@@ -0,0 +1,7 @@ 
+#include "qemu-common.h"
+#include "sysemu/char.h"
+
+CharDriverState *qemu_chr_open_msmouse(void)
+{
+    return 0;
+}
diff --git a/stubs/get-next-serial.c b/stubs/get-next-serial.c
new file mode 100644
index 0000000..40c56d1
--- /dev/null
+++ b/stubs/get-next-serial.c
@@ -0,0 +1,3 @@ 
+#include "qemu-common.h"
+
+CharDriverState *serial_hds[0];
diff --git a/stubs/is-daemonized.c b/stubs/is-daemonized.c
new file mode 100644
index 0000000..16ce7c7
--- /dev/null
+++ b/stubs/is-daemonized.c
@@ -0,0 +1,7 @@ 
+#include "qemu-common.h"
+#include "sysemu/os-posix.h"
+
+bool is_daemonized(void)
+{
+    return true;
+}
diff --git a/stubs/machine-init-done.c b/stubs/machine-init-done.c
new file mode 100644
index 0000000..28a9255
--- /dev/null
+++ b/stubs/machine-init-done.c
@@ -0,0 +1,6 @@ 
+#include "qemu-common.h"
+#include "sysemu/sysemu.h"
+
+void qemu_add_machine_init_done_notifier(Notifier *notify)
+{
+}
diff --git a/stubs/monitor-init.c b/stubs/monitor-init.c
new file mode 100644
index 0000000..563902b
--- /dev/null
+++ b/stubs/monitor-init.c
@@ -0,0 +1,6 @@ 
+#include "qemu-common.h"
+#include "monitor/monitor.h"
+
+void monitor_init(CharDriverState *chr, int flags)
+{
+}
diff --git a/stubs/notify-event.c b/stubs/notify-event.c
new file mode 100644
index 0000000..32f7289
--- /dev/null
+++ b/stubs/notify-event.c
@@ -0,0 +1,6 @@ 
+#include "qemu-common.h"
+#include "qemu/main-loop.h"
+
+void qemu_notify_event(void)
+{
+}
diff --git a/stubs/vc-init.c b/stubs/vc-init.c
new file mode 100644
index 0000000..2af054f
--- /dev/null
+++ b/stubs/vc-init.c
@@ -0,0 +1,7 @@ 
+#include "qemu-common.h"
+#include "ui/console.h"
+
+CharDriverState *vc_init(ChardevVC *vc)
+{
+    return 0;
+}
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index d99e2b9..5a0b917 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -1,4 +1,6 @@ 
 stub-obj-y += arch-query-cpu-def.o
+stub-obj-y += bdrv-commit-all.o
+stub-obj-y += chr-msmouse.o
 stub-obj-y += clock-warp.o
 stub-obj-y += cpu-get-clock.o
 stub-obj-y += cpu-get-icount.o
@@ -9,13 +11,18 @@  stub-obj-y += fdset-get-fd.o
 stub-obj-y += fdset-remove-fd.o
 stub-obj-y += gdbstub.o
 stub-obj-y += get-fd.o
+stub-obj-y += get-next-serial.o
 stub-obj-y += get-vm-name.o
 stub-obj-y += iothread-lock.o
+stub-obj-y += is-daemonized.o
+stub-obj-y += machine-init-done.o
 stub-obj-y += migr-blocker.o
 stub-obj-y += mon-is-qmp.o
 stub-obj-y += mon-printf.o
 stub-obj-y += mon-protocol-event.o
 stub-obj-y += mon-set-error.o
+stub-obj-y += monitor-init.o
+stub-obj-y += notify-event.o
 stub-obj-y += pci-drive-hot-add.o
 stub-obj-y += qtest.o
 stub-obj-y += reset.o
@@ -24,6 +31,7 @@  stub-obj-y += set-fd-handler.o
 stub-obj-y += slirp.o
 stub-obj-y += sysbus.o
 stub-obj-y += uuid.o
+stub-obj-y += vc-init.o
 stub-obj-y += vm-stop.o
 stub-obj-y += vmstate.o
 stub-obj-$(CONFIG_WIN32) += fd-register.o