Commit Graph

26935 Commits

Author SHA1 Message Date
Claudio Fontana 1f0803137d configure: permit compilation on arm aarch64
support compiling on aarch64.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 51A5C5ED.90103@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12 16:20:23 +01:00
Jani Kokkonen 6a91c7c978 tcg/aarch64: implement user mode qemu ld/st
also put aarch64 in the list of archs that do not need an ldscript.

Signed-off-by: Jani Kokkoken <jani.kokkonen@huawei.com>
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 51AF40EE.1000104@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12 16:20:23 +01:00
Claudio Fontana f129061c6a user-exec.c: aarch64 initial implementation of cpu_signal_handler
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 51AF4028.5030504@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12 16:20:23 +01:00
Claudio Fontana 31f1275b90 tcg/aarch64: implement sign/zero extend operations
implement the optional sign/zero extend operations with the dedicated
aarch64 instructions.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 51AC9A58.40502@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12 16:20:23 +01:00
Claudio Fontana 9c4a059df3 tcg/aarch64: implement byte swap operations
implement the optional byte swap operations with the dedicated
aarch64 instructions.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 51AC9A33.9050003@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12 16:20:23 +01:00
Claudio Fontana 7deea126b2 tcg/aarch64: implement AND/TEST immediate pattern
add functions to AND/TEST registers with immediate patterns.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 51AC9A0C.3090303@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12 16:20:22 +01:00
Claudio Fontana 36fac14a64 tcg/aarch64: improve arith shifted regs operations
for arith operations, add SUBS, ANDS, ADDS and add a shift parameter
so that all arith instructions can make use of shifted registers.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 51AC998B.7070506@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12 16:20:22 +01:00
Claudio Fontana 4a136e0a6b tcg/aarch64: implement new TCG target for aarch64
add preliminary support for TCG target aarch64.

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 51A5C596.3090108@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12 16:20:22 +01:00
Claudio Fontana 1d256776c7 include/elf.h: add aarch64 ELF machine and relocs
we will use the 26bit relative relocs in the aarch64 tcg target.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Message-id: 51A5C52A.4080001@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-12 16:20:22 +01:00
Peter Maydell 6692689543 configure: Drop CONFIG_ATFILE test
Nobody uses the CONFIG_ATFILE test now, so just drop it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: Claudio Fontana <claudio.fontana@huawei.com>
Message-id: 1370126121-22975-3-git-send-email-peter.maydell@linaro.org
2013-06-12 16:20:22 +01:00
Peter Maydell c0d472b12e linux-user: Drop direct use of openat etc syscalls
The linux-user syscall emulation layer currently supports the
openat family of syscalls via two mechanisms: simply calling
the corresponding libc functions, and making direct syscalls.
Since glibc has supported these functions since at least glibc
2.5, there's no real need to retain the (essentially untested)
direct syscall fallback code, so simply delete it. This allows
us to remove some ifdeffery that was attempting to disable
provision of some of the syscalls if the host didn't seem to
support them, which in some cases was actually wrong (eg where
there are several flavours of the syscall and we only need
one of them, not necessarily the exact one the guest has,
as with the fstatat* calls).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: Claudio Fontana <claudio.fontana@huawei.com>
Message-id: 1370126121-22975-2-git-send-email-peter.maydell@linaro.org
2013-06-12 16:20:21 +01:00
Peter Maydell 3307e2363a linux-user: Allow getdents to be provided by getdents64
Newer architectures may only implement the getdents64 syscall, not
getdents. Provide an implementation of getdents in terms of getdents64
so that we can run getdents-using targets on a getdents64-only host.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Tested-by: Claudio Fontana <claudio.fontana@huawei.com>
Message-id: 1370344377-27445-1-git-send-email-peter.maydell@linaro.org
Message-id: 1370193044-24535-1-git-send-email-peter.maydell@linaro.org
2013-06-12 16:20:21 +01:00
Michael Roth bd5c51ee6c qemu-char: don't issue CHR_EVENT_OPEN in a BH
When CHR_EVENT_OPENED was initially added, it was CHR_EVENT_RESET,
and it was issued as a bottom-half:

86e94dea5b

Which we basically used to print out a greeting/prompt for the
monitor.

AFAICT the only reason this was ever done in a BH was because in
some cases we'd modify the chr_write handler for a new chardev
backend *after* the site where we issued the reset (see:
86e94d:qemu_chr_open_stdio())

