All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/6] build-sys: Fix iscsi module loading failure
@ 2014-08-20 10:01 Fam Zheng
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/ Fam Zheng
                   ` (5 more replies)
  0 siblings, 6 replies; 21+ messages in thread
From: Fam Zheng @ 2014-08-20 10:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, mjt, stefanha

The iscsi driver doesn't work if built with --enable-modules:

$ ~/build/last/qemu-img
Failed to open module: /home/fam/build/master/block-iscsi.so: undefined symbol: qmp_query_uuid
qemu-img: Not enough arguments
Try 'qemu-img --help' for more information

This fixes it by completely linking libqemuutil.a (now qemuutil.o) rather than
on demand.

A few stub functions are added into libqemustub to make linker happy.

Lastly, iqn generation code is moved from iscsi.c to util, so that
qmp_query_uuid or its stub is not missed.

Fam


Fam Zheng (6):
  build-sys: Move fifio8 to hw/
  stubs: Add iohandler.c
  stubs: Add openpty.c
  stubs: Add timer.c
  build-sys: Change libqemuutil.a to qemuutil.o and link whole object
  iscsi: Move iqn generation code to util

 Makefile              |  17 ++++---
 Makefile.objs         |   2 +-
 Makefile.target       |   2 +-
 block/iscsi.c         |  15 +-----
 hw/Makefile.objs      |   1 +
 hw/fifo8.c            | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/qemu-common.h |   3 ++
 stubs/Makefile.objs   |   3 ++
 stubs/iohandler.c     |  20 ++++++++
 stubs/openpty.c       |  21 +++++++++
 stubs/timer.c         |  44 ++++++++++++++++++
 tests/Makefile        |  60 ++++++++++++------------
 util/Makefile.objs    |   2 +-
 util/fifo8.c          | 125 --------------------------------------------------
 util/iqn.c            |  38 +++++++++++++++
 15 files changed, 299 insertions(+), 179 deletions(-)
 create mode 100644 hw/fifo8.c
 create mode 100644 stubs/iohandler.c
 create mode 100644 stubs/openpty.c
 create mode 100644 stubs/timer.c
 delete mode 100644 util/fifo8.c
 create mode 100644 util/iqn.c

-- 
2.0.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/
  2014-08-20 10:01 [Qemu-devel] [PATCH 0/6] build-sys: Fix iscsi module loading failure Fam Zheng
@ 2014-08-20 10:01 ` Fam Zheng
  2014-08-20 13:33   ` Paolo Bonzini
  2014-08-20 14:23   ` Peter Crosthwaite
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 2/6] stubs: Add iohandler.c Fam Zheng
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 21+ messages in thread
From: Fam Zheng @ 2014-08-20 10:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, mjt, stefanha

Since it has a dependency on vmstate and is only used by device
emulation, moving out from util will make the archive more independent.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 hw/Makefile.objs   |   1 +
 hw/fifo8.c         | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 util/Makefile.objs |   1 -
 util/fifo8.c       | 125 -----------------------------------------------------
 4 files changed, 126 insertions(+), 126 deletions(-)
 create mode 100644 hw/fifo8.c
 delete mode 100644 util/fifo8.c

diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 52a1464..bc77dd3 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -33,3 +33,4 @@ devices-dirs-$(CONFIG_MEM_HOTPLUG) += mem/
 devices-dirs-y += core/
 common-obj-y += $(devices-dirs-y)
 obj-y += $(devices-dirs-y)
