From nobody Sat Nov 15 20:36:26 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1748712149497709.2673528637865; Sat, 31 May 2025 10:22:29 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uLPs3-0005EQ-I3; Sat, 31 May 2025 13:19:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uLPqN-0002R0-U1; Sat, 31 May 2025 13:18:04 -0400 Received: from isrv.corpit.ru ([86.62.121.231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uLPqL-00018d-Eo; Sat, 31 May 2025 13:18:03 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id 93A76126B46; Sat, 31 May 2025 20:16:06 +0300 (MSK) Received: from think4mjt.tls.msk.ru (mjtthink.wg.tls.msk.ru [192.168.177.146]) by tsrv.corpit.ru (Postfix) with ESMTP id 6BC9F21BA49; Sat, 31 May 2025 20:16:10 +0300 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org, qemu-block@nongnu.org Cc: Michael Tokarev Subject: [PATCH 22/27] qemu-img: bench: refresh options/--help Date: Sat, 31 May 2025 20:16:04 +0300 Message-Id: <20250531171609.197078-23-mjt@tls.msk.ru> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250531171609.197078-1-mjt@tls.msk.ru> References: <20250531171609.197078-1-mjt@tls.msk.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=86.62.121.231; envelope-from=mjt@tls.msk.ru; helo=isrv.corpit.ru X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1748712150444116600 Content-Type: text/plain; charset="utf-8" Add missing long options and --help output, reorder options for consistency. Add missing --object option. Signed-off-by: Michael Tokarev --- qemu-img.c | 112 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 84 insertions(+), 28 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 0d4bdc5df5..5011ec5fce 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -4859,28 +4859,93 @@ static int img_bench(const img_cmd_t *ccmd, int arg= c, char **argv) for (;;) { static const struct option long_options[] =3D { {"help", no_argument, 0, 'h'}, - {"flush-interval", required_argument, 0, OPTION_FLUSH_INTERVAL= }, + {"format", required_argument, 0, 'f'}, {"image-opts", no_argument, 0, OPTION_IMAGE_OPTS}, + {"cache", required_argument, 0, 't'}, + {"count", required_argument, 0, 'c'}, + {"depth", required_argument, 0, 'd'}, + {"offset", required_argument, 0, 'o'}, + {"buffer-size", required_argument, 0, 's'}, + {"step-size", required_argument, 0, 'S'}, + {"write", no_argument, 0, 'w'}, {"pattern", required_argument, 0, OPTION_PATTERN}, + {"flush-interval", required_argument, 0, OPTION_FLUSH_INTERVAL= }, {"no-drain", no_argument, 0, OPTION_NO_DRAIN}, + {"aio", required_argument, 0, 'i'}, + {"native", no_argument, 0, 'n'}, {"force-share", no_argument, 0, 'U'}, + {"quiet", no_argument, 0, 'q'}, + {"object", required_argument, 0, OPTION_OBJECT}, {0, 0, 0, 0} }; - c =3D getopt_long(argc, argv, ":hc:d:f:ni:o:qs:S:t:wU", long_optio= ns, - NULL); + c =3D getopt_long(argc, argv, "hf:t:c:d:o:s:S:wi:nUq", + long_options, NULL); if (c =3D=3D -1) { break; } =20 switch (c) { - case ':': - missing_argument(argv[optind - 1]); + case 'h': + cmd_help(ccmd, "[-f FMT | --image-opts] [-t CACHE]\n" +" [-c COUNT] [-d DEPTH] [-o OFFSET] [-s BUFFER_SIZE] [-S STEP_SIZE]= \n" +" [-w [--pattern PATTERN] [--flush-interval INTERVAL [--no-drain]]]= \n" +" [-i AIO] [-n] [-U] [-q] FILE\n" +, +" -f, --format FMT\n" +" specify FILE format explicitly\n" +" --image-opts\n" +" indicates that FILE is a complete image specification\n" +" instead of a file name (incompatible with --format)\n" +" -t, --cache CACHE\n" +" cache mode for FILE (default: " BDRV_DEFAULT_CACHE ")\n" +" -c, --count COUNT\n" +" number of I/O requests to perform\n" +" -d, --depth DEPTH\n" +" number of requests to perform in parallel\n" +" -o, --offset OFFSET\n" +" start first request at this OFFSET\n" +" -s, --buffer-size BUFFER_SIZE[bkKMGTPE]\n" +" size of each I/O request, with optional multiplier suffix\n" +" (powers of 1024, default is 4K)\n" +" -S, --step-size STEP_SIZE[bkKMGTPE]\n" +" each next request offset increment, with optional multiplier suffix\= n" +" (powers of 1024, default is the same as BUFFER_SIZE)\n" +" -w, --write\n" +" perform write test (default is read)\n" +" --pattern PATTERN\n" +" write this pattern byte instead of zero\n" +" --flush-interval FLUSH_INTERVAL\n" +" issue flush after this number of requests\n" +" --no-drain\n" +" do not wait when flushing pending requests\n" +" -i, --aio AIO\n" +" async-io backend (threads, native, io_uring)\n" +" -n, --native\n" +" use native AIO backend if possible\n" +" -U, --force-share\n" +" open images in shared mode for concurrent access\n" +" -q, --quiet\n" +" quiet mode (produce only error messages if any)\n" +" --object OBJDEF\n" +" defines QEMU user-creatable object\n" +" FILE\n" +" name of the image file, or option string (key=3Dvalue,..)\n" +" with --image-opts, to operate on\n" +); break; - case '?': - unrecognized_option(argv[optind - 1]); + case 'f': + fmt =3D optarg; break; - case 'h': - help(); + case OPTION_IMAGE_OPTS: + image_opts =3D true; + break; + case 't': + ret =3D bdrv_parse_cache_mode(optarg, &flags, &writethrough); + if (ret < 0) { + error_report("Invalid cache mode"); + ret =3D -1; + goto out; + } break; case 'c': { @@ -4904,9 +4969,6 @@ static int img_bench(const img_cmd_t *ccmd, int argc,= char **argv) depth =3D res; break; } - case 'f': - fmt =3D optarg; - break; case 'n': flags |=3D BDRV_O_NATIVE_AIO; break; @@ -4927,9 +4989,6 @@ static int img_bench(const img_cmd_t *ccmd, int argc,= char **argv) break; } break; - case 'q': - quiet =3D true; - break; case 's': { int64_t sval; @@ -4954,21 +5013,10 @@ static int img_bench(const img_cmd_t *ccmd, int arg= c, char **argv) step =3D sval; break; } - case 't': - ret =3D bdrv_parse_cache_mode(optarg, &flags, &writethrough); - if (ret < 0) { - error_report("Invalid cache mode"); - ret =3D -1; - goto out; - } - break; case 'w': flags |=3D BDRV_O_RDWR; is_write =3D true; break; - case 'U': - force_share =3D true; - break; case OPTION_PATTERN: { unsigned long res; @@ -4994,9 +5042,17 @@ static int img_bench(const img_cmd_t *ccmd, int argc= , char **argv) case OPTION_NO_DRAIN: drain_on_flush =3D false; break; - case OPTION_IMAGE_OPTS: - image_opts =3D true; + case 'U': + force_share =3D true; break; + case 'q': + quiet =3D true; + break; + case OPTION_OBJECT: + user_creatable_process_cmdline(optarg); + break; + default: + tryhelp(argv[0]); } } =20 --=20 2.39.5