diff options
author | John Snow <jsnow@redhat.com> | 2015-09-17 14:17:04 -0400 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2015-09-18 10:58:56 -0400 |
commit | ab4f705751c39d59e5039a145cf4703320e4207e (patch) | |
tree | d8de5b6b2fb5b1e629c06d20976e96e574f31d17 /tests/ahci-test.c | |
parent | d7531638db73396c9e89ade086bbeab6023656f9 (diff) | |
download | qemu-ab4f705751c39d59e5039a145cf4703320e4207e.zip qemu-ab4f705751c39d59e5039a145cf4703320e4207e.tar.gz qemu-ab4f705751c39d59e5039a145cf4703320e4207e.tar.bz2 |
qtest/ahci: export generate_pattern
Share the pattern function for ide and ahci test.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 1441926555-19471-3-git-send-email-jsnow@redhat.com
Diffstat (limited to 'tests/ahci-test.c')
-rw-r--r-- | tests/ahci-test.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/tests/ahci-test.c b/tests/ahci-test.c index b1a785c..59d387c 100644 --- a/tests/ahci-test.c +++ b/tests/ahci-test.c @@ -71,32 +71,6 @@ static void string_bswap16(uint16_t *s, size_t bytes) } } -static void generate_pattern(void *buffer, size_t len, size_t cycle_len) -{ - int i, j; - unsigned char *tx = (unsigned char *)buffer; - unsigned char p; - size_t *sx; - - /* Write an indicative pattern that varies and is unique per-cycle */ - p = rand() % 256; - for (i = 0; i < len; i++) { - tx[i] = p++ % 256; - if (i % cycle_len == 0) { - p = rand() % 256; - } - } - - /* force uniqueness by writing an id per-cycle */ - for (i = 0; i < len / cycle_len; i++) { - j = i * cycle_len; - if (j + sizeof(*sx) <= len) { - sx = (size_t *)&tx[j]; - *sx = i; - } - } -} - /** * Verify that the transfer did not corrupt our state at all. */ |