At some point this event was renamed to CHR_EVENT_OPENED, and we've
maintained the use of this BH ever since.

However, due to 9f939df955, we schedule
the BH via g_idle_add(), which is causing events to sometimes be
delivered after we've already begun processing data from backends,
leading to:

 known bugs:

  QMP:
    session negotation resets with OPENED event, in some cases this
    is causing new sessions to get sporadically reset

 potential bugs:

  hw/usb/redirect.c:
    can_read handler checks for dev->parser != NULL, which may be
    true if CLOSED BH has not been executed yet. In the past, OPENED
    quiesced outstanding CLOSED events prior to us reading client
    data. If it's delayed, our check may allow reads to occur even
    though we haven't processed the OPENED event yet, and when we
    do finally get the OPENED event, our state may get reset.

  qtest.c:
    can begin session before OPENED event is processed, leading to
    a spurious reset of the system and irq_levels

  gdbstub.c:
    may start a gdb session prior to the machine being paused

To fix these, let's just drop the BH.

Since the initial reasoning for using it still applies to an extent,
work around that by deferring the delivery of CHR_EVENT_OPENED until
after the chardevs have been fully initialized, toward the end of
qmp_chardev_add() (or some cases, qemu_chr_new_from_opts()). This
defers delivery long enough that we can be assured a CharDriverState
is fully initialized before CHR_EVENT_OPENED is sent.

Also, rather than requiring each chardev to do an explicit open, do it
automatically, and allow the small few who don't desire such behavior to
suppress the OPENED-on-init behavior by setting a 'explicit_be_open'
flag.

We additionally add missing OPENED events for stdio backends on w32,
which were previously not being issued, causing us to not recieve the
banner and initial prompts for qmp/hmp.

Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-id: 1370636393-21044-1-git-send-email-mdroth@linux.vnet.ibm.com
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10 11:38:37 -05:00
Anthony Liguori b62cd318da Merge remote-tracking branch 'luiz/queue/qmp' into staging
# By Luiz Capitulino (2) and Marcelo Tosatti (1)
# Via Luiz Capitulino
* luiz/queue/qmp:
  correct RTC_CHANGE_EVENT description (v2)
  MAINTAINERS: split Monitor (QMP/HMP) entry
  MAINTAINERS: new maintainers for qapi-schema.json

Message-id: 1370634855-18337-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10 11:37:47 -05:00
Anthony Liguori 97f31cbc71 Merge remote-tracking branch 'stefanha/net' into staging
# By Jason Wang (1) and Stefan Hajnoczi (1)
# Via Stefan Hajnoczi
* stefanha/net:
  tap: fix NULL dereference when passing invalid parameters to tap
  vmxnet3: fix NICState cleanup

Message-id: 1370613288-14933-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10 11:37:39 -05:00
Anthony Liguori f7da9c17c1 gtk: use better icon
The current icon looks pretty terrible rendered in Gnome.  This
switches to a transparent SVG which looks much nicer.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10 11:36:12 -05:00
Peter Maydell 4039736e6f softfloat: Fix shift128Right for shift counts 64..127
shift128Right would give the wrong result for a shift count
between 64 and 127. This was never noticed because all of
our uses of this function are guaranteed not to use shift
counts in this range.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1370186269-24353-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10 11:36:12 -05:00
Paolo Bonzini bc7d0e6674 gdbstub: let the debugger resume from guest panicked state
While in general we forbid a "continue" from the guest panicked
state, it makes sense to have an exception for that when continuing
in the debugger.  Perhaps the guest entered that state due to a bug,
for example, and we want to continue no matter what.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Message-id: 1370272015-9659-3-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10 11:36:11 -05:00
Paolo Bonzini 26ac7a31fb gdbstub: fix for commit 87f25c12bf
This commit used the wrong check to prevent an assertion failure.
After this commit, you need to start a guest in the monitor, you
cannot use anymore the "c" command in the debugger.  This is
undesirable.  The commit's aim was to prevent a restart
after a KVM internal error or something like that; use
runstate_needs_reset() for that.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Message-id: 1370272015-9659-2-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-10 11:36:11 -05:00
Wendy Liang 4f293bd6e5 xilinx_axidma: Do not set DMA .notify to NULL after notify
If a stream notify function is not ready, it may re-populate the notify call-
back to indicate it should be re-polled later. This break in this usage, as
immediately following the notify() call, .notify is set to NULL. reverse the
ordering of the notify call and NULL assignment accordingly.

