qemu-io.c (cafffa545420a2c6dc33f9cb58401c606af59572) qemu-io.c (4f6fd3491cf0f768b135ed2e242bd1d1d2a2efec)
1/*
2 * Command line utility to exercise the QEMU I/O path.
3 *
4 * Copyright (C) 2009 Red Hat, Inc.
5 * Copyright (c) 2003-2005 Silicon Graphics, Inc.
6 *
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.

--- 18 unchanged lines hidden (view full) ---

27extern int qemuio_misalign;
28
29/* qemu-io commands passed using -c */
30static int ncmdline;
31static char **cmdline;
32
33static int close_f(BlockDriverState *bs, int argc, char **argv)
34{
1/*
2 * Command line utility to exercise the QEMU I/O path.
3 *
4 * Copyright (C) 2009 Red Hat, Inc.
5 * Copyright (c) 2003-2005 Silicon Graphics, Inc.
6 *
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.

--- 18 unchanged lines hidden (view full) ---

27extern int qemuio_misalign;
28
29/* qemu-io commands passed using -c */
30static int ncmdline;
31static char **cmdline;
32
33static int close_f(BlockDriverState *bs, int argc, char **argv)
34{
35 bdrv_delete(bs);
35 bdrv_unref(bs);
36 qemuio_bs = NULL;
37 return 0;
38}
39
40static const cmdinfo_t close_cmd = {
41 .name = "close",
42 .altname = "c",
43 .cfunc = close_f,

--- 12 unchanged lines hidden (view full) ---

56 fprintf(stderr, "%s: can't open device %s\n", progname, name);
57 return 1;
58 }
59 } else {
60 qemuio_bs = bdrv_new("hda");
61
62 if (bdrv_open(qemuio_bs, name, NULL, flags, NULL) < 0) {
63 fprintf(stderr, "%s: can't open device %s\n", progname, name);
36 qemuio_bs = NULL;
37 return 0;
38}
39
40static const cmdinfo_t close_cmd = {
41 .name = "close",
42 .altname = "c",
43 .cfunc = close_f,

--- 12 unchanged lines hidden (view full) ---

56 fprintf(stderr, "%s: can't open device %s\n", progname, name);
57 return 1;
58 }
59 } else {
60 qemuio_bs = bdrv_new("hda");
61
62 if (bdrv_open(qemuio_bs, name, NULL, flags, NULL) < 0) {
63 fprintf(stderr, "%s: can't open device %s\n", progname, name);
64 bdrv_delete(qemuio_bs);
64 bdrv_unref(qemuio_bs);
65 qemuio_bs = NULL;
66 return 1;
67 }
68 }
69
70 return 0;
71}
72

--- 344 unchanged lines hidden (view full) ---

417 command_loop();
418
419 /*
420 * Make sure all outstanding requests complete before the program exits.
421 */
422 bdrv_drain_all();
423
424 if (qemuio_bs) {
65 qemuio_bs = NULL;
66 return 1;
67 }
68 }
69
70 return 0;
71}
72

--- 344 unchanged lines hidden (view full) ---

417 command_loop();
418
419 /*
420 * Make sure all outstanding requests complete before the program exits.
421 */
422 bdrv_drain_all();
423
424 if (qemuio_bs) {
425 bdrv_delete(qemuio_bs);
425 bdrv_unref(qemuio_bs);
426 }
427 return 0;
428}
426 }
427 return 0;
428}