summaryrefslogtreecommitdiff
path: root/lib/ext2fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2001-06-22 21:01:17 -0400
committerTheodore Ts'o <tytso@mit.edu>2001-06-22 21:01:17 -0400
commitd90f3494b219f9fe327eaa561faf75582f65ad9e (patch)
tree7c71eebb3bbce406cfc5eeae80f3798ea761b105 /lib/ext2fs
parent16645f802a809195757f04daa421356f90dc5857 (diff)
downloade2fsprogs-d90f3494b219f9fe327eaa561faf75582f65ad9e.tar.gz
e2fsck/flushb.c and lib/ext2fs/flushb.c: Use platform independent
method of defining the BLKFLSBUF and FDFLUSH ioctl's. Also include sys/mount.h since on newer glibc's BLKFLSBUF is defined there.
Diffstat (limited to 'lib/ext2fs')
-rw-r--r--lib/ext2fs/ChangeLog4
-rw-r--r--lib/ext2fs/flushb.c17
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 38e026af..00ee60cd 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,5 +1,9 @@
2001-06-22 Theodore Tso <tytso@valinux.com>
+ * flushb.c: Use platform independent method of defining the
+ BLKFLSBUF and FDFLUSH ioctl's. Also include sys/mount.h
+ since on newer glibc's BLKFLSBUF is defined there.
+
* bitops.h: The C language versions of ext2fs_swab16/32 need to be
included if EXT2FS_ENABLE_SWAPFS is defined, since we need
to support byte swapping even if we don't support the
diff --git a/lib/ext2fs/flushb.c b/lib/ext2fs/flushb.c
index 03f48a6f..282dca37 100644
--- a/lib/ext2fs/flushb.c
+++ b/lib/ext2fs/flushb.c
@@ -20,21 +20,26 @@
#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h> /* This may define BLKFLSBUF */
+#endif
#include "ext2_fs.h"
#include "ext2fs.h"
/*
- * For Linux/i386, define BLKFLSBUF and FDFLUSH if necessary, since
- * no portable header file does so for us. This really should be
- * fixed in the glibc header files. Until then....
+ * For Linux, define BLKFLSBUF and FDFLUSH if necessary, since
+ * not all portable header file does so for us. This really should be
+ * fixed in the glibc header files. (Recent glibcs appear to define
+ * BLKFLSBUF in sys/mount.h, but FDFLUSH still doesn't seem to be
+ * defined anywhere portable.) Until then....
*/
-#if (defined(__i386__) && defined(__linux__))
+#ifdef __linux__
#ifndef BLKFLSBUF
-#define BLKFLSBUF 0x1261 /* flush buffer cache */
+#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */
#endif
#ifndef FDFLUSH
-#define FDFLUSH 0x024b /* flush floppy disk */
+#define FDFLUSH _IO(2,0x4b) /* flush floppy disk */
#endif
#endif