[PC: Reworked commit message]

Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2013-06-10 13:04:40 +02:00
Stefan Weil 4e298e46dd xilinx_axienet: Fix bit mask code
Obviously the code wanted to mask the lower bits but failed to do so
because of a missing "<".

cppcheck detected a conditional expression which was always true (1 < 7).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2013-06-10 13:00:41 +02:00
Marcelo Tosatti 9914fbedf2 correct RTC_CHANGE_EVENT description (v2)
Fix RTC_CHANGE event description to match implementation.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2013-06-07 17:01:00 -04:00
Luiz Capitulino 8899b4ae2d MAINTAINERS: split Monitor (QMP/HMP) entry
This entry doesn't reflect reality for a few years now. This commit
splits it into Human Monitor (HMP), QAPI and QMP. Markus is dropped
as a maintainer.

This is what we have been for the last few years. Also, it's going
to help me to offload some of this work to someone else in the near
future.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
2013-06-07 17:00:55 -04:00
Luiz Capitulino 7810d29198 MAINTAINERS: new maintainers for qapi-schema.json
I'm facing two problems lately wrt QMP patch review: increasingly
lack of bandwidth and lack of background in so many different areas
that are getting new QMP commands almost every week.

In order to help me mitigate this problem, I'm adding Eric and Markus
(besides me) as maintainers of the qapi-schema.json file.

Markus has been an old timer reviewer. Eric is being the most active
and prolific reviewer of QMP patches for some time now.

I believe Markus and Eric will keep doing their work as before, but
starting now I'll require the ACK of at least one of them before
appling a patch/series that touches the qapi-schema.json file.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
2013-06-07 17:00:55 -04:00
Jason Wang c87826a878 tap: fix NULL dereference when passing invalid parameters to tap
This patch forbid the following invalid parameters to tap:

1) fd and vhostfds were specified but vhostfd were not specified
2) vhostfds were specified but fds were not specified
3) fds and vhostfd were specified

For 1 and 2, net_init_tap_one() will still pass NULL as vhostfdname to
monitor_handle_fd_param(), which may crash the qemu.

Also remove the unnecessary has_fd check.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Stefan Hajnoczi <shajnocz@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-07 15:48:11 +02:00
Anthony Liguori 7387de16d0 Merge remote-tracking branch 'stefanha/block' into staging
# By Kevin Wolf (19) and others
# Via Stefan Hajnoczi
* stefanha/block: (26 commits)
  hmp: add parameters device and -v for info block
  hmp: show ImageInfo in 'info block'
  qmp: add ImageInfo in BlockDeviceInfo used by query-block
  block: add image info query function bdrv_query_image_info()
  block: add snapshot info query function bdrv_query_snapshot_info_list()
  ide-test: Add FLUSH CACHE test case
  ide: Set BSY bit during FLUSH
  ide-test: Add enum value for DEV
  blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events
  Make qemu-io commands available in HMP
  qemu-io: Use the qemu version for -V
  qemu-io: Interface cleanup
  qemu-io: Move remaining helpers from cmd.c
  qemu-io: Move command_loop() and friends
  qemu-io: Move functions for registering and running commands
  qemu-io: Move qemu_strsep() to cutils.c
  qemu-io: Move 'quit' function
  qemu-io: Move 'help' function
  qemu-io: Factor out qemuio_command
  qemu-io: Split off commands to qemu-io-cmds.c
  ...

Message-id: 1370606325-10680-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-07 08:40:52 -05:00
Anthony Liguori b8a75b6093 Merge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging
# By Cornelia Huck
# Via Cornelia Huck
* cohuck/virtio-ccw-upstr:
  virtio-ccw: Fix unsetting of indicators.
  s390x/css: Fix concurrent sense.

