[parisc-linux-cvs] Large file work

Matthew Wilcox matthew@wil.cx
Mon, 2 Apr 2001 02:35:30 +0100


On Thu, Mar 29, 2001 at 03:00:52PM -0700, Matthew Wilcox wrote:
>  /* LFS versions of truncate are only needed on 32 bit machines */
>  #if BITS_PER_LONG == 32
> +#ifdef __hppa__
> +/*
> + * The fuckwits who did this assumed they knew the ABI on every single
> + * 32-bit processor supported by Linux.  Surprisingly THEY WERE WRONG.
> + * Never Never Never Never prototype a syscall to take a `long long' as an
> + * argument, because You Will Lose.  And it's too late to fix it, because
> + * the glibc morons are using this stupid macro which passes either the
> + * high or low half of the word first, depending on your endianness.
> + * So the simple obvious C below cannot be used on other architectures.
> + * Bunch of fucking losers.
> + */
> +asmlinkage long sys_truncate64(const char * path, unsigned int high, unsigned int low)
> +{
> +	return do_sys_truncate(path, (loff_t)high << 32 | low);
> +}
> +
> +asmlinkage long sys_ftruncate64(unsigned int fd, unsigned int high, unsigned int low)
> +{
> +	return do_sys_ftruncate(fd, (loff_t)high << 32 | low);
> +}
> +#else
>  asmlinkage long sys_truncate64(const char * path, loff_t length)
>  {
>  	return do_sys_truncate(path, length);
> @@ -195,6 +216,7 @@ asmlinkage long sys_ftruncate64(unsigned
>  {
>  	return do_sys_ftruncate(fd, length);
>  }
> +#endif
>  #endif
>  
>  #if !(defined(__alpha__) || defined(__ia64__))

I thought of a better way of doing this.  They're still fuckwits though.

#if BITS_PER_LONG == 32
#ifdef __BIG_ENDIAN
#define LOFF_T(high, low) unsigned int high, unsigned int low
#else
#define LOFF_T(high, low) unsigned int low, unsigned int high
#endif
asmlinkage long sys_truncate64(const char * path, LOFF_T(high, low))
{
	return do_sys_truncate(path, (loff_t)high << 32 | low);
}

asmlinkage long sys_ftruncate64(unsigned int fd, LOFF_T(high, low))
{
	return do_sys_ftruncate(fd, (loff_t)high << 32 | low);
}
#endif


-- 
Revolutions do not require corporate support.