qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] qemu-io: Verify read data by patterns
Date: Thu, 9 Apr 2009 17:33:14 +0200	[thread overview]
Message-ID: <20090409153314.GB22492@lst.de> (raw)
In-Reply-To: <1239284776-2115-1-git-send-email-kwolf@redhat.com>

On Thu, Apr 09, 2009 at 03:46:16PM +0200, Kevin Wolf wrote:
> This patch adds a -P option to read and readv which allows to compare the read
> data to a given pattern. This can be used to verify data written by write -P.

Very good, I was doing this manually in my WIP testsuite, but having
qemu-io do this is even better.

>  " -q, -- quite mode, do not show I/O statistics\n"
> @@ -207,8 +208,10 @@ read_f(int argc, char **argv)
>  	char *buf;
>  	int64_t offset;
>  	int count, total;
> +	int pattern = 0;
> +	int use_pattern = 0;
>  
> -	while ((c = getopt(argc, argv, "Cpqv")) != EOF) {
> +	while ((c = getopt(argc, argv, "CpP:qv")) != EOF) {
>  		switch (c) {
>  		case 'C':
>  			Cflag = 1;
> @@ -216,6 +219,10 @@ read_f(int argc, char **argv)
>  		case 'p':
>  			pflag = 1;
>  			break;
> +		case 'P':
> +			use_pattern = 1;

Following the conventions this variable would be called Pflag, but I'm
not dead set on this.  (The conventions come from the original xfs_io
tool)

> +	if (use_pattern) {
> +		void* cmp_buf = malloc(count);
> +		memset(cmp_buf, pattern, count);
> +		if (memcmp(buf, cmp_buf, count)) {
> +			printf("Pattern verification failed at offset %lld, %d bytes\n",
> +				(long long) offset, count);
> +		}

Can we keep the line shorter than 80 characters?

  reply	other threads:[~2009-04-09 15:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-09 13:46 [Qemu-devel] [PATCH] qemu-io: Verify read data by patterns Kevin Wolf
2009-04-09 15:33 ` Christoph Hellwig [this message]
2009-04-09 17:07   ` Kevin Wolf
2009-04-09 17:15     ` Christoph Hellwig
2009-04-09 17:54     ` Anthony Liguori
2009-04-09 18:55       ` Kevin Wolf
2009-04-10 16:15       ` Christoph Hellwig
2009-04-10 20:23         ` Kevin Wolf
2009-04-10 16:14     ` Christoph Hellwig
2009-04-10 20:18       ` Kevin Wolf
2009-04-12  4:18         ` Christoph Hellwig

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=20090409153314.GB22492@lst.de \
    --to=hch@lst.de \
    --cc=kwolf@redhat.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).