# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
# 
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
# 
# ROCK Linux: rock-src/package/base/mtools/hotfixes.patch
# ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
# 
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
# 
# --- ROCK-COPYRIGHT-NOTE-END ---

diff -Nur ../mtools-3.9.9-orig/devices.h ./devices.h
--- ../mtools-3.9.9-orig/devices.h	2004-11-11 20:54:27.772707216 +0100
+++ ./devices.h	2004-11-11 22:50:38.459001824 +0100
@@ -13,7 +13,15 @@
 #endif  /* MINOR not defined */
 
 #else
- 
+
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
+#define _LINUX_STRING_H_ 
+#define __KERNEL__
+#  include <linux/kdev_t.h>
+#  include <linux/list.h>
+#undef __KERNEL__
+#endif /* only for kernel before 2.6.9 */
 #include <linux/fs.h>        /* get MAJOR/MINOR from Linux kernel */
 #ifndef major
 #define major(x) MAJOR(x)
diff -Nur ../mtools-3.9.9-orig/mformat.c ./mformat.c
--- ../mtools-3.9.9-orig/mformat.c	2004-11-11 20:54:27.818700224 +0100
+++ ./mformat.c	2004-11-11 22:48:59.010120352 +0100
@@ -27,11 +27,23 @@
 #endif
 
 #ifdef OS_linux
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
+#define _LINUX_STRING_H_
+#define __KERNEL__
+#  include <linux/kdev_t.h>
+#  include <linux/list.h>
+#undef __KERNEL__
+#endif /* only for kernel before 2.6.9 */
 #include "linux/hdreg.h"
 
 #define _LINUX_STRING_H_
 #define kdev_t int
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
 #include "linux/fs.h"
+#else
+#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
+#endif /* including fs.h only works for kernel before 2.6.9 */
 #undef _LINUX_STRING_H_
 
 #endif
diff -Nur ../mtools-3.9.9-orig/mpartition.c ./mpartition.c
--- ../mtools-3.9.9-orig/mpartition.c	2004-11-11 20:54:27.811701288 +0100
+++ ./mpartition.c	2004-11-11 22:49:18.027229312 +0100
@@ -16,11 +16,23 @@
 #include "partition.h"
 
 #ifdef OS_linux
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
+#define _LINUX_STRING_H_
+#define __KERNEL__
+#  include <linux/kdev_t.h>
+#  include <linux/list.h>
+#undef __KERNEL__
+#endif /* only for kernel before 2.6.9 */
 #include "linux/hdreg.h"
 
 #define _LINUX_STRING_H_
 #define kdev_t int
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
 #include "linux/fs.h"
+#else
+#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
+#endif /* including fs.h only works for kernel before 2.6.9 */
 #undef _LINUX_STRING_H_
 
 #endif
diff -Nur ../mtools-3.9.9-orig/mzip.c ./mzip.c
--- ../mtools-3.9.9-orig/mzip.c	2004-11-11 20:54:27.807701896 +0100
+++ ./mzip.c	2004-11-11 22:49:44.624185960 +0100
@@ -30,6 +30,14 @@
 #include <sys/mount.h>
 #else
 #define _LINUX_KDEV_T_H 1  /* don't redefine MAJOR/MINOR */
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
+#define _LINUX_STRING_H_
+#define __KERNEL__
+#  include <linux/kdev_t.h>
+#  include <linux/list.h>
+#undef __KERNEL__
+#endif /* only for kernel before 2.6.9 */
 #include <linux/fs.h>
 #endif