+obj-y += fifo8.o
diff --git a/hw/fifo8.c b/hw/fifo8.c
new file mode 100644
index 0000000..0ea5ad9
--- /dev/null
+++ b/hw/fifo8.c
@@ -0,0 +1,125 @@
+/*
+ * Generic FIFO component, implemented as a circular buffer.
+ *
+ * Copyright (c) 2012 Peter A. G. Crosthwaite
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "qemu-common.h"
+#include "qemu/fifo8.h"
+
+void fifo8_create(Fifo8 *fifo, uint32_t capacity)
+{
+    fifo->data = g_new(uint8_t, capacity);
+    fifo->capacity = capacity;
+    fifo->head = 0;
+    fifo->num = 0;
+}
+
+void fifo8_destroy(Fifo8 *fifo)
+{
+    g_free(fifo->data);
+}
+
+void fifo8_push(Fifo8 *fifo, uint8_t data)
+{
+    if (fifo->num == fifo->capacity) {
+        abort();
+    }
+    fifo->data[(fifo->head + fifo->num) % fifo->capacity] = data;
+    fifo->num++;
+}
+
+void fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num)
+{
+    uint32_t start, avail;
+
+    if (fifo->num + num > fifo->capacity) {
+        abort();
+    }
+
+    start = (fifo->head + fifo->num) % fifo->capacity;
+
+    if (start + num <= fifo->capacity) {
+        memcpy(&fifo->data[start], data, num);
+    } else {
+        avail = fifo->capacity - start;
+        memcpy(&fifo->data[start], data, avail);
+        memcpy(&fifo->data[0], &data[avail], num - avail);
+    }
+
+    fifo->num += num;
+}
+
+uint8_t fifo8_pop(Fifo8 *fifo)
+{
+    uint8_t ret;
+
+    if (fifo->num == 0) {
+        abort();
+    }
+    ret = fifo->data[fifo->head++];
+    fifo->head %= fifo->capacity;
+    fifo->num--;
+    return ret;
+}
+
+const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num)
+{
+    uint8_t *ret;
+
+    if (max == 0 || max > fifo->num) {
+        abort();
+    }
+    *num = MIN(fifo->capacity - fifo->head, max);
+    ret = &fifo->data[fifo->head];
+    fifo->head += *num;
+    fifo->head %= fifo->capacity;
+    fifo->num -= *num;
+    return ret;
+}
+
+void fifo8_reset(Fifo8 *fifo)
+{
+    fifo->num = 0;
+    fifo->head = 0;
+}
+
+bool fifo8_is_empty(Fifo8 *fifo)
+{
+    return (fifo->num == 0);
+}
+
+bool fifo8_is_full(Fifo8 *fifo)
+{
+    return (fifo->num == fifo->capacity);
+}
+
+uint32_t fifo8_num_free(Fifo8 *fifo)
+{
+    return fifo->capacity - fifo->num;
+}
+
+uint32_t fifo8_num_used(Fifo8 *fifo)
+{
+    return fifo->num;
+}
+
+const VMStateDescription vmstate_fifo8 = {
+    .name = "Fifo8",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .fields = (VMStateField[]) {
+        VMSTATE_VBUFFER_UINT32(data, Fifo8, 1, NULL, 0, capacity),
+        VMSTATE_UINT32(head, Fifo8),
+        VMSTATE_UINT32(num, Fifo8),
+        VMSTATE_END_OF_LIST()
+    }
+};
diff --git a/util/Makefile.objs b/util/Makefile.objs
index 6b3c83b..65a36f6 100644
--- a/util/Makefile.objs
+++ b/util/Makefile.objs
@@ -3,7 +3,6 @@ util-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o event_notifier-win
 util-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o event_notifier-posix.o qemu-openpty.o
 util-obj-y += envlist.o path.o host-utils.o module.o
 util-obj-y += bitmap.o bitops.o hbitmap.o
-util-obj-y += fifo8.o
 util-obj-y += acl.o
 util-obj-y += error.o qemu-error.o
 util-obj-$(CONFIG_POSIX) += compatfd.o
diff --git a/util/fifo8.c b/util/fifo8.c
deleted file mode 100644
index 0ea5ad9..0000000
--- a/util/fifo8.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Generic FIFO component, implemented as a circular buffer.
- *
- * Copyright (c) 2012 Peter A. G. Crosthwaite
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "qemu-common.h"
-#include "qemu/fifo8.h"
-
-void fifo8_create(Fifo8 *fifo, uint32_t capacity)
-{
-    fifo->data = g_new(uint8_t, capacity);
-    fifo->capacity = capacity;
-    fifo->head = 0;
-    fifo->num = 0;
-}
-
-void fifo8_destroy(Fifo8 *fifo)
-{
-    g_free(fifo->data);
-}
-
-void fifo8_push(Fifo8 *fifo, uint8_t data)
-{
-    if (fifo->num == fifo->capacity) {
-        abort();
-    }
-    fifo->data[(fifo->head + fifo->num) % fifo->capacity] = data;
-    fifo->num++;
-}
-
-void fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num)
-{
-    uint32_t start, avail;
-
-    if (fifo->num + num > fifo->capacity) {
-        abort();
-    }
-
-    start = (fifo->head + fifo->num) % fifo->capacity;
-
-    if (start + num <= fifo->capacity) {
-        memcpy(&fifo->data[start], data, num);
-    } else {
-        avail = fifo->capacity - start;
-        memcpy(&fifo->data[start], data, avail);
-        memcpy(&fifo->data[0], &data[avail], num - avail);
-    }
-
-    fifo->num += num;
-}
-
-uint8_t fifo8_pop(Fifo8 *fifo)
-{
-    uint8_t ret;
-
-    if (fifo->num == 0) {
-        abort();
-    }
-    ret = fifo->data[fifo->head++];
-    fifo->head %= fifo->capacity;
-    fifo->num--;
-    return ret;
-}
-
-const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num)
-{
-    uint8_t *ret;
-
-    if (max == 0 || max > fifo->num) {
-        abort();
-    }
-    *num = MIN(fifo->capacity - fifo->head, max);
-    ret = &fifo->data[fifo->head];
-    fifo->head += *num;
-    fifo->head %= fifo->capacity;
-    fifo->num -= *num;
-    return ret;
-}
-
-void fifo8_reset(Fifo8 *fifo)
-{
-    fifo->num = 0;
-    fifo->head = 0;
-}
-
-bool fifo8_is_empty(Fifo8 *fifo)
-{
-    return (fifo->num == 0);
-}
-
-bool fifo8_is_full(Fifo8 *fifo)
-{
-    return (fifo->num == fifo->capacity);
-}
-
-uint32_t fifo8_num_free(Fifo8 *fifo)
-{
-    return fifo->capacity - fifo->num;
-}
-
-uint32_t fifo8_num_used(Fifo8 *fifo)
-{
-    return fifo->num;
-}
-
-const VMStateDescription vmstate_fifo8 = {
-    .name = "Fifo8",
-    .version_id = 1,
-    .minimum_version_id = 1,
-    .fields = (VMStateField[]) {
-        VMSTATE_VBUFFER_UINT32(data, Fifo8, 1, NULL, 0, capacity),
-        VMSTATE_UINT32(head, Fifo8),
-        VMSTATE_UINT32(num, Fifo8),
-        VMSTATE_END_OF_LIST()
-    }
-};
-- 
2.0.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH 2/6] stubs: Add iohandler.c
  2014-08-20 10:01 [Qemu-devel] [PATCH 0/6] build-sys: Fix iscsi module loading failure Fam Zheng
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/ Fam Zheng
@ 2014-08-20 10:01 ` Fam Zheng
  2014-08-20 13:25   ` Paolo Bonzini
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 3/6] stubs: Add openpty.c Fam Zheng
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-08-20 10:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, mjt, stefanha

Add stub function "qemu_set_fd_handler" which is used by
util/event_notifier-posix.c.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 stubs/Makefile.objs |  1 +
 stubs/iohandler.c   | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)
 create mode 100644 stubs/iohandler.c

diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 5e347d0..d9cad1b 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -40,3 +40,4 @@ stub-obj-$(CONFIG_WIN32) += fd-register.o
 stub-obj-y += cpus.o
 stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
+stub-obj-y += iohandler.o
diff --git a/stubs/iohandler.c b/stubs/iohandler.c
new file mode 100644
index 0000000..97c0ce5
--- /dev/null
+++ b/stubs/iohandler.c
@@ -0,0 +1,20 @@
+/*
+ * iohandler stub functions
+ *
+ * Copyright Red Hat, Inc., 2014
+ *
+ * Author: Fam Zheng <famz@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later.  See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/main-loop.h"
+
+int qemu_set_fd_handler(int fd,
+                        IOHandler *fd_read,
+                        IOHandler *fd_write,
+                        void *opaque)
+{
+    abort();
+}
-- 
2.0.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH 3/6] stubs: Add openpty.c
  2014-08-20 10:01 [Qemu-devel] [PATCH 0/6] build-sys: Fix iscsi module loading failure Fam Zheng
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/ Fam Zheng
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 2/6] stubs: Add iohandler.c Fam Zheng
@ 2014-08-20 10:01 ` Fam Zheng
  2014-08-20 13:26   ` Paolo Bonzini
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 4/6] stubs: Add timer.c Fam Zheng
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-08-20 10:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, mjt, stefanha

Add function "openpty" which is used by util/qemu-openpty.c.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 stubs/Makefile.objs |  1 +
 stubs/openpty.c     | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 stubs/openpty.c

diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index d9cad1b..f5d2cdd 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -41,3 +41,4 @@ stub-obj-y += cpus.o
 stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += iohandler.o
+stub-obj-y += openpty.o
diff --git a/stubs/openpty.c b/stubs/openpty.c
new file mode 100644
index 0000000..31e6ff5
--- /dev/null
+++ b/stubs/openpty.c
@@ -0,0 +1,21 @@
+/*
+ * openpty stub
+ *
+ * Copyright Red Hat, Inc., 2014
+ *
+ * Author: Fam Zheng <famz@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later.  See the COPYING file in the top-level directory.
+ */
+
+#include <stdlib.h>
+#include <pty.h>
+
+int openpty(int *amaster, int *aslave, char *name,
+            const struct termios *termp,
+            const struct winsize *winp)
+{
+    abort();
+}
+
-- 
2.0.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH 4/6] stubs: Add timer.c
  2014-08-20 10:01 [Qemu-devel] [PATCH 0/6] build-sys: Fix iscsi module loading failure Fam Zheng
                   ` (2 preceding siblings ...)
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 3/6] stubs: Add openpty.c Fam Zheng
@ 2014-08-20 10:01 ` Fam Zheng
  2014-08-20 13:27   ` Paolo Bonzini
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 5/6] build-sys: Change libqemuutil.a to qemuutil.o and link whole object Fam Zheng
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util Fam Zheng
  5 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-08-20 10:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, mjt, stefanha

Add timer functions that are used in util/throttle.c.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 stubs/Makefile.objs |  1 +
 stubs/timer.c       | 44 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 stubs/timer.c

diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index f5d2cdd..1d433f3 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -42,3 +42,4 @@ stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += iohandler.o
 stub-obj-y += openpty.o
+stub-obj-y += timer.o
diff --git a/stubs/timer.c b/stubs/timer.c
new file mode 100644
index 0000000..17e25c9
--- /dev/null
+++ b/stubs/timer.c
@@ -0,0 +1,44 @@
+/*
+ * timer stub functions
+ *
+ * Copyright Red Hat, Inc., 2014
+ *
+ * Author: Fam Zheng <famz@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later.  See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/timer.h"
+
+void timer_del(QEMUTimer *ts)
+{
+    abort();
+}
+
+void timer_init(QEMUTimer *ts,
+                QEMUTimerList *timer_list, int scale,
+                QEMUTimerCB *cb, void *opaque)
+{
+    abort();
+}
+
+void timer_free(QEMUTimer *ts)
+{
+    abort();
+}
+
+int64_t qemu_clock_get_ns(QEMUClockType type)
+{
+    abort();
+}
+
+void timer_mod(QEMUTimer *ts, int64_t expire_time)
+{
+    abort();
+}
+
+bool timer_pending(QEMUTimer *ts)
+{
+    abort();
+}
-- 
2.0.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH 5/6] build-sys: Change libqemuutil.a to qemuutil.o and link whole object
  2014-08-20 10:01 [Qemu-devel] [PATCH 0/6] build-sys: Fix iscsi module loading failure Fam Zheng
                   ` (3 preceding siblings ...)
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 4/6] stubs: Add timer.c Fam Zheng
@ 2014-08-20 10:01 ` Fam Zheng
  2014-08-20 13:29   ` Paolo Bonzini
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util Fam Zheng
  5 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-08-20 10:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, mjt, stefanha

When an executable is being generated, unused functions from
libqemuutil.a are not linked. This is the linker's convention on
archives (libqemuutil.a).

