* THE SOFTWARE.
*/
#include "qemu-common.h"
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
#include "qemu-timer.h"
-#include "exec-all.h"
#include "qemu-char.h"
-#endif
#include "block_int.h"
#include "compatfd.h"
#include <assert.h>
//#define DEBUG_FLOPPY
//#define DEBUG_BLOCK
-#if defined(DEBUG_BLOCK) && !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#if defined(DEBUG_BLOCK)
#define DEBUG_BLOCK_PRINT(formatCstr, args...) do { if (loglevel != 0) \
{ fprintf(logfile, formatCstr, ##args); fflush(logfile); } } while (0)
#else
int fd_got_error;
int fd_media_changed;
#endif
-#if defined(O_DIRECT) && !defined(QEMU_IMG)
+#if defined(O_DIRECT)
uint8_t* aligned_buf;
#endif
} BDRVRawState;
return ret;
}
s->fd = fd;
-#if defined(O_DIRECT) && !defined(QEMU_IMG)
+#if defined(O_DIRECT)
s->aligned_buf = NULL;
if (flags & BDRV_O_DIRECT) {
s->aligned_buf = qemu_memalign(512, ALIGNED_BUFFER_SIZE);
}
-#if defined(O_DIRECT) && !defined(QEMU_IMG)
+#if defined(O_DIRECT)
/*
* offset and count are in bytes and possibly not aligned. For files opened
* with O_DIRECT, necessary alignments are ensured before calling
fcntl(aio_sig_fd, F_SETFL, O_NONBLOCK);
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
qemu_set_fd_handler2(aio_sig_fd, NULL, qemu_aio_poll, NULL, NULL);
-#endif
#if defined(__GLIBC__) && defined(__linux__)
{
{
int ret;
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
if (qemu_bh_poll())
return;
-#endif
if (!first_aio)
return;
return acb;
}
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
static void raw_aio_em_cb(void* opaque)
{
RawAIOCB *acb = opaque;
acb->common.cb(acb->common.opaque, acb->ret);
qemu_aio_release(acb);
}
-#endif
static BlockDriverAIOCB *raw_aio_read(BlockDriverState *bs,
int64_t sector_num, uint8_t *buf, int nb_sectors,
* If O_DIRECT is used and the buffer is not aligned fall back
* to synchronous IO.
*/
-#if defined(O_DIRECT) && !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#if defined(O_DIRECT)
BDRVRawState *s = bs->opaque;
if (unlikely(s->aligned_buf != NULL && ((uintptr_t) buf % 512))) {
* If O_DIRECT is used and the buffer is not aligned fall back
* to synchronous IO.
*/
-#if defined(O_DIRECT) && !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#if defined(O_DIRECT)
BDRVRawState *s = bs->opaque;
if (unlikely(s->aligned_buf != NULL && ((uintptr_t) buf % 512))) {
void qemu_aio_wait(void)
{
-#if !defined(QEMU_IMG) && !defined(QEMU_NBD)
qemu_bh_poll();
-#endif
}
#endif /* CONFIG_AIO */
if (s->fd >= 0) {
close(s->fd);
s->fd = -1;
-#if defined(O_DIRECT) && !defined(QEMU_IMG)
+#if defined(O_DIRECT)
if (s->aligned_buf != NULL)
qemu_free(s->aligned_buf);
#endif
return 0;
}
-#if defined(__linux__) && !defined(QEMU_IMG) && !defined(QEMU_NBD)
+#if defined(__linux__)
/* Note: we do not have a reliable method to detect if the floppy is
present. The current method is to try to open the floppy at every
s->fd_got_error = 0;
return 0;
}
-#else
-static int fd_open(BlockDriverState *bs)
-{
- return 0;
-}
-#endif
-
-#if defined(__linux__)
static int raw_is_inserted(BlockDriverState *bs)
{