aboutsummaryrefslogtreecommitdiff
path: root/qemu-io.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2009-11-21 09:06:46 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-11-21 09:06:46 +0000
commit22a2bdcbae5aa256eb3d4179b29f1699b62dc110 (patch)
treeb1900a27ae7a0a6af09a9d5d7af9a9afad0bdafa /qemu-io.c
parent3a3fb96d0d9e3331e3beb672108ec18a6d3d8c1c (diff)
downloadqemu-22a2bdcbae5aa256eb3d4179b29f1699b62dc110.zip
qemu-22a2bdcbae5aa256eb3d4179b29f1699b62dc110.tar.gz
qemu-22a2bdcbae5aa256eb3d4179b29f1699b62dc110.tar.bz2
Fix OpenBSD build of qemu-io
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>
Diffstat (limited to 'qemu-io.c')
-rw-r--r--qemu-io.c173
1 files changed, 86 insertions, 87 deletions
diff --git a/qemu-io.c b/qemu-io.c
index cac72e9..3f7f222 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -266,8 +266,6 @@ static int do_aio_writev(QEMUIOVector *qiov, int64_t offset, int *total)
}
-static const cmdinfo_t read_cmd;
-
static void
read_help(void)
{
@@ -291,6 +289,19 @@ read_help(void)
"\n");
}
+static int read_f(int argc, char **argv);
+
+static const cmdinfo_t read_cmd = {
+ .name = "read",
+ .altname = "r",
+ .cfunc = read_f,
+ .argmin = 2,
+ .argmax = -1,
+ .args = "[-abCpqv] [-P pattern [-s off] [-l len]] off len",
+ .oneline = "reads a number of bytes at a specified offset",
+ .help = read_help,
+};
+
static int
read_f(int argc, char **argv)
{
@@ -439,19 +450,6 @@ out:
return 0;
}
-static const cmdinfo_t read_cmd = {
- .name = "read",
- .altname = "r",
- .cfunc = read_f,
- .argmin = 2,
- .argmax = -1,
- .args = "[-abCpqv] [-P pattern [-s off] [-l len]] off len",
- .oneline = "reads a number of bytes at a specified offset",
- .help = read_help,
-};
-
-static const cmdinfo_t readv_cmd;
-
static void
readv_help(void)
{
@@ -472,6 +470,18 @@ readv_help(void)
"\n");
}
+static int readv_f(int argc, char **argv);
+
+static const cmdinfo_t readv_cmd = {
+ .name = "readv",
+ .cfunc = readv_f,
+ .argmin = 2,
+ .argmax = -1,
+ .args = "[-Cqv] [-P pattern ] off len [len..]",
+ .oneline = "reads a number of bytes at a specified offset",
+ .help = readv_help,
+};
+
static int
readv_f(int argc, char **argv)
{
@@ -563,18 +573,6 @@ out:
return 0;
}
-static const cmdinfo_t readv_cmd = {
- .name = "readv",
- .cfunc = readv_f,
- .argmin = 2,
- .argmax = -1,
- .args = "[-Cqv] [-P pattern ] off len [len..]",
- .oneline = "reads a number of bytes at a specified offset",
- .help = readv_help,
-};
-
-static const cmdinfo_t write_cmd;
-
static void
write_help(void)
{
@@ -595,6 +593,19 @@ write_help(void)
"\n");
}
+static int write_f(int argc, char **argv);
+
+static const cmdinfo_t write_cmd = {
+ .name = "write",
+ .altname = "w",
+ .cfunc = write_f,
+ .argmin = 2,
+ .argmax = -1,
+ .args = "[-abCpq] [-P pattern ] off len",
+ .oneline = "writes a number of bytes at a specified offset",
+ .help = write_help,
+};
+
static int
write_f(int argc, char **argv)
{
@@ -696,19 +707,6 @@ out:
return 0;
}
-static const cmdinfo_t write_cmd = {
- .name = "write",
- .altname = "w",
- .cfunc = write_f,
- .argmin = 2,
- .argmax = -1,
- .args = "[-abCpq] [-P pattern ] off len",
- .oneline = "writes a number of bytes at a specified offset",
- .help = write_help,
-};
-
-static const cmdinfo_t writev_cmd;
-
static void
writev_help(void)
{
@@ -727,6 +725,18 @@ writev_help(void)
"\n");
}
+static int writev_f(int argc, char **argv);
+
+static const cmdinfo_t writev_cmd = {
+ .name = "writev",
+ .cfunc = writev_f,
+ .argmin = 2,
+ .argmax = -1,
+ .args = "[-Cq] [-P pattern ] off len [len..]",
+ .oneline = "writes a number of bytes at a specified offset",
+ .help = writev_help,
+};
+
static int
writev_f(int argc, char **argv)
{
@@ -797,16 +807,6 @@ out:
return 0;
}
-static const cmdinfo_t writev_cmd = {
- .name = "writev",
- .cfunc = writev_f,
- .argmin = 2,
- .argmax = -1,
- .args = "[-Cq] [-P pattern ] off len [len..]",
- .oneline = "writes a number of bytes at a specified offset",
- .help = writev_help,
-};
-
struct aio_ctx {
QEMUIOVector qiov;
int64_t offset;
@@ -846,8 +846,6 @@ out:
free(ctx);
}
-static const cmdinfo_t aio_read_cmd;
-
static void
aio_read_done(void *opaque, int ret)
{
@@ -911,6 +909,18 @@ aio_read_help(void)
"\n");
}
+static int aio_read_f(int argc, char **argv);
+
+static const cmdinfo_t aio_read_cmd = {
+ .name = "aio_read",
+ .cfunc = aio_read_f,
+ .argmin = 2,
+ .argmax = -1,
+ .args = "[-Cqv] [-P pattern ] off len [len..]",
+ .oneline = "asynchronously reads a number of bytes",
+ .help = aio_read_help,
+};
+
static int
aio_read_f(int argc, char **argv)
{
@@ -976,18 +986,6 @@ aio_read_f(int argc, char **argv)
return 0;
}
-static const cmdinfo_t aio_read_cmd = {
- .name = "aio_read",
- .cfunc = aio_read_f,
- .argmin = 2,
- .argmax = -1,
- .args = "[-Cqv] [-P pattern ] off len [len..]",
- .oneline = "asynchronously reads a number of bytes",
- .help = aio_read_help,
-};
-
-static const cmdinfo_t aio_write_cmd;
-
static void
aio_write_help(void)
{
@@ -1009,6 +1007,17 @@ aio_write_help(void)
"\n");
}
+static int aio_write_f(int argc, char **argv);
+
+static const cmdinfo_t aio_write_cmd = {
+ .name = "aio_write",
+ .cfunc = aio_write_f,
+ .argmin = 2,
+ .argmax = -1,
+ .args = "[-Cq] [-P pattern ] off len [len..]",
+ .oneline = "asynchronously writes a number of bytes",
+ .help = aio_write_help,
+};
static int
aio_write_f(int argc, char **argv)
@@ -1072,16 +1081,6 @@ aio_write_f(int argc, char **argv)
return 0;
}
-static const cmdinfo_t aio_write_cmd = {
- .name = "aio_write",
- .cfunc = aio_write_f,
- .argmin = 2,
- .argmax = -1,
- .args = "[-Cq] [-P pattern ] off len [len..]",
- .oneline = "asynchronously writes a number of bytes",
- .help = aio_write_help,
-};
-
static int
aio_flush_f(int argc, char **argv)
{
@@ -1312,7 +1311,19 @@ open_help(void)
"\n");
}
-static const cmdinfo_t open_cmd;
+static int open_f(int argc, char **argv);
+
+static const cmdinfo_t open_cmd = {
+ .name = "open",
+ .altname = "o",
+ .cfunc = open_f,
+ .argmin = 1,
+ .argmax = -1,
+ .flags = CMD_NOFILE_OK,
+ .args = "[-Crsn] [path]",
+ .oneline = "open the file specified by path",
+ .help = open_help,
+};
static int
open_f(int argc, char **argv)
@@ -1355,18 +1366,6 @@ open_f(int argc, char **argv)
return openfile(argv[optind], flags, growable);
}
-static const cmdinfo_t open_cmd = {
- .name = "open",
- .altname = "o",
- .cfunc = open_f,
- .argmin = 1,
- .argmax = -1,
- .flags = CMD_NOFILE_OK,
- .args = "[-Crsn] [path]",
- .oneline = "open the file specified by path",
- .help = open_help,
-};
-
static int
init_args_command(
int index)