Now that we have dynamically loaded modules, which may reference
function from libqemuutil.a but not linked in the executable, because
the executable itself didn't reference this symbol. That is a problem
for module build.

We can't link both executable and the dynamic shared object to
libqemuutil.a, because of the risk of inconsistent views of program
variables: DSO module sees a copy of some data because it is linked
against libqemuutil.a, whereas the executable sees another copy. In
other words, they each maintains a copy but with a same name. In this
case, it can be very tricky to notice such a duplication, and make a bug
hard to reason. So it's good to avoid it from the beginning.

This patch solves the above issue by fully linking. Specifically, it
fixes block-iscsi.mo: in block/iscsi.c, util/bitmap.c functions are
used, but qemu-img doesn't link it.

The solution is to link everything in libqemuutil.a. We do this by
changing it to qemuutil.o, which includes all the util objects. This is
easier and also expected to be more portable than "--whole-archive".

Because qemuutil.o is now fully linked and hence make executables
references more symbols than before, some test executables now need
libqemustub.a, so add them as necessary too.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 Makefile        | 17 +++++++++-------
 Makefile.objs   |  2 +-
 Makefile.target |  2 +-
 tests/Makefile  | 60 ++++++++++++++++++++++++++++-----------------------------
 4 files changed, 42 insertions(+), 39 deletions(-)

diff --git a/Makefile b/Makefile
index b33aaac..7cf5e51 100644
--- a/Makefile
+++ b/Makefile
@@ -187,7 +187,7 @@ subdir-dtc:dtc/libfdt dtc/tests
 dtc/%:
 	mkdir -p $@
 
-$(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y)
+$(SUBDIR_RULES): qemuutil.o libqemustub.a $(common-obj-y)
 
 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 romsubdir-%:
@@ -208,7 +208,10 @@ Makefile: $(version-obj-y) $(version-lobj-y)
 # Build libraries
 
 libqemustub.a: $(stub-obj-y)
-libqemuutil.a: $(util-obj-y)
+
+qemuutil.o: CC_REL_FLAGS := -Wl,-r
+qemuutil.o: $(util-obj-y)
+	$(call quiet-command,$(CC) -nostdlib $(CC_REL_FLAGS) -o $@ $^,"  LD -r  $(TARGET_DIR)$@")
 
 block-modules = $(foreach o,$(block-obj-m),"$(basename $(subst /,-,$o))",) NULL
 util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'
@@ -217,13 +220,13 @@ util/module.o-cflags = -D'CONFIG_BLOCK_MODULES=$(block-modules)'
 
 qemu-img.o: qemu-img-cmds.h
 
-qemu-img$(EXESUF): qemu-img.o $(block-obj-y) libqemuutil.a libqemustub.a
-qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) libqemuutil.a libqemustub.a
-qemu-io$(EXESUF): qemu-io.o $(block-obj-y) libqemuutil.a libqemustub.a
+qemu-img$(EXESUF): qemu-img.o $(block-obj-y) qemuutil.o libqemustub.a
+qemu-nbd$(EXESUF): qemu-nbd.o $(block-obj-y) qemuutil.o libqemustub.a
+qemu-io$(EXESUF): qemu-io.o $(block-obj-y) qemuutil.o libqemustub.a
 
 qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
 
-fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o libqemuutil.a libqemustub.a
+fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o qemuutil.o libqemustub.a
 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
 
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
@@ -280,7 +283,7 @@ $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py)
 QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h)
 $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
 
-qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
+qemu-ga$(EXESUF): $(qga-obj-y) qemuutil.o libqemustub.a
 	$(call LINK, $^)
 
 clean:
diff --git a/Makefile.objs b/Makefile.objs
index 97db978..4847da7 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -109,6 +109,6 @@ target-obj-y += trace/
 # guest agent
 
 # FIXME: a few definitions from qapi-types.o/qapi-visit.o are needed
-# by libqemuutil.a.  These should be moved to a separate .json schema.
+# by qemuutil.o.  These should be moved to a separate .json schema.
 qga-obj-y = qga/
 qga-vss-dll-obj-y = qga/
diff --git a/Makefile.target b/Makefile.target
index 1e8d7ab..48a3089 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -176,7 +176,7 @@ all-obj-y += $(target-obj-y)
 all-obj-$(CONFIG_SOFTMMU) += $(block-obj-y)
 
 # build either PROG or PROGW
-$(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
+$(QEMU_PROG_BUILD): $(all-obj-y) ../qemuutil.o ../libqemustub.a
 	$(call LINK,$^)
 
 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
diff --git a/tests/Makefile b/tests/Makefile
index 837e9c8..b79a299 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -226,22 +226,22 @@ qom-core-obj = qom/object.o qom/qom-qobject.o qom/container.o
 
 tests/test-x86-cpuid.o: QEMU_INCLUDES += -I$(SRC_PATH)/target-i386
 
-tests/check-qint$(EXESUF): tests/check-qint.o libqemuutil.a
-tests/check-qstring$(EXESUF): tests/check-qstring.o libqemuutil.a
-tests/check-qdict$(EXESUF): tests/check-qdict.o libqemuutil.a
-tests/check-qlist$(EXESUF): tests/check-qlist.o libqemuutil.a
-tests/check-qfloat$(EXESUF): tests/check-qfloat.o libqemuutil.a
-tests/check-qjson$(EXESUF): tests/check-qjson.o libqemuutil.a libqemustub.a
-tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(qom-core-obj) libqemuutil.a libqemustub.a
-tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(block-obj-y) libqemuutil.a libqemustub.a
-tests/test-aio$(EXESUF): tests/test-aio.o $(block-obj-y) libqemuutil.a libqemustub.a
-tests/test-rfifolock$(EXESUF): tests/test-rfifolock.o libqemuutil.a libqemustub.a
-tests/test-throttle$(EXESUF): tests/test-throttle.o $(block-obj-y) libqemuutil.a libqemustub.a
-tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(block-obj-y) libqemuutil.a libqemustub.a
-tests/test-iov$(EXESUF): tests/test-iov.o libqemuutil.a
-tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o libqemuutil.a libqemustub.a
+tests/check-qint$(EXESUF): tests/check-qint.o qemuutil.o libqemustub.a
+tests/check-qstring$(EXESUF): tests/check-qstring.o qemuutil.o libqemustub.a
+tests/check-qdict$(EXESUF): tests/check-qdict.o qemuutil.o libqemustub.a
+tests/check-qlist$(EXESUF): tests/check-qlist.o qemuutil.o libqemustub.a
+tests/check-qfloat$(EXESUF): tests/check-qfloat.o qemuutil.o libqemustub.a
+tests/check-qjson$(EXESUF): tests/check-qjson.o qemuutil.o libqemustub.a
+tests/check-qom-interface$(EXESUF): tests/check-qom-interface.o $(qom-core-obj) qemuutil.o libqemustub.a
+tests/test-coroutine$(EXESUF): tests/test-coroutine.o $(block-obj-y) qemuutil.o libqemustub.a
+tests/test-aio$(EXESUF): tests/test-aio.o $(block-obj-y) qemuutil.o libqemustub.a
+tests/test-rfifolock$(EXESUF): tests/test-rfifolock.o qemuutil.o libqemustub.a
+tests/test-throttle$(EXESUF): tests/test-throttle.o $(block-obj-y) qemuutil.o libqemustub.a
+tests/test-thread-pool$(EXESUF): tests/test-thread-pool.o $(block-obj-y) qemuutil.o libqemustub.a
+tests/test-iov$(EXESUF): tests/test-iov.o qemuutil.o libqemustub.a
+tests/test-hbitmap$(EXESUF): tests/test-hbitmap.o qemuutil.o libqemustub.a
 tests/test-x86-cpuid$(EXESUF): tests/test-x86-cpuid.o
-tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o xbzrle.o page_cache.o libqemuutil.a
+tests/test-xbzrle$(EXESUF): tests/test-xbzrle.o xbzrle.o page_cache.o qemuutil.o libqemustub.a
 tests/test-cutils$(EXESUF): tests/test-cutils.o util/cutils.o
 tests/test-int128$(EXESUF): tests/test-int128.o
 tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
@@ -250,10 +250,10 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
 	hw/core/fw-path-provider.o \
 	$(qom-core-obj) \
 	$(test-qapi-obj-y) \
-	libqemuutil.a libqemustub.a
+	qemuutil.o libqemustub.a
 tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
 	vmstate.o qemu-file.o \
-	libqemuutil.a
+	qemuutil.o libqemustub.a
 
 tests/test-qapi-types.c tests/test-qapi-types.h :\
 $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py
@@ -276,18 +276,18 @@ $(SRC_PATH)/tests/qapi-schema/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-eve
 		$(gen-out-type) -o tests -p "test-" -i $<, \
 		"  GEN   $@")
 
-tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
-tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
-tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
-tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
-tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
-tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
-tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
-tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
-tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y) libqemuutil.a libqemustub.a
+tests/test-string-output-visitor$(EXESUF): tests/test-string-output-visitor.o $(test-qapi-obj-y) qemuutil.o libqemustub.a
+tests/test-string-input-visitor$(EXESUF): tests/test-string-input-visitor.o $(test-qapi-obj-y) qemuutil.o libqemustub.a
+tests/test-qmp-event$(EXESUF): tests/test-qmp-event.o $(test-qapi-obj-y) qemuutil.o libqemustub.a
+tests/test-qmp-output-visitor$(EXESUF): tests/test-qmp-output-visitor.o $(test-qapi-obj-y) qemuutil.o libqemustub.a
+tests/test-qmp-input-visitor$(EXESUF): tests/test-qmp-input-visitor.o $(test-qapi-obj-y) qemuutil.o libqemustub.a
+tests/test-qmp-input-strict$(EXESUF): tests/test-qmp-input-strict.o $(test-qapi-obj-y) qemuutil.o libqemustub.a
+tests/test-qmp-commands$(EXESUF): tests/test-qmp-commands.o tests/test-qmp-marshal.o $(test-qapi-obj-y) qemuutil.o libqemustub.a
+tests/test-visitor-serialization$(EXESUF): tests/test-visitor-serialization.o $(test-qapi-obj-y) qemuutil.o libqemustub.a
+tests/test-opts-visitor$(EXESUF): tests/test-opts-visitor.o $(test-qapi-obj-y) qemuutil.o libqemustub.a
 
-tests/test-mul64$(EXESUF): tests/test-mul64.o libqemuutil.a
-tests/test-bitops$(EXESUF): tests/test-bitops.o libqemuutil.a
+tests/test-mul64$(EXESUF): tests/test-mul64.o qemuutil.o libqemustub.a
+tests/test-bitops$(EXESUF): tests/test-bitops.o qemuutil.o libqemustub.a
 
 libqos-obj-y = tests/libqos/pci.o tests/libqos/fw_cfg.o
 libqos-obj-y += tests/libqos/i2c.o
@@ -338,7 +338,7 @@ tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
 tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
 tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y)
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
-tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
+tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o qemuutil.o libqemustub.a
 
 ifeq ($(CONFIG_POSIX),y)
 LIBS += -lutil
@@ -352,7 +352,7 @@ QTEST_TARGETS=$(foreach TARGET,$(TARGETS), $(if $(check-qtest-$(TARGET)-y), $(TA
 check-qtest-y=$(foreach TARGET,$(TARGETS), $(check-qtest-$(TARGET)-y))
 endif
 
-qtest-obj-y = tests/libqtest.o libqemuutil.a libqemustub.a
+qtest-obj-y = tests/libqtest.o qemuutil.o libqemustub.a
 $(check-qtest-y): $(qtest-obj-y)
 
 .PHONY: check-help
-- 
2.0.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util
  2014-08-20 10:01 [Qemu-devel] [PATCH 0/6] build-sys: Fix iscsi module loading failure Fam Zheng
                   ` (4 preceding siblings ...)
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 5/6] build-sys: Change libqemuutil.a to qemuutil.o and link whole object Fam Zheng
@ 2014-08-20 10:01 ` Fam Zheng
  2014-08-20 13:32   ` Paolo Bonzini
  5 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-08-20 10:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, mjt, stefanha

Function qmp_query_uuid, even with a version in libqemustub.a, is not
present in qemu-img, unless we move it to something that is linked with
block-obj-y. Since it's a helper function, move it to util makes sense.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/iscsi.c         | 15 +--------------
 include/qemu-common.h |  3 +++
 util/Makefile.objs    |  1 +
 util/iqn.c            | 38 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 43 insertions(+), 14 deletions(-)
 create mode 100644 util/iqn.c

diff --git a/block/iscsi.c b/block/iscsi.c
index 2c9cfc1..b09f539 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -37,8 +37,6 @@
 #include "trace.h"
 #include "block/scsi.h"
 #include "qemu/iov.h"
-#include "sysemu/sysemu.h"
-#include "qmp-commands.h"
 
 #include <iscsi/iscsi.h>
 #include <iscsi/scsi-lowlevel.h>
@@ -1034,8 +1032,6 @@ static char *parse_initiator_name(const char *target)
     QemuOptsList *list;
     QemuOpts *opts;
     const char *name;
-    char *iscsi_name;
-    UuidInfo *uuid_info;
 
     list = qemu_find_opts("iscsi");
     if (list) {
@@ -1051,16 +1047,7 @@ static char *parse_initiator_name(const char *target)
         }
     }
 
-    uuid_info = qmp_query_uuid(NULL);
-    if (strcmp(uuid_info->UUID, UUID_NONE) == 0) {
-        name = qemu_get_vm_name();
-    } else {
-        name = uuid_info->UUID;
-    }
-    iscsi_name = g_strdup_printf("iqn.2008-11.org.linux-kvm%s%s",
-                                 name ? ":" : "", name ? name : "");
-    qapi_free_UuidInfo(uuid_info);
-    return iscsi_name;
+    return iqn_generate("iqn.2008-11.org.linux-kvm");
 }
 
 static void iscsi_nop_timed_event(void *opaque)
diff --git a/include/qemu-common.h b/include/qemu-common.h
index bcf7a6a..ba7700f 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -420,6 +420,9 @@ int uleb128_decode_small(const uint8_t *in, uint32_t *n);
 /* unicode.c */
 int mod_utf8_codepoint(const char *s, size_t n, char **end);
 
+/* iqn.c */
+char *iqn_generate(const char *prefix);
+
 /*
  * Hexdump a buffer to a file. An optional string prefix is added to every line
  */
diff --git a/util/Makefile.objs b/util/Makefile.objs
index 65a36f6..5c043e9 100644
--- a/util/Makefile.objs
+++ b/util/Makefile.objs
@@ -14,3 +14,4 @@ util-obj-y += throttle.o
 util-obj-y += getauxval.o
 util-obj-y += readline.o
 util-obj-y += rfifolock.o
+util-obj-y += iqn.o
diff --git a/util/iqn.c b/util/iqn.c
new file mode 100644
index 0000000..c8d1eda
--- /dev/null
+++ b/util/iqn.c
@@ -0,0 +1,38 @@
+/*
+ * iqn generat function
+ *
+ * Copyright Red Hat, Inc., 2014
+ *
+ * Author: Paolo Bonzini <pbonzini@redhat.com>
+ *         Fam Zheng <famz@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later.  See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include "qemu/error-report.h"
+#include "qemu-common.h"
+#include "sysemu/sysemu.h"
+#include "qmp-commands.h"
+
+char *iqn_generate(const char *prefix)
+{
+    const char *name;
+    char *iqn;
+    UuidInfo *uuid_info;
+
+    uuid_info = qmp_query_uuid(NULL);
+    if (strcmp(uuid_info->UUID, UUID_NONE) == 0) {
+        name = qemu_get_vm_name();
+    } else {
+        name = uuid_info->UUID;
+    }
+    iqn = g_strdup_printf("%s%s%s",
+                                 prefix,
+                                 name ? ":" : "",
+                                 name ? : "");
+    qapi_free_UuidInfo(uuid_info);
+
+    return iqn;
+}
-- 
2.0.3

^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 2/6] stubs: Add iohandler.c
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 2/6] stubs: Add iohandler.c Fam Zheng
@ 2014-08-20 13:25   ` Paolo Bonzini
  0 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2014-08-20 13:25 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: kwolf, mjt, stefanha

Il 20/08/2014 12:01, Fam Zheng ha scritto:
> Add stub function "qemu_set_fd_handler" which is used by
> util/event_notifier-posix.c.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  stubs/Makefile.objs |  1 +
>  stubs/iohandler.c   | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+)
>  create mode 100644 stubs/iohandler.c
> 
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index 5e347d0..d9cad1b 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -40,3 +40,4 @@ stub-obj-$(CONFIG_WIN32) += fd-register.o
>  stub-obj-y += cpus.o
>  stub-obj-y += kvm.o
>  stub-obj-y += qmp_pc_dimm_device_list.o
> +stub-obj-y += iohandler.o
> diff --git a/stubs/iohandler.c b/stubs/iohandler.c
> new file mode 100644
> index 0000000..97c0ce5
> --- /dev/null
> +++ b/stubs/iohandler.c
> @@ -0,0 +1,20 @@
> +/*
> + * iohandler stub functions
> + *
> + * Copyright Red Hat, Inc., 2014
> + *
> + * Author: Fam Zheng <famz@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or
> + * later.  See the COPYING file in the top-level directory.
> + */
> +
> +#include "qemu/main-loop.h"
> +
> +int qemu_set_fd_handler(int fd,
> +                        IOHandler *fd_read,
> +                        IOHandler *fd_write,
> +                        void *opaque)
> +{
> +    abort();
> +}
> 

Please merge with stubs/set-fd-handler.c.

Paolo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 3/6] stubs: Add openpty.c
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 3/6] stubs: Add openpty.c Fam Zheng
@ 2014-08-20 13:26   ` Paolo Bonzini
  0 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2014-08-20 13:26 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: kwolf, mjt, stefanha

Il 20/08/2014 12:01, Fam Zheng ha scritto:
> Add function "openpty" which is used by util/qemu-openpty.c.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  stubs/Makefile.objs |  1 +
>  stubs/openpty.c     | 21 +++++++++++++++++++++
>  2 files changed, 22 insertions(+)
>  create mode 100644 stubs/openpty.c
> 
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index d9cad1b..f5d2cdd 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -41,3 +41,4 @@ stub-obj-y += cpus.o
>  stub-obj-y += kvm.o
>  stub-obj-y += qmp_pc_dimm_device_list.o
>  stub-obj-y += iohandler.o
> +stub-obj-y += openpty.o
> diff --git a/stubs/openpty.c b/stubs/openpty.c
> new file mode 100644
> index 0000000..31e6ff5
> --- /dev/null
> +++ b/stubs/openpty.c
> @@ -0,0 +1,21 @@
> +/*
> + * openpty stub
> + *
> + * Copyright Red Hat, Inc., 2014
> + *
> + * Author: Fam Zheng <famz@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or
> + * later.  See the COPYING file in the top-level directory.
> + */
> +
> +#include <stdlib.h>
> +#include <pty.h>
> +
> +int openpty(int *amaster, int *aslave, char *name,
> +            const struct termios *termp,
> +            const struct winsize *winp)
> +{
> +    abort();
> +}
> +
> 

Please move -lutil from libs_softmmu to LIBS instead.

Paolo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 4/6] stubs: Add timer.c
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 4/6] stubs: Add timer.c Fam Zheng
@ 2014-08-20 13:27   ` Paolo Bonzini
  0 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2014-08-20 13:27 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: kwolf, mjt, stefanha

