parted/parted.no-O_DIRECT.patch

41 lines
1.4 KiB
Diff

---
libparted/arch/linux.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
Index: parted-1.9.0/libparted/arch/linux.c
===================================================================
--- parted-1.9.0.orig/libparted/arch/linux.c 2009-07-29 14:01:00.000000000 +0200
+++ parted-1.9.0/libparted/arch/linux.c 2009-07-29 14:07:44.000000000 +0200
@@ -66,15 +66,9 @@
#define HDIO_GETGEO 0x0301 /* get device geometry */
#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
-#if defined(O_DIRECT) && !(defined(__s390__) || defined(__s390x__))
-#define RD_MODE (O_RDONLY | O_DIRECT)
-#define WR_MODE (O_WRONLY | O_DIRECT)
-#define RW_MODE (O_RDWR | O_DIRECT)
-#else
#define RD_MODE (O_RDONLY)
#define WR_MODE (O_WRONLY)
#define RW_MODE (O_RDWR)
-#endif
struct hd_geometry {
unsigned char heads;
@@ -1409,6 +1403,7 @@ _flush_cache (PedDevice* dev)
fd = open (name, WR_MODE, 0);
if (fd > 0) {
ioctl (fd, BLKFLSBUF);
+ fsync (fd);
close (fd);
}
}
@@ -1471,6 +1466,7 @@ linux_close (PedDevice* dev)
if (dev->dirty)
_flush_cache (dev);
+ fsync (arch_specific->fd);
close (arch_specific->fd);
return 1;
}