Merge remote-tracking branch 'qemu/master'
[qemu/ar7.git] / block / fvd-ext.h
blob6839e2564ab4c2c96b1730cadd1bd6f6605e30a8
1 /*
2 * Copyright (c) 2010-2011 IBM
4 * Authors:
5 * Chunqiang Tang <ctang@us.ibm.com>
7 * This work is licensed under the terms of the GNU GPL, version 2.
8 * See the COPYING file in the top-level directory.
9 */
11 /*=============================================================================
12 * A short description: this header file contains functions of the FVD block
13 * device driver that are used by other external modules. These functions are
14 * mainly for testing and debugging urposes.
15 *============================================================================*/
17 #ifndef __fvd_debug_h__
18 #define __fvd_debug_h__
20 //#define FVD_DEBUG
22 int fvd_get_copy_on_read (BlockDriverState *bs);
23 void fvd_set_copy_on_read (BlockDriverState *bs, int copy_on_read);
24 void fvd_check_memory_usage (void);
25 void fvd_init_prefetch(void * bs);
26 void fvd_enable_host_crash_test (void);
28 #ifndef TRUE
29 # define TRUE 1
30 #endif
31 #ifndef FALSE
32 # define FALSE 0
33 #endif
35 #ifndef FVD_DEBUG
36 # define QDEBUG(format,...) do {} while (0)
37 # define ASSERT(x) do {} while (0)
38 # define FVD_DEBUG_ACB(...) do {} while (0)
39 # define QPAUSE(...) do {} while (0)
41 #else
43 extern FILE *__fvd_debug_fp;
44 void init_fvd_debug_fp (void);
45 void FVD_DEBUG_ACB (void *p);
46 # define QDEBUG(format,...) \
47 do { \
48 if (__fvd_debug_fp==NULL) init_fvd_debug_fp(); \
49 fprintf (__fvd_debug_fp, format, ##__VA_ARGS__); \
50 fflush(__fvd_debug_fp); \
51 } while(0)
53 # define ASSERT(x) \
54 do { \
55 if (!(x)) { \
56 fprintf (stderr, "Assertion failed in process %d at %s:%d. " \
57 "Waiting for debugging...\n", getpid(),__FILE__, __LINE__); \
58 fgetc (stdin); exit (1); \
59 } \
60 } while (0) \
62 # define QPAUSE(format,...) \
63 do { \
64 printf (format, ##__VA_ARGS__); \
65 printf (" Pause process %d for debugging...\n", getpid()); \
66 fgetc (stdin); \
67 } while (0)
69 #endif
71 #endif