Il 20/08/2014 12:01, Fam Zheng ha scritto:
> Add timer functions that are used in util/throttle.c.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  stubs/Makefile.objs |  1 +
>  stubs/timer.c       | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+)
>  create mode 100644 stubs/timer.c
> 
> diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
> index f5d2cdd..1d433f3 100644
> --- a/stubs/Makefile.objs
> +++ b/stubs/Makefile.objs
> @@ -42,3 +42,4 @@ stub-obj-y += kvm.o
>  stub-obj-y += qmp_pc_dimm_device_list.o
>  stub-obj-y += iohandler.o
>  stub-obj-y += openpty.o
> +stub-obj-y += timer.o
> diff --git a/stubs/timer.c b/stubs/timer.c
> new file mode 100644
> index 0000000..17e25c9
> --- /dev/null
> +++ b/stubs/timer.c
> @@ -0,0 +1,44 @@
> +/*
> + * timer stub functions
> + *
> + * Copyright Red Hat, Inc., 2014
> + *
> + * Author: Fam Zheng <famz@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or
> + * later.  See the COPYING file in the top-level directory.
> + */
> +
> +#include "qemu/timer.h"
> +
> +void timer_del(QEMUTimer *ts)
> +{
> +    abort();
> +}
> +
> +void timer_init(QEMUTimer *ts,
> +                QEMUTimerList *timer_list, int scale,
> +                QEMUTimerCB *cb, void *opaque)
> +{
> +    abort();
> +}
> +
> +void timer_free(QEMUTimer *ts)
> +{
> +    abort();
> +}
> +
> +int64_t qemu_clock_get_ns(QEMUClockType type)
> +{
> +    abort();
> +}
> +
> +void timer_mod(QEMUTimer *ts, int64_t expire_time)
> +{
> +    abort();
> +}
> +
> +bool timer_pending(QEMUTimer *ts)
> +{
> +    abort();
> +}
> 

Who uses these?  The tests?

Perhaps util/throttle.c can be moved to the root and added to block-obj-y.

Paolo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 5/6] build-sys: Change libqemuutil.a to qemuutil.o and link whole object
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 5/6] build-sys: Change libqemuutil.a to qemuutil.o and link whole object Fam Zheng
@ 2014-08-20 13:29   ` Paolo Bonzini
  2014-08-21  3:02     ` Fam Zheng
  0 siblings, 1 reply; 21+ messages in thread
From: Paolo Bonzini @ 2014-08-20 13:29 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: kwolf, mjt, stefanha

Il 20/08/2014 12:01, Fam Zheng ha scritto:
> +
> +qemuutil.o: CC_REL_FLAGS := -Wl,-r

Why the target-specific rule?

> +qemuutil.o: $(util-obj-y)
> +	$(call quiet-command,$(CC) -nostdlib $(CC_REL_FLAGS) -o $@ $^,"  LD -r  $(TARGET_DIR)$@")
>  


I think either you have

LD_REL := $(CC) -nostdlib -Wl,-r

(as opposed to "LD_REL := $(LD) -r" for example) or you do not need to
put -Wl,-r in a separate variable.

