[klibc] util/typefs breaks with recent headers

Milton Miller miltonm at bga.com
Mon Oct 11 12:17:29 PDT 2004


With the recent kernel patch
viro at www.linux.org.uk[torvalds]|include/linux/ 
romfs_fs.h|20041006145144|23705
aka "romfs endianness annotations" utils/fstype.c no longer links  
because
cpu_to_be32 is undefined.

Options:

1) Change the header to be ok for userspace

diff -ur ../linux-2.5/include/linux/romfs_fs.h  
linux/include/linux/romfs_fs.h
--- ../linux-2.5/include/linux/romfs_fs.h	2004-10-08 21:37:26.000000000  
+0200
+++ linux/include/linux/romfs_fs.h	2004-10-11 17:35:23.000000000 +0200
@@ -12,7 +12,7 @@

  #define __mkw(h,l) (((h)&0x00ff)<< 8|((l)&0x00ff))
  #define __mkl(h,l) (((h)&0xffff)<<16|((l)&0xffff))
-#define __mk4(a,b,c,d) cpu_to_be32(__mkl(__mkw(a,b),__mkw(c,d)))
+#define __mk4(a,b,c,d) __cpu_to_be32(__mkl(__mkw(a,b),__mkw(c,d)))
  #define ROMSB_WORD0 __mk4('-','r','o','m')
  #define ROMSB_WORD1 __mk4('1','f','s','-')


2) A quick hack to make this program compile:
--- klibc-0.181/utils/fstype.c.orig	2004-10-11 17:44:02.000000000 +0200
+++ klibc-0.181/utils/fstype.c	2004-10-11 17:46:17.000000000 +0200
@@ -34,6 +34,7 @@

  char *progname;

+#define cpu_to_be32(x) __cpu_to_be32(x)
  #define ARRAY_SIZE(x)	(sizeof(x) / sizeof(x[0]))

  #define BLOCK_SIZE_BITS 10

3) have some klibc header provide all the cpu_to_[bl]e..  family, and  
remove the underscores from
util/fstype.h

milton



More information about the klibc mailing list