|
From: Jan-Benedict G. <jb...@us...> - 2004-09-30 19:52:27
|
Update of /cvsroot/linux-vax/kernel-2.5/fs/ods2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8081 Modified Files: ods2.h util.c Log Message: - Access to my girlfriend's laptop HDD! So here's the fix for ODS-2 to not require libgcc's long long functions. Index: util.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/util.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- util.c 23 Sep 2004 13:43:02 -0000 1.12 +++ util.c 30 Sep 2004 19:52:18 -0000 1.13 @@ -20,6 +20,8 @@ #include <linux/buffer_head.h> #include "ods2.h" +#define DODGY_GCC /* Old compiler, FIXME */ + u32 vbn2lbn (struct super_block *sb, struct ods2map *map, u32 vbn) { @@ -191,6 +193,27 @@ } +#ifdef DODGY_GCC +/* + * To not emit __udivdi3 and __umoddi3, we'll for now implement our own + * div64() and use it. Once we've got a "capable" toolchain, this may + * again go away, so this is a FIXME item. + */ +static u64 +div64 (u64 a, u32 b0) +{ + u32 a1, a2; + u32 res; + + a1 = ((u32 *) &a)[0]; + a2 = ((u32 *) &a)[1]; + res = a1/b0 + (u64) a2 * (u64) (0xffffffff/b0) + a2 / b0 + (a2 * (0xffffffff % b0)) / b0; + + return res; +} +#endif /* DODGY_GCC */ + + /* * Ok, I give up :-) for some reason unknown to me the addition of 2 seconds * is needed to get the correct time. @@ -202,8 +225,13 @@ vms2timespec (struct timespec *dest, vms_timestamp_t src) { /* time_t = (vms-350669880092000)/10000000 + 2 */ +#ifdef DODGY_GCC + dest->tv_sec = div64 ((le64_to_cpu (src) - 35066988009200000ull), 10000000) + 2; + dest->tv_nsec = le64_to_cpu (src) - div64 (src, 10000000); +#else dest->tv_sec = (le64_to_cpu (src) - 35066988009200000ull) / 10000000 + 2; dest->tv_nsec = (le64_to_cpu (src) - 35066988009200000ull) % 10000000; +#endif } void Index: ods2.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/fs/ods2/ods2.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ods2.h 23 Sep 2004 13:43:02 -0000 1.10 +++ ods2.h 30 Sep 2004 19:52:18 -0000 1.11 @@ -498,7 +498,6 @@ /* * util.c */ -extern u64 div64(u64 a, u32 b0); extern u32 vbn2lbn(struct super_block *sb, struct ods2map *map, u32 vbn); extern u32 ino2fhlbn(struct super_block *sb, u32 ino); extern struct ods2map *getmap(struct super_block *sb, struct fh2def *fh2p); |