Paolo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util Fam Zheng
@ 2014-08-20 13:32   ` Paolo Bonzini
  2014-08-20 15:03     ` Fam Zheng
  2014-08-21  3:54     ` Fam Zheng
  0 siblings, 2 replies; 21+ messages in thread
From: Paolo Bonzini @ 2014-08-20 13:32 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: kwolf, mjt, stefanha

Il 20/08/2014 12:01, Fam Zheng ha scritto:
> Function qmp_query_uuid, even with a version in libqemustub.a, is not
> present in qemu-img, unless we move it to something that is linked with
> block-obj-y. Since it's a helper function, move it to util makes sense.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  block/iscsi.c         | 15 +--------------
>  include/qemu-common.h |  3 +++
>  util/Makefile.objs    |  1 +
>  util/iqn.c            | 38 ++++++++++++++++++++++++++++++++++++++
>  4 files changed, 43 insertions(+), 14 deletions(-)
>  create mode 100644 util/iqn.c
> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index 2c9cfc1..b09f539 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -37,8 +37,6 @@
>  #include "trace.h"
>  #include "block/scsi.h"
>  #include "qemu/iov.h"
> -#include "sysemu/sysemu.h"
> -#include "qmp-commands.h"
>  
>  #include <iscsi/iscsi.h>
>  #include <iscsi/scsi-lowlevel.h>
> @@ -1034,8 +1032,6 @@ static char *parse_initiator_name(const char *target)
>      QemuOptsList *list;
>      QemuOpts *opts;
>      const char *name;
> -    char *iscsi_name;
> -    UuidInfo *uuid_info;
>  
>      list = qemu_find_opts("iscsi");
>      if (list) {
> @@ -1051,16 +1047,7 @@ static char *parse_initiator_name(const char *target)
>          }
>      }
>  
> -    uuid_info = qmp_query_uuid(NULL);
> -    if (strcmp(uuid_info->UUID, UUID_NONE) == 0) {
> -        name = qemu_get_vm_name();
> -    } else {
> -        name = uuid_info->UUID;
> -    }
> -    iscsi_name = g_strdup_printf("iqn.2008-11.org.linux-kvm%s%s",
> -                                 name ? ":" : "", name ? name : "");
> -    qapi_free_UuidInfo(uuid_info);
> -    return iscsi_name;
> +    return iqn_generate("iqn.2008-11.org.linux-kvm");
>  }
>  
>  static void iscsi_nop_timed_event(void *opaque)
> diff --git a/include/qemu-common.h b/include/qemu-common.h
> index bcf7a6a..ba7700f 100644
> --- a/include/qemu-common.h
> +++ b/include/qemu-common.h
> @@ -420,6 +420,9 @@ int uleb128_decode_small(const uint8_t *in, uint32_t *n);
>  /* unicode.c */
>  int mod_utf8_codepoint(const char *s, size_t n, char **end);
>  
> +/* iqn.c */
> +char *iqn_generate(const char *prefix);
> +
>  /*
>   * Hexdump a buffer to a file. An optional string prefix is added to every line
>   */
> diff --git a/util/Makefile.objs b/util/Makefile.objs
> index 65a36f6..5c043e9 100644
> --- a/util/Makefile.objs
> +++ b/util/Makefile.objs
> @@ -14,3 +14,4 @@ util-obj-y += throttle.o
>  util-obj-y += getauxval.o
>  util-obj-y += readline.o
>  util-obj-y += rfifolock.o
> +util-obj-y += iqn.o
> diff --git a/util/iqn.c b/util/iqn.c
> new file mode 100644
> index 0000000..c8d1eda
> --- /dev/null
> +++ b/util/iqn.c
> @@ -0,0 +1,38 @@
> +/*
> + * iqn generat function
> + *
> + * Copyright Red Hat, Inc., 2014
> + *
> + * Author: Paolo Bonzini <pbonzini@redhat.com>

Why me? :)

> + *         Fam Zheng <famz@redhat.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or
> + * later.  See the COPYING file in the top-level directory.
> + */
> +
> +#include <glib.h>
> +#include "qemu/error-report.h"
> +#include "qemu-common.h"
> +#include "sysemu/sysemu.h"
> +#include "qmp-commands.h"
> +
> +char *iqn_generate(const char *prefix)
> +{
> +    const char *name;
> +    char *iqn;
> +    UuidInfo *uuid_info;
> +
> +    uuid_info = qmp_query_uuid(NULL);
> +    if (strcmp(uuid_info->UUID, UUID_NONE) == 0) {
> +        name = qemu_get_vm_name();
> +    } else {
> +        name = uuid_info->UUID;
> +    }
> +    iqn = g_strdup_printf("%s%s%s",
> +                                 prefix,
> +                                 name ? ":" : "",
> +                                 name ? : "");
> +    qapi_free_UuidInfo(uuid_info);
> +
> +    return iqn;
> +}
> 

Ouch, this is ugly... I cannot think of any other way to do it, but
perhaps Benoit's QMP-in-tools series could help here?

In any case, if we need it I think there's no need to keep the argument
to iqn_generate.

Paolo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/ Fam Zheng
@ 2014-08-20 13:33   ` Paolo Bonzini
  2014-08-20 14:23   ` Peter Crosthwaite
  1 sibling, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2014-08-20 13:33 UTC (permalink / raw)
  To: Fam Zheng, qemu-devel; +Cc: kwolf, mjt, stefanha

Typo in the subject, and please set up git to do rename detection
correctly.  I still could review the patch by checking the hashes in the
"index" lines, so:

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>

Il 20/08/2014 12:01, Fam Zheng ha scritto:
> Since it has a dependency on vmstate and is only used by device
> emulation, moving out from util will make the archive more independent.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  hw/Makefile.objs   |   1 +
>  hw/fifo8.c         | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  util/Makefile.objs |   1 -
>  util/fifo8.c       | 125 -----------------------------------------------------
>  4 files changed, 126 insertions(+), 126 deletions(-)
>  create mode 100644 hw/fifo8.c
>  delete mode 100644 util/fifo8.c
> 
> diff --git a/hw/Makefile.objs b/hw/Makefile.objs
> index 52a1464..bc77dd3 100644
> --- a/hw/Makefile.objs
> +++ b/hw/Makefile.objs
> @@ -33,3 +33,4 @@ devices-dirs-$(CONFIG_MEM_HOTPLUG) += mem/
>  devices-dirs-y += core/
>  common-obj-y += $(devices-dirs-y)
>  obj-y += $(devices-dirs-y)
> +obj-y += fifo8.o
> diff --git a/hw/fifo8.c b/hw/fifo8.c
> new file mode 100644
> index 0000000..0ea5ad9
> --- /dev/null
> +++ b/hw/fifo8.c
> @@ -0,0 +1,125 @@
> +/*
> + * Generic FIFO component, implemented as a circular buffer.
> + *
> + * Copyright (c) 2012 Peter A. G. Crosthwaite
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include "qemu-common.h"
> +#include "qemu/fifo8.h"
> +
> +void fifo8_create(Fifo8 *fifo, uint32_t capacity)
> +{
> +    fifo->data = g_new(uint8_t, capacity);
> +    fifo->capacity = capacity;
> +    fifo->head = 0;
> +    fifo->num = 0;
> +}
> +
> +void fifo8_destroy(Fifo8 *fifo)
> +{
> +    g_free(fifo->data);
> +}
> +
> +void fifo8_push(Fifo8 *fifo, uint8_t data)
> +{
> +    if (fifo->num == fifo->capacity) {
> +        abort();
> +    }
> +    fifo->data[(fifo->head + fifo->num) % fifo->capacity] = data;
> +    fifo->num++;
> +}
> +
> +void fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num)
> +{
> +    uint32_t start, avail;
> +
> +    if (fifo->num + num > fifo->capacity) {
> +        abort();
> +    }
> +
> +    start = (fifo->head + fifo->num) % fifo->capacity;
> +
> +    if (start + num <= fifo->capacity) {
> +        memcpy(&fifo->data[start], data, num);
> +    } else {
> +        avail = fifo->capacity - start;
> +        memcpy(&fifo->data[start], data, avail);
> +        memcpy(&fifo->data[0], &data[avail], num - avail);
> +    }
> +
> +    fifo->num += num;
> +}
> +
> +uint8_t fifo8_pop(Fifo8 *fifo)
> +{
> +    uint8_t ret;
> +
> +    if (fifo->num == 0) {
> +        abort();
> +    }
> +    ret = fifo->data[fifo->head++];
> +    fifo->head %= fifo->capacity;
> +    fifo->num--;
> +    return ret;
> +}
> +
> +const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num)
> +{
> +    uint8_t *ret;
> +
> +    if (max == 0 || max > fifo->num) {
> +        abort();
> +    }
> +    *num = MIN(fifo->capacity - fifo->head, max);
> +    ret = &fifo->data[fifo->head];
> +    fifo->head += *num;
> +    fifo->head %= fifo->capacity;
> +    fifo->num -= *num;
> +    return ret;
> +}
> +
> +void fifo8_reset(Fifo8 *fifo)
> +{
> +    fifo->num = 0;
> +    fifo->head = 0;
> +}
> +
> +bool fifo8_is_empty(Fifo8 *fifo)
> +{
> +    return (fifo->num == 0);
> +}
> +
> +bool fifo8_is_full(Fifo8 *fifo)
> +{
> +    return (fifo->num == fifo->capacity);
> +}
> +
> +uint32_t fifo8_num_free(Fifo8 *fifo)
> +{
> +    return fifo->capacity - fifo->num;
> +}
> +
> +uint32_t fifo8_num_used(Fifo8 *fifo)
> +{
> +    return fifo->num;
> +}
> +
> +const VMStateDescription vmstate_fifo8 = {
> +    .name = "Fifo8",
> +    .version_id = 1,
> +    .minimum_version_id = 1,
> +    .fields = (VMStateField[]) {
> +        VMSTATE_VBUFFER_UINT32(data, Fifo8, 1, NULL, 0, capacity),
> +        VMSTATE_UINT32(head, Fifo8),
> +        VMSTATE_UINT32(num, Fifo8),
> +        VMSTATE_END_OF_LIST()
> +    }
> +};
> diff --git a/util/Makefile.objs b/util/Makefile.objs
> index 6b3c83b..65a36f6 100644
> --- a/util/Makefile.objs
> +++ b/util/Makefile.objs
> @@ -3,7 +3,6 @@ util-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o event_notifier-win
>  util-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o event_notifier-posix.o qemu-openpty.o
>  util-obj-y += envlist.o path.o host-utils.o module.o
>  util-obj-y += bitmap.o bitops.o hbitmap.o
> -util-obj-y += fifo8.o
>  util-obj-y += acl.o
>  util-obj-y += error.o qemu-error.o
>  util-obj-$(CONFIG_POSIX) += compatfd.o
> diff --git a/util/fifo8.c b/util/fifo8.c
> deleted file mode 100644
> index 0ea5ad9..0000000
> --- a/util/fifo8.c
> +++ /dev/null
> @@ -1,125 +0,0 @@
> -/*
> - * Generic FIFO component, implemented as a circular buffer.
> - *
> - * Copyright (c) 2012 Peter A. G. Crosthwaite
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License
> - * as published by the Free Software Foundation; either version
> - * 2 of the License, or (at your option) any later version.
> - *
> - * You should have received a copy of the GNU General Public License along
> - * with this program; if not, see <http://www.gnu.org/licenses/>.
> - */
> -
> -#include "qemu-common.h"
> -#include "qemu/fifo8.h"
> -
> -void fifo8_create(Fifo8 *fifo, uint32_t capacity)
> -{
> -    fifo->data = g_new(uint8_t, capacity);
> -    fifo->capacity = capacity;
> -    fifo->head = 0;
> -    fifo->num = 0;
> -}
> -
> -void fifo8_destroy(Fifo8 *fifo)
> -{
> -    g_free(fifo->data);
> -}
> -
> -void fifo8_push(Fifo8 *fifo, uint8_t data)
> -{
> -    if (fifo->num == fifo->capacity) {
> -        abort();
> -    }
> -    fifo->data[(fifo->head + fifo->num) % fifo->capacity] = data;
> -    fifo->num++;
> -}
> -
> -void fifo8_push_all(Fifo8 *fifo, const uint8_t *data, uint32_t num)
> -{
> -    uint32_t start, avail;
> -
> -    if (fifo->num + num > fifo->capacity) {
> -        abort();
> -    }
> -
> -    start = (fifo->head + fifo->num) % fifo->capacity;
> -
> -    if (start + num <= fifo->capacity) {
> -        memcpy(&fifo->data[start], data, num);
> -    } else {
> -        avail = fifo->capacity - start;
> -        memcpy(&fifo->data[start], data, avail);
> -        memcpy(&fifo->data[0], &data[avail], num - avail);
> -    }
> -
> -    fifo->num += num;
> -}
> -
> -uint8_t fifo8_pop(Fifo8 *fifo)
> -{
> -    uint8_t ret;
> -
> -    if (fifo->num == 0) {
> -        abort();
> -    }
> -    ret = fifo->data[fifo->head++];
> -    fifo->head %= fifo->capacity;
> -    fifo->num--;
> -    return ret;
> -}
> -
> -const uint8_t *fifo8_pop_buf(Fifo8 *fifo, uint32_t max, uint32_t *num)
> -{
> -    uint8_t *ret;
> -
> -    if (max == 0 || max > fifo->num) {
> -        abort();
> -    }
> -    *num = MIN(fifo->capacity - fifo->head, max);
> -    ret = &fifo->data[fifo->head];
> -    fifo->head += *num;
> -    fifo->head %= fifo->capacity;
> -    fifo->num -= *num;
> -    return ret;
> -}
> -
> -void fifo8_reset(Fifo8 *fifo)
> -{
> -    fifo->num = 0;
> -    fifo->head = 0;
> -}
> -
> -bool fifo8_is_empty(Fifo8 *fifo)
> -{
> -    return (fifo->num == 0);
> -}
> -
> -bool fifo8_is_full(Fifo8 *fifo)
> -{
> -    return (fifo->num == fifo->capacity);
> -}
> -
> -uint32_t fifo8_num_free(Fifo8 *fifo)
> -{
> -    return fifo->capacity - fifo->num;
> -}
> -
> -uint32_t fifo8_num_used(Fifo8 *fifo)
> -{
> -    return fifo->num;
> -}
> -
> -const VMStateDescription vmstate_fifo8 = {
> -    .name = "Fifo8",
> -    .version_id = 1,
> -    .minimum_version_id = 1,
> -    .fields = (VMStateField[]) {
> -        VMSTATE_VBUFFER_UINT32(data, Fifo8, 1, NULL, 0, capacity),
> -        VMSTATE_UINT32(head, Fifo8),
> -        VMSTATE_UINT32(num, Fifo8),
> -        VMSTATE_END_OF_LIST()
> -    }
> -};
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/
  2014-08-20 10:01 ` [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/ Fam Zheng
  2014-08-20 13:33   ` Paolo Bonzini
@ 2014-08-20 14:23   ` Peter Crosthwaite
  2014-08-20 14:52     ` Fam Zheng
  1 sibling, 1 reply; 21+ messages in thread
From: Peter Crosthwaite @ 2014-08-20 14:23 UTC (permalink / raw)
  To: Fam Zheng
  Cc: Kevin Wolf, Paolo Bonzini, Michael Tokarev,
	qemu-devel@nongnu.org Developers, Stefan Hajnoczi

On Wed, Aug 20, 2014 at 8:01 PM, Fam Zheng <famz@redhat.com> wrote:
> Since it has a dependency on vmstate and is only used by device
> emulation, moving out from util will make the archive more independent.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  hw/Makefile.objs   |   1 +
>  hw/fifo8.c         | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++

Can we get it into a hw subdirectory? Either core or misc come to mind.

Regards,
Peter

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/
  2014-08-20 14:23   ` Peter Crosthwaite
@ 2014-08-20 14:52     ` Fam Zheng
  0 siblings, 0 replies; 21+ messages in thread
From: Fam Zheng @ 2014-08-20 14:52 UTC (permalink / raw)
  To: Peter Crosthwaite
  Cc: Kevin Wolf, Paolo Bonzini, Michael Tokarev,
	qemu-devel@nongnu.org Developers, Stefan Hajnoczi

On Thu, 08/21 00:23, Peter Crosthwaite wrote:
> On Wed, Aug 20, 2014 at 8:01 PM, Fam Zheng <famz@redhat.com> wrote:
> > Since it has a dependency on vmstate and is only used by device
> > emulation, moving out from util will make the archive more independent.
> >
> > Signed-off-by: Fam Zheng <famz@redhat.com>
> > ---
> >  hw/Makefile.objs   |   1 +
> >  hw/fifo8.c         | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> Can we get it into a hw subdirectory? Either core or misc come to mind.

OK. I'll move it to misc. Thanks.

Fam

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util
  2014-08-20 13:32   ` Paolo Bonzini
@ 2014-08-20 15:03     ` Fam Zheng
  2014-08-21  3:54     ` Fam Zheng
  1 sibling, 0 replies; 21+ messages in thread
From: Fam Zheng @ 2014-08-20 15:03 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kwolf, mjt, qemu-devel, stefanha

On Wed, 08/20 15:32, Paolo Bonzini wrote:
> Il 20/08/2014 12:01, Fam Zheng ha scritto:
> > diff --git a/util/iqn.c b/util/iqn.c
> > new file mode 100644
> > index 0000000..c8d1eda
> > --- /dev/null
> > +++ b/util/iqn.c
> > @@ -0,0 +1,38 @@
> > +/*
> > + * iqn generat function
> > + *
> > + * Copyright Red Hat, Inc., 2014
> > + *
> > + * Author: Paolo Bonzini <pbonzini@redhat.com>
> 
> Why me? :)

For the copied uuid part :)

> 
> > + *         Fam Zheng <famz@redhat.com>
> > + *
> > + * This work is licensed under the terms of the GNU GPL, version 2 or
> > + * later.  See the COPYING file in the top-level directory.
> > + */
> > +
> > +#include <glib.h>
> > +#include "qemu/error-report.h"
> > +#include "qemu-common.h"
> > +#include "sysemu/sysemu.h"
> > +#include "qmp-commands.h"
> > +
> > +char *iqn_generate(const char *prefix)
> > +{
> > +    const char *name;
> > +    char *iqn;
> > +    UuidInfo *uuid_info;
> > +
> > +    uuid_info = qmp_query_uuid(NULL);
> > +    if (strcmp(uuid_info->UUID, UUID_NONE) == 0) {
> > +        name = qemu_get_vm_name();
> > +    } else {
> > +        name = uuid_info->UUID;
> > +    }
> > +    iqn = g_strdup_printf("%s%s%s",
> > +                                 prefix,
> > +                                 name ? ":" : "",
> > +                                 name ? : "");
> > +    qapi_free_UuidInfo(uuid_info);
> > +
> > +    return iqn;
> > +}
> > 
> 
> Ouch, this is ugly... I cannot think of any other way to do it, but
> perhaps Benoit's QMP-in-tools series could help here?

I'll have a look to see if it helps.

> 
> In any case, if we need it I think there's no need to keep the argument
> to iqn_generate.

Fam

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 5/6] build-sys: Change libqemuutil.a to qemuutil.o and link whole object
  2014-08-20 13:29   ` Paolo Bonzini
@ 2014-08-21  3:02     ` Fam Zheng
  2014-08-21  9:04       ` Paolo Bonzini
  0 siblings, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-08-21  3:02 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kwolf, mjt, qemu-devel, stefanha

On Wed, 08/20 15:29, Paolo Bonzini wrote:
> Il 20/08/2014 12:01, Fam Zheng ha scritto:
> > +
> > +qemuutil.o: CC_REL_FLAGS := -Wl,-r
> 
> Why the target-specific rule?
> 
> > +qemuutil.o: $(util-obj-y)
> > +	$(call quiet-command,$(CC) -nostdlib $(CC_REL_FLAGS) -o $@ $^,"  LD -r  $(TARGET_DIR)$@")
> >  
> 
> 
> I think either you have
> 
> LD_REL := $(CC) -nostdlib -Wl,-r
> 
> (as opposed to "LD_REL := $(LD) -r" for example) or you do not need to
> put -Wl,-r in a separate variable.

Because comma doesn't work in Makefile macro invocation, we need to wrap the
flag in a variable. (Is there a way to escape it?) Your LD_REL looks cleaner
though.

Fam

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util
  2014-08-20 13:32   ` Paolo Bonzini
  2014-08-20 15:03     ` Fam Zheng
@ 2014-08-21  3:54     ` Fam Zheng
  2014-08-21  9:02       ` Paolo Bonzini
  1 sibling, 1 reply; 21+ messages in thread
From: Fam Zheng @ 2014-08-21  3:54 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kwolf, mjt, qemu-devel, stefanha

On Wed, 08/20 15:32, Paolo Bonzini wrote:
> 
> In any case, if we need it I think there's no need to keep the argument
> to iqn_generate.

How about multiple initiators? Should they use the same iqn?

Fam

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util
  2014-08-21  3:54     ` Fam Zheng
