[klibc] [patch] mips fix statfs

maximilian attems maks at sternwelten.at
Tue Aug 8 11:23:49 PDT 2006


On Tue, 08 Aug 2006, maximilian attems wrote:

> please pull from git://charm.itp.tuwien.ac.at/mattems/klibc/.git
> branch maks.
> 
>  arch/mips/klibc/archconfig.h |    3 +++
>  klibc/sysconfig.h            |   10 ++++++++++
>  sys/vfs.h                    |   17 +++++++++++++++++
>  3 files changed, 30 insertions(+)

below is the actual patch itself for review.

-- 
maks

commit f96f2943193d1cd5e4728706463904f913a60d08
Author: maximilian attems <maks at sternwelten.at>
Date:   Tue Aug 8 20:12:01 2006 +0200

    mips fix statfs
    
    mips has it's own defintion of statfs in include/asm-mips/statfs.h,
    adding it's structure to usr/include/sys/vfs.h allows to
    succesfully run ./usr/klibc/tests/statfs
    
    statfs bug shows up on run-init and thus prevents initramfs booting
    -> http://bugs.debian.org/347827

diff --git a/usr/include/arch/mips/klibc/archconfig.h b/usr/include/arch/mips/klibc/archconfig.h
index d9528b8..15b3208 100644
--- a/usr/include/arch/mips/klibc/archconfig.h
+++ b/usr/include/arch/mips/klibc/archconfig.h
@@ -12,4 +12,7 @@ #define _KLIBC_ARCHCONFIG_H
 /* MIPS has architecture-specific code for vfork() */
 #define _KLIBC_REAL_VFORK 1
 
+/* MIPS defines it's own statfs */
+#define _KLIBC_STATFS_F_TYPE_32B 1
+
 #endif				/* _KLIBC_ARCHCONFIG_H */
diff --git a/usr/include/klibc/sysconfig.h b/usr/include/klibc/sysconfig.h
index f3ae915..f4fb7a9 100644
--- a/usr/include/klibc/sysconfig.h
+++ b/usr/include/klibc/sysconfig.h
@@ -163,4 +163,14 @@ #ifndef _KLIBC_STATFS_F_TYPE_64
 # define _KLIBC_STATFS_F_TYPE_64 (_BITSIZE == 64)
 #endif
 
+/*
+ * _KLIBC_STATFS_F_TYPE_32B:
+ *
+ * 	mips has it's own definition of statfs, which is
+ * 	different from any other 32 bit arch.
+ */	
+#ifndef _KLIBC_STATFS_F_TYPE_32B
+# define _KLIBC_STATFS_F_TYPE_32B 0
+#endif
+
 #endif /* _KLIBC_SYSCONFIG_H */
diff --git a/usr/include/sys/vfs.h b/usr/include/sys/vfs.h
index 33b1026..6fb1eab 100644
--- a/usr/include/sys/vfs.h
+++ b/usr/include/sys/vfs.h
@@ -32,6 +32,23 @@ struct statfs {
 	uint64_t f_spare[5];
 };
 
+#elif _KLIBC_STATFS_F_TYPE_32B
+
+struct statfs {
+	uint32_t f_type;
+	uint32_t f_bsize;
+	uint32_t f_frsize;
+	uint32_t __pad;
+	uint64_t f_blocks;
+	uint64_t f_bfree;
+	uint64_t f_files;
+	uint64_t f_ffree;
+	uint64_t f_bavail;
+	__kernel_fsid_t f_fsid;
+	uint32_t f_namelen;
+	uint32_t f_spare[6];
+};
+
 #else /* not _KLIBC_STATFS_F_TYPE_64 */
 
 struct statfs {



More information about the klibc mailing list