Message-id: 1370592676-22532-1-git-send-email-cornelia.huck@de.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2013-06-07 08:40:25 -05:00
Wenchao Xia e73fe2b46c hmp: add parameters device and -v for info block
With these parameters, user can choose the information to be showed,
to avoid message flood in the monitor.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-07 13:45:01 +02:00
Wenchao Xia bd093a365e hmp: show ImageInfo in 'info block'
Now human monitor can show image details, include internal
snapshot and backing chain info for every block device.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-07 13:45:01 +02:00
Wenchao Xia 553a7e8718 qmp: add ImageInfo in BlockDeviceInfo used by query-block
Now image info will be retrieved as an embbed json object inside
BlockDeviceInfo, backing chain info and all related internal snapshot
info can be got in the enhanced recursive structure of ImageInfo. New
recursive member *backing-image is added to reflect the backing chain
status.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-07 13:37:45 +02:00
Wenchao Xia 43526ec8d1 block: add image info query function bdrv_query_image_info()
This patch adds function bdrv_query_image_info(), which will
retrieve image info in qmp object format. The implementation is
based on the code moved from qemu-img.c, but uses block layer
function to get snapshot info.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-07 13:37:45 +02:00
Wenchao Xia fb0ed4539c block: add snapshot info query function bdrv_query_snapshot_info_list()
This patch adds function bdrv_query_snapshot_info_list(), which will
retrieve snapshot info of an image in qmp object format. The implementation
is based on the code moved from qemu-img.c with modification to fit more
for qmp based block layer API.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-07 13:37:45 +02:00
Kevin Wolf bd07684aac ide-test: Add FLUSH CACHE test case
This checks in particular that BSY is set while the flush request is in
flight.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:29 +02:00
Andreas Färber f68ec8379e ide: Set BSY bit during FLUSH
The implementation of the ATA FLUSH command invokes a flush at the block
layer, which may on raw files on POSIX entail a synchronous fdatasync().
This may in some cases take so long that the SLES 11 SP1 guest driver
reports I/O errors and filesystems get corrupted or remounted read-only.

Avoid this by setting BUSY_STAT, so that the guest is made aware we are
in the middle of an operation and no ATA commands are attempted to be
processed concurrently.

Addresses BNC#637297.

Suggested-by: Gonglei (Arei) <arei.gonglei@huawei.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:27 +02:00
Kevin Wolf c27d565604 ide-test: Add enum value for DEV
Get rid of the magic number.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:24 +02:00
Kevin Wolf bf736fe34c blkdebug: Add BLKDBG_FLUSH_TO_OS/DISK events
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:22 +02:00
Kevin Wolf 587da2c39c Make qemu-io commands available in HMP
It was decided to not make this command available in QMP in order to
make clear that this is not supposed to be a stable API and should be
used only for testing and debugging purposes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:05 +02:00
Kevin Wolf 02da386a2d qemu-io: Use the qemu version for -V
Always printing 0.0.1 and never updating the version number wasn't very
useful. qemu-io is released with qemu, so using the same version number
makes most sense.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:05 +02:00
Kevin Wolf 3d21994f9c qemu-io: Interface cleanup
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:05 +02:00
Kevin Wolf 0b613881ae qemu-io: Move remaining helpers from cmd.c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:05 +02:00
Kevin Wolf d1174f13e7 qemu-io: Move command_loop() and friends
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:05 +02:00
Kevin Wolf c2cdf5c589 qemu-io: Move functions for registering and running commands
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:05 +02:00
Kevin Wolf a38ed81147 qemu-io: Move qemu_strsep() to cutils.c
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:04 +02:00
Kevin Wolf e681be7eca qemu-io: Move 'quit' function
This one only makes sense in the context of the qemu-io tool, so move it
to qemu-io.c. Adapt coding style and register it like other commands.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:04 +02:00
Kevin Wolf f18a834a92 qemu-io: Move 'help' function
No reason to treat it different from other commands. Move it to
qemu-io-cmds.c, adapt the coding style and register it like any other
command.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:04 +02:00
Kevin Wolf dd5832967a qemu-io: Factor out qemuio_command
It's duplicated code. Move it to qemu-io-cmds.c because it's not
dependent on any static data of the qemu-io tool.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:04 +02:00
Kevin Wolf 797ac58cb2 qemu-io: Split off commands to qemu-io-cmds.c
This is the implementation of all qemu-io commands that make sense to be
called from the qemu monitor, i.e. everything except open, close and
quit.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:04 +02:00
Kevin Wolf 734c3b85cb qemu-io: Don't use global bs in command implementations
Pass in the BlockDriverState to the command handlers instead of using
the global variable. This is an important step to make the commands
usable outside of qemu-io.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:04 +02:00
Kevin Wolf cf49a6a00c qemu-io: Handle cvtnum() errors in 'alloc'
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:03 +02:00
Kevin Wolf b6e356aa25 qemu-io: Make cvtnum() a wrapper around strtosz_suffix()
No reason to implement the same thing multiple times. A nice side effect
is that fractional numbers like 0.5M can be used in qemu-io now.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06 11:27:03 +02:00