From 99c5a3ae46271674d7481aa4754d03e5838afa74 Mon Sep 17 00:00:00 2001 From: Patrick Caulfield Date: Tue, 25 Jun 2002 14:02:28 +0000 Subject: [PATCH] Flush on open as well as close. --- lib/device/dev-io.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c index a8f24a729..4be596fb6 100644 --- a/lib/device/dev-io.c +++ b/lib/device/dev-io.c @@ -62,6 +62,12 @@ int dev_get_sectsize(struct device *dev, uint32_t * size) return 1; } + +static void _flush(int fd) +{ + ioctl(fd, BLKFLSBUF, 0); +} + int dev_open(struct device *dev, int flags) { struct stat buf; @@ -92,17 +98,12 @@ int dev_open(struct device *dev, int flags) dev_close(dev); return 0; } - + _flush(dev->fd); dev->flags = 0; return 1; } -static void _flush(int fd) -{ - ioctl(fd, BLKFLSBUF, 0); -} - int dev_close(struct device *dev) { if (dev->fd < 0) {