@ 2014-08-21  9:02       ` Paolo Bonzini
  2014-08-21  9:12         ` Fam Zheng
  0 siblings, 1 reply; 21+ messages in thread
From: Paolo Bonzini @ 2014-08-21  9:02 UTC (permalink / raw)
  To: Fam Zheng; +Cc: kwolf, mjt, qemu-devel, stefanha

Il 21/08/2014 05:54, Fam Zheng ha scritto:
>> > In any case, if we need it I think there's no need to keep the argument
>> > to iqn_generate.
> How about multiple initiators? Should they use the same iqn?

block/iscsi.c uses -iscsi for the options so that you don't have to
place them in cleartext in the command line (instead you can use a
-readconfig file and delete them).  user and password can be included in
the URL as well, though, and we could add an initiator-name option to
the iscsi driver to be used with qemu-img/qemu-io.

The default would remain to always use the same iqn.

Paolo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 5/6] build-sys: Change libqemuutil.a to qemuutil.o and link whole object
  2014-08-21  3:02     ` Fam Zheng
@ 2014-08-21  9:04       ` Paolo Bonzini
  0 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2014-08-21  9:04 UTC (permalink / raw)
  To: Fam Zheng; +Cc: kwolf, mjt, qemu-devel, stefanha

Il 21/08/2014 05:02, Fam Zheng ha scritto:
> On Wed, 08/20 15:29, Paolo Bonzini wrote:
>> Il 20/08/2014 12:01, Fam Zheng ha scritto:
>>> +
>>> +qemuutil.o: CC_REL_FLAGS := -Wl,-r
>>
>> Why the target-specific rule?
>>
>>> +qemuutil.o: $(util-obj-y)
>>> +	$(call quiet-command,$(CC) -nostdlib $(CC_REL_FLAGS) -o $@ $^,"  LD -r  $(TARGET_DIR)$@")
>>>  
>>
>>
>> I think either you have
>>
>> LD_REL := $(CC) -nostdlib -Wl,-r
>>
>> (as opposed to "LD_REL := $(LD) -r" for example) or you do not need to
>> put -Wl,-r in a separate variable.
> 
> Because comma doesn't work in Makefile macro invocation, we need to wrap the
> flag in a variable. (Is there a way to escape it?)

