diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2010-10-23 15:24:07 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-10-23 15:24:07 +0000 |
commit | c57c846a80f9306aa2c6cf7efdef45ed42723fac (patch) | |
tree | 42fc65ee94c4c97e824b85c6d5b8b757fb2327aa /block/raw-posix.c | |
parent | 2b2e59e6c95beff2248069b2b129ba8c92c5f4d3 (diff) |
qemu-timer: move commonly used timer code to qemu-timer-common
Move timer init functions to a new file, qemu-timer-common.c. Make other
critical timer functions inlined to preserve performance in
qemu-timer.c, also move muldiv64() (used by the inline functions)
to qemu-timer.h.
Adjust block/raw-posix.c and simpletrace.c to use get_clock() directly.
Remove a similar/duplicate definition in qemu-tool.c.
Adjust hw/omap_clk.c to include qemu-timer.h because muldiv64() is used
there.
After this change, tracing can be used also for user code and
simpletrace on Win32.
Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'block/raw-posix.c')
-rw-r--r-- | block/raw-posix.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/block/raw-posix.c b/block/raw-posix.c index a5cbb7e929..d0393e0c44 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -97,9 +97,9 @@ #define FTYPE_CD 1 #define FTYPE_FD 2 -/* if the FD is not accessed during that time (in ms), we try to +/* if the FD is not accessed during that time (in ns), we try to reopen it to see if the disk has been changed */ -#define FD_OPEN_TIMEOUT 1000 +#define FD_OPEN_TIMEOUT (1000000000) #define MAX_BLOCKSIZE 4096 @@ -908,7 +908,7 @@ static int fd_open(BlockDriverState *bs) return 0; last_media_present = (s->fd >= 0); if (s->fd >= 0 && - (qemu_get_clock(rt_clock) - s->fd_open_time) >= FD_OPEN_TIMEOUT) { + (get_clock() - s->fd_open_time) >= FD_OPEN_TIMEOUT) { close(s->fd); s->fd = -1; #ifdef DEBUG_FLOPPY @@ -917,7 +917,7 @@ static int fd_open(BlockDriverState *bs) } if (s->fd < 0) { if (s->fd_got_error && - (qemu_get_clock(rt_clock) - s->fd_error_time) < FD_OPEN_TIMEOUT) { + (get_clock() - s->fd_error_time) < FD_OPEN_TIMEOUT) { #ifdef DEBUG_FLOPPY printf("No floppy (open delayed)\n"); #endif @@ -925,7 +925,7 @@ static int fd_open(BlockDriverState *bs) } s->fd = open(bs->filename, s->open_flags & ~O_NONBLOCK); if (s->fd < 0) { - s->fd_error_time = qemu_get_clock(rt_clock); + s->fd_error_time = get_clock(); s->fd_got_error = 1; if (last_media_present) s->fd_media_changed = 1; @@ -940,7 +940,7 @@ static int fd_open(BlockDriverState *bs) } if (!last_media_present) s->fd_media_changed = 1; - s->fd_open_time = qemu_get_clock(rt_clock); + s->fd_open_time = get_clock(); s->fd_got_error = 0; return 0; } |