qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

hw/9pfs/9p-synth: added directory for readdir test

This will provide the following virtual files by the 9pfs
synth driver:

- /ReadDirDir/ReadDirFile99
- /ReadDirDir/ReadDirFile98
...
- /ReadDirDir/ReadDirFile1
- /ReadDirDir/ReadDirFile0

This virtual directory and its virtual 100 files will be
used by the upcoming 9pfs readdir tests.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <5408c28c8de25dd575b745cef63bf785305ccef2.1579567020.git.qemu_oss@crudebyte.com>
Signed-off-by: Greg Kurz <groug@kaod.org>

authored by

Christian Schoenebeck and committed by
Greg Kurz
af46a3b2 d36a5c22

+24
+19
hw/9pfs/9p-synth.c
··· 578 578 NULL, v9fs_synth_qtest_flush_write, 579 579 ctx); 580 580 assert(!ret); 581 + 582 + /* Directory for READDIR test */ 583 + { 584 + V9fsSynthNode *dir = NULL; 585 + ret = qemu_v9fs_synth_mkdir( 586 + NULL, 0700, QTEST_V9FS_SYNTH_READDIR_DIR, &dir 587 + ); 588 + assert(!ret); 589 + for (i = 0; i < QTEST_V9FS_SYNTH_READDIR_NFILES; ++i) { 590 + char *name = g_strdup_printf( 591 + QTEST_V9FS_SYNTH_READDIR_FILE, i 592 + ); 593 + ret = qemu_v9fs_synth_add_file( 594 + dir, 0, name, NULL, NULL, ctx 595 + ); 596 + assert(!ret); 597 + g_free(name); 598 + } 599 + } 581 600 } 582 601 583 602 return 0;
+5
hw/9pfs/9p-synth.h
··· 55 55 #define QTEST_V9FS_SYNTH_LOPEN_FILE "LOPEN" 56 56 #define QTEST_V9FS_SYNTH_WRITE_FILE "WRITE" 57 57 58 + /* for READDIR test */ 59 + #define QTEST_V9FS_SYNTH_READDIR_DIR "ReadDirDir" 60 + #define QTEST_V9FS_SYNTH_READDIR_FILE "ReadDirFile%d" 61 + #define QTEST_V9FS_SYNTH_READDIR_NFILES 100 62 + 58 63 /* Any write to the "FLUSH" file is handled one byte at a time by the 59 64 * backend. If the byte is zero, the backend returns success (ie, 1), 60 65 * otherwise it forces the server to try again forever. Thus allowing