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

hw/dma: Replace fprintf(stderr, "*\n" with error_report()

Replace a large number of the fprintf(stderr, "*\n" calls with
error_report(). The functions were renamed with these commands and then
compiler issues where manually fixed.

find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +
find ./* -type f -exec sed -i \
'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
{} +

Some lines where then manually tweaked to pass checkpatch.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>

Conversions that aren't followed by exit() dropped, because they might
be inappropriate.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20180203084315.20497-4-armbru@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>

authored by

Alistair Francis and committed by
Markus Armbruster
7f69a433 c0dbca36

+18 -18
+18 -18
hw/dma/soc_dma.c
··· 18 18 * with this program; if not, see <http://www.gnu.org/licenses/>. 19 19 */ 20 20 #include "qemu/osdep.h" 21 + #include "qemu/error-report.h" 21 22 #include "qemu-common.h" 22 23 #include "qemu/timer.h" 23 24 #include "hw/arm/soc_dma.h" ··· 270 271 if (entry->type == soc_dma_port_mem) { 271 272 if (entry->addr <= virt_base && 272 273 entry->addr + entry->u.mem.size > virt_base) { 273 - fprintf(stderr, "%s: FIFO at %"PRIx64 274 - " collides with RAM region at %"PRIx64 275 - "-%"PRIx64 "\n", __func__, 276 - virt_base, entry->addr, 277 - (entry->addr + entry->u.mem.size)); 274 + error_report("%s: FIFO at %"PRIx64 275 + " collides with RAM region at %"PRIx64 276 + "-%"PRIx64, __func__, 277 + virt_base, entry->addr, 278 + (entry->addr + entry->u.mem.size)); 278 279 exit(-1); 279 280 } 280 281 ··· 284 285 while (entry < dma->memmap + dma->memmap_size && 285 286 entry->addr <= virt_base) { 286 287 if (entry->addr == virt_base && entry->u.fifo.out == out) { 287 - fprintf(stderr, "%s: FIFO at %"PRIx64 288 - " collides FIFO at %"PRIx64 "\n", 289 - __func__, virt_base, entry->addr); 288 + error_report("%s: FIFO at %"PRIx64 289 + " collides FIFO at %"PRIx64, 290 + __func__, virt_base, entry->addr); 290 291 exit(-1); 291 292 } 292 293 ··· 321 322 if ((entry->addr >= virt_base && entry->addr < virt_base + size) || 322 323 (entry->addr <= virt_base && 323 324 entry->addr + entry->u.mem.size > virt_base)) { 324 - fprintf(stderr, "%s: RAM at %"PRIx64 "-%"PRIx64 325 - " collides with RAM region at %"PRIx64 326 - "-%"PRIx64 "\n", __func__, 327 - virt_base, virt_base + size, 328 - entry->addr, entry->addr + entry->u.mem.size); 325 + error_report("%s: RAM at %"PRIx64 "-%"PRIx64 326 + " collides with RAM region at %"PRIx64 327 + "-%"PRIx64, __func__, 328 + virt_base, virt_base + size, 329 + entry->addr, entry->addr + entry->u.mem.size); 329 330 exit(-1); 330 331 } 331 332 ··· 334 335 } else { 335 336 if (entry->addr >= virt_base && 336 337 entry->addr < virt_base + size) { 337 - fprintf(stderr, "%s: RAM at %"PRIx64 "-%"PRIx64 338 - " collides with FIFO at %"PRIx64 339 - "\n", __func__, 340 - virt_base, virt_base + size, 341 - entry->addr); 338 + error_report("%s: RAM at %"PRIx64 "-%"PRIx64 339 + " collides with FIFO at %"PRIx64, 340 + __func__, virt_base, virt_base + size, 341 + entry->addr); 342 342 exit(-1); 343 343 } 344 344