From: Kevin Wolf <kwolf@redhat.com>
To: Devin Nakamura <devin122@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] qemu-io: Fix formatting
Date: Mon, 11 Jul 2011 15:21:21 +0200 [thread overview]
Message-ID: <4E1AF8D1.4020509@redhat.com> (raw)
In-Reply-To: <d93a44de6e1bef9ecb98509ee7ab2bf3e06c8d44.1310361865.git.devin122@gmail.com>
Am 11.07.2011 07:25, schrieb Devin Nakamura:
> Replaced tabs with spaces, 8 space indentations with 4 space
> indentation, and other fixes to better adhere to CODING_STYLE
>
> Signed-off-by: Devin Nakamura <devin122@gmail.com>
> ---
> qemu-io.c | 2653 +++++++++++++++++++++++++++++++------------------------------
> 1 files changed, 1331 insertions(+), 1322 deletions(-)
> @@ -1630,80 +1639,78 @@ open_help(void)
> 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,
> + .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)
> +static int open_f(int argc, char **argv)
> {
> - int flags = 0;
> - int readonly = 0;
> - int growable = 0;
> - int c;
> -
> - while ((c = getopt(argc, argv, "snrg")) != EOF) {
> - switch (c) {
> - case 's':
> - flags |= BDRV_O_SNAPSHOT;
> - break;
> - case 'n':
> - flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB;
> - break;
> - case 'r':
> - readonly = 1;
> - break;
> - case 'g':
> - growable = 1;
> - break;
> - default:
> - return command_usage(&open_cmd);
> - }
> - }
> -
> - if (!readonly) {
> - flags |= BDRV_O_RDWR;
> + int flags = 0;
> + int readonly = 0;
> + int growable = 0;
> + int c;
> +
> + while ((c = getopt(argc, argv, "snrg")) != EOF) {
> + switch (c) {
> + case 's':
> + flags |= BDRV_O_SNAPSHOT;
> + break;
> + case 'n':
> + flags |= BDRV_O_NOCACHE;
This was BDRV_O_NOCACHE | BDRV_O_CACHE_WB before.
> + break;
> + case 'r':
> + readonly = 1;
> + break;
> + case 'g':
> + growable = 1;
> + break;
> + default:
> + return command_usage(&open_cmd);
> }
> + }
> +
> + if (!readonly) {
> + flags |= BDRV_O_RDWR;
> + }
>
> - if (optind != argc - 1)
> - return command_usage(&open_cmd);
> + if (optind != argc - 1) {
> + return command_usage(&open_cmd);
> + }
>
> - return openfile(argv[optind], flags, growable);
> + return openfile(argv[optind], flags, growable);
> }
>
> -static int
> -init_args_command(
> - int index)
> +static int init_args_command(int index)
> {
> - /* only one device allowed so far */
> - if (index >= 1)
> - return 0;
> - return ++index;
> + /* only one device allowed so far */
> + if (index >= 1) {
> + return 0;
> + }
> + return ++index;
> }
>
> -static int
> -init_check_command(
> - const cmdinfo_t *ct)
> +static int init_check_command(const cmdinfo_t *ct)
> {
> - if (ct->flags & CMD_FLAG_GLOBAL)
> - return 1;
> - if (!(ct->flags & CMD_NOFILE_OK) && !bs) {
> - fprintf(stderr, "no file open, try 'help open'\n");
> - return 0;
> - }
> - return 1;
> + if (ct->flags & CMD_FLAG_GLOBAL) {
> + return 1;
> + }
> + if (!(ct->flags & CMD_NOFILE_OK) && !bs) {
> + fprintf(stderr, "no file open, try 'help open'\n");
> + return 0;
> + }
> + return 1;
> }
>
> static void usage(const char *name)
> {
> - printf(
> + printf(
> "Usage: %s [-h] [-V] [-rsnm] [-c cmd] ... [file]\n"
> "QEMU Disk exerciser\n"
> "\n"
> @@ -1717,115 +1724,117 @@ static void usage(const char *name)
> " -h, --help display this help and exit\n"
> " -V, --version output version information and exit\n"
> "\n",
> - name);
> + name);
> }
>
>
> int main(int argc, char **argv)
> {
> - int readonly = 0;
> - int growable = 0;
> - const char *sopt = "hVc:rsnmgk";
> - const struct option lopt[] = {
> - { "help", 0, NULL, 'h' },
> - { "version", 0, NULL, 'V' },
> - { "offset", 1, NULL, 'o' },
> - { "cmd", 1, NULL, 'c' },
> - { "read-only", 0, NULL, 'r' },
> - { "snapshot", 0, NULL, 's' },
> - { "nocache", 0, NULL, 'n' },
> - { "misalign", 0, NULL, 'm' },
> - { "growable", 0, NULL, 'g' },
> - { "native-aio", 0, NULL, 'k' },
> - { NULL, 0, NULL, 0 }
> - };
> - int c;
> - int opt_index = 0;
> - int flags = 0;
> -
> - progname = basename(argv[0]);
> -
> - while ((c = getopt_long(argc, argv, sopt, lopt, &opt_index)) != -1) {
> - switch (c) {
> - case 's':
> - flags |= BDRV_O_SNAPSHOT;
> - break;
> - case 'n':
> - flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB;
> - break;
> - case 'c':
> - add_user_command(optarg);
> - break;
> - case 'r':
> - readonly = 1;
> - break;
> - case 'm':
> - misalign = 1;
> - break;
> - case 'g':
> - growable = 1;
> - break;
> - case 'k':
> - flags |= BDRV_O_NATIVE_AIO;
> - break;
> - case 'V':
> - printf("%s version %s\n", progname, VERSION);
> - exit(0);
> - case 'h':
> - usage(progname);
> - exit(0);
> - default:
> - usage(progname);
> - exit(1);
> - }
> - }
> -
> - if ((argc - optind) > 1) {
> - usage(progname);
> - exit(1);
> - }
> -
> - bdrv_init();
> -
> - /* initialize commands */
> - quit_init();
> - help_init();
> - add_command(&open_cmd);
> - add_command(&close_cmd);
> - add_command(&read_cmd);
> - add_command(&readv_cmd);
> - add_command(&write_cmd);
> - add_command(&writev_cmd);
> - add_command(&multiwrite_cmd);
> - add_command(&aio_read_cmd);
> - add_command(&aio_write_cmd);
> - add_command(&aio_flush_cmd);
> - add_command(&flush_cmd);
> - add_command(&truncate_cmd);
> - add_command(&length_cmd);
> - add_command(&info_cmd);
> - add_command(&discard_cmd);
> - add_command(&alloc_cmd);
> - add_command(&map_cmd);
> -
> - add_args_command(init_args_command);
> - add_check_command(init_check_command);
> -
> - /* open the device */
> - if (!readonly) {
> - flags |= BDRV_O_RDWR;
> + int readonly = 0;
> + int growable = 0;
> + const char *sopt = "hVc:rsnmgk";
> + const struct option lopt[] = {
> + { "help", 0, NULL, 'h' },
> + { "version", 0, NULL, 'V' },
> + { "offset", 1, NULL, 'o' },
> + { "cmd", 1, NULL, 'c' },
> + { "read-only", 0, NULL, 'r' },
> + { "snapshot", 0, NULL, 's' },
> + { "nocache", 0, NULL, 'n' },
> + { "misalign", 0, NULL, 'm' },
> + { "growable", 0, NULL, 'g' },
> + { "native-aio", 0, NULL, 'k' },
> + { NULL, 0, NULL, 0 }
> + };
> + int c;
> + int opt_index = 0;
> + int flags = 0;
> +
> + progname = basename(argv[0]);
> +
> + while ((c = getopt_long(argc, argv, sopt, lopt, &opt_index)) != -1) {
> + switch (c) {
> + case 's':
> + flags |= BDRV_O_SNAPSHOT;
> + break;
> + case 'n':
> + flags |= BDRV_O_NOCACHE;
Same here.
Kevin
next prev parent reply other threads:[~2011-07-11 13:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-11 5:25 [Qemu-devel] [PATCH 1/2] qemu-io: Fix formatting Devin Nakamura
2011-07-11 5:25 ` [Qemu-devel] [PATCH 2/2] qemu-io: Fix if scoping bug Devin Nakamura
2011-07-11 9:47 ` Stefan Hajnoczi
2011-07-11 13:18 ` Kevin Wolf
2011-07-11 13:18 ` Stefan Hajnoczi
2011-07-11 15:20 ` [Qemu-devel] [PATCH v3 " Devin Nakamura
2011-07-12 12:59 ` Kevin Wolf
2011-07-11 13:21 ` Kevin Wolf [this message]
2011-07-11 15:22 ` [Qemu-devel] [PATCH v3 1/2] qemu-io: Fix formatting Devin Nakamura
-- strict thread matches above, loose matches on Subject: below --
2011-06-11 3:29 [Qemu-devel] [PATCH " Devin Nakamura
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E1AF8D1.4020509@redhat.com \
--to=kwolf@redhat.com \
--cc=devin122@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).