summaryrefslogtreecommitdiff
path: root/cmd.c
AgeCommit message (Collapse)AuthorFilesLines
2013-06-06qemu-io: Move remaining helpers from cmd.cKevin Wolf1-139/+0
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06qemu-io: Move command_loop() and friendsKevin Wolf1-139/+0
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2013-06-06qemu-io: Move functions for registering and running commandsKevin Wolf1-113/+0
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-06qemu-io: Move qemu_strsep() to cutils.cKevin Wolf1-21/+0
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-06qemu-io: Move 'quit' functionKevin Wolf1-29/+0
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-06qemu-io: Move 'help' functionKevin Wolf1-79/+0
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-06qemu-io: Factor out qemuio_commandKevin Wolf1-38/+5
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-06qemu-io: Don't use global bs in command implementationsKevin Wolf1-2/+4
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-06qemu-io: Make cvtnum() a wrapper around strtosz_suffix()Kevin Wolf1-37/+0
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-06qemu-io: Remove unused args_commandKevin Wolf1-26/+2
The original intention seems to be something with handling multiple images at once, but this has never been implemented and the only function ever registered is implemented to make everything behave like a "global" command. Just do that unconditionally now. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19block: move include files to include/block/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-10qemu-io: correctly print non-integer values as decimalsPaolo Bonzini1-17/+23
qemu-io's cvtstr function sometimes will incorrectly omit the decimal part of the number, and sometimes will incorrectly include it. This patch fixes both. The former is more serious, and can be seen in the patches to 027.out and 033.out. The changes to all other files were scripted with sed, so there were no "surprises" beyond 027.out and 033.out. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-04-19qemu-io: use main_loop_waitPaolo Bonzini1-5/+5
This will let timers run during aio_read and aio_write commands, though not during synchronous commands. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-11-07cmd: Fix potential memory leakPavel Borzenkov1-2/+7
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-07cmd: Fix potential NULL pointer dereferencePavel Borzenkov1-8/+3
Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-11-07cmd: Fix coding style in cmd.cPavel Borzenkov1-86/+82
Before the next patches, fix coding style of the affected functions. Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-21use qemu_* ctype functionsChristoph Egger1-1/+1
Fix "warning: array subscript has type 'char'" on NetBSD. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-20cmd: fix operator precedenceFrediano Ziglio1-3/+3
Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-06-22qemu-io: check registered fds in command_loop()MORITA Kazutaka1-3/+30
Some block drivers use an aio handler and do I/O completion routines in it. However, the handler is not invoked if we only do aio_read/write, because registered fds are not checked at all. This patch registers an aio handler of STDIO to checks whether we can read a command without blocking, and calls qemu_aio_wait() in command_loop(). Any other handlers can be invoked when user input is idle. Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-04-25Fix dead initialization, spotted by clang analyzerBlue Swirl1-1/+2
Fix clang warnings: /src/qemu/block/vvfat.c:1102:9: warning: Value stored to 'index3' during its initialization is never read int index3=index1+1; /src/qemu/cmd.c:290:15: warning: Value stored to 'p' during its initialization is never read char *p = result; Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-21Fix OpenBSD build of qemu-ioBlue Swirl1-2/+1
GCC 3.3.5 generates warnings for static forward declarations of data, so rearrange code to use static forward declarations of functions instead. Use <getopt.h> for optind instead of local definition. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-09-19Fix indentationStefan Weil1-3/+3
Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-09qemu-io: Improve portability (win32 now supported).Stefan Weil1-1/+22
* Add missing include for struct timeval. * Replace non-portable strsep by local qemu_strsep. * Use POSIX basename by including libgen.h. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-07-16Update to a hopefully more future proof FSF addressBlue Swirl1-2/+1
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-04-07Fix a few Sparse warningsblueswir11-2/+0
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7016 c046a42c-6fe2-441c-8c8c-71466251a162
2009-04-05Add files not included in previous commit.aliguori1-0/+565
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6995 c046a42c-6fe2-441c-8c8c-71466251a162