Well, there's

  comma=,

and $(comma).  Or

  Wl=-Wl,

of course.  But neither is particularly nice.

> Your LD_REL looks cleaner though.

Okay, let's go with it then.

Paolo

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util
  2014-08-21  9:02       ` Paolo Bonzini
@ 2014-08-21  9:12         ` Fam Zheng
  0 siblings, 0 replies; 21+ messages in thread
From: Fam Zheng @ 2014-08-21  9:12 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kwolf, mjt, qemu-devel, stefanha

On Thu, 08/21 11:02, Paolo Bonzini wrote:
> Il 21/08/2014 05:54, Fam Zheng ha scritto:
> >> > In any case, if we need it I think there's no need to keep the argument
> >> > to iqn_generate.
> > How about multiple initiators? Should they use the same iqn?
> 
> block/iscsi.c uses -iscsi for the options so that you don't have to
> place them in cleartext in the command line (instead you can use a
> -readconfig file and delete them).  user and password can be included in
> the URL as well, though, and we could add an initiator-name option to
> the iscsi driver to be used with qemu-img/qemu-io.
> 
> The default would remain to always use the same iqn.
> 

Makes sense to me. Thanks,

Fam

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2014-08-21  9:12 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-20 10:01 [Qemu-devel] [PATCH 0/6] build-sys: Fix iscsi module loading failure Fam Zheng
2014-08-20 10:01 ` [Qemu-devel] [PATCH 1/6] build-sys: Move fifio8 to hw/ Fam Zheng
2014-08-20 13:33   ` Paolo Bonzini
2014-08-20 14:23   ` Peter Crosthwaite
2014-08-20 14:52     ` Fam Zheng
2014-08-20 10:01 ` [Qemu-devel] [PATCH 2/6] stubs: Add iohandler.c Fam Zheng
2014-08-20 13:25   ` Paolo Bonzini
2014-08-20 10:01 ` [Qemu-devel] [PATCH 3/6] stubs: Add openpty.c Fam Zheng
2014-08-20 13:26   ` Paolo Bonzini
2014-08-20 10:01 ` [Qemu-devel] [PATCH 4/6] stubs: Add timer.c Fam Zheng
2014-08-20 13:27   ` Paolo Bonzini
2014-08-20 10:01 ` [Qemu-devel] [PATCH 5/6] build-sys: Change libqemuutil.a to qemuutil.o and link whole object Fam Zheng
2014-08-20 13:29   ` Paolo Bonzini
2014-08-21  3:02     ` Fam Zheng
2014-08-21  9:04       ` Paolo Bonzini
2014-08-20 10:01 ` [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util Fam Zheng
2014-08-20 13:32   ` Paolo Bonzini
2014-08-20 15:03     ` Fam Zheng
2014-08-21  3:54     ` Fam Zheng
2014-08-21  9:02       ` Paolo Bonzini
2014-08-21  9:12         ` Fam Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.