Split block API from vl.h.
Remove QEMU_TOOL. Replace with QEMU_IMG and NEED_CPU_H.
Avoid linking qemu-img against whole system emulatior.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3578 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/block.c b/block.c
index 3c70399..1cb943b 100644
--- a/block.c
+++ b/block.c
@@ -21,7 +21,11 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
+#ifdef QEMU_IMG
+#include "qemu-common.h"
+#else
 #include "vl.h"
+#endif
 #include "block_int.h"
 
 #ifdef _BSD
@@ -53,7 +57,7 @@
 static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num,
                          const uint8_t *buf, int nb_sectors);
 
-static BlockDriverState *bdrv_first;
+BlockDriverState *bdrv_first;
 static BlockDriver *first_drv;
 
 int path_is_absolute(const char *path)
@@ -859,6 +863,7 @@
         bdrv_flush(bs->backing_hd);
 }
 
+#ifndef QEMU_IMG
 void bdrv_info(void)
 {
     BlockDriverState *bs;
@@ -898,6 +903,7 @@
         term_printf("\n");
     }
 }
+#endif
 
 void bdrv_get_backing_filename(BlockDriverState *bs,
                                char *filename, int filename_size)
@@ -1102,7 +1108,7 @@
 /**************************************************************/
 /* async block device emulation */
 
-#ifdef QEMU_TOOL
+#ifdef QEMU_IMG
 static BlockDriverAIOCB *bdrv_aio_read_em(BlockDriverState *bs,
         int64_t sector_num, uint8_t *buf, int nb_sectors,
         BlockDriverCompletionFunc *cb, void *opaque)
@@ -1172,7 +1178,7 @@
     qemu_bh_cancel(acb->bh);
     qemu_aio_release(acb);
 }
-#endif /* !QEMU_TOOL */
+#endif /* !QEMU_IMG */
 
 /**************************************************************/
 /* sync block device emulation */