Re: [PATCH] struct loop_info

From: Andreas Dilger (adilger@clusterfs.com)
Date: Fri Apr 18 2003 - 00:05:00 EST


On Apr 18, 2003 01:34 +0200, Andries.Brouwer@cwi.nl wrote:
> Until now as the source already says, we had a very unpleasant
> situation with struct loop_info:
>
> -/*
> - * Note that this structure gets the wrong offsets when directly used
> - * from a glibc program, because glibc has a 32bit dev_t.
> - * Prevent people from shooting in their own foot.
> - */
> -#if __GLIBC__ >= 2 && !defined(dev_t)
> -#error "Wrong dev_t in loop.h"
> -#endif
> -
> -/*
> - * This uses kdev_t because glibc currently has no appropiate
> - * conversion version for the loop ioctls.
> - * The situation is very unpleasant
> - */
>
> In the patch below I remove the definition for this struct from
> <linux/loop.h> and put it in <asm/loopinfo.h>.

Great. Now we have 20 copies of asm-foo/loopinfo.h. Couldn't you
just have asm-generic/loopinfo.h and each of the arch-specific
pieces just include that?

> In this struct the occurrences of dev_t have been replaced by their
> actual values (short int / int / long int).

Even better, have specific sized types (__u16, __u32, __u64) for the
fields, so there is no ambiguity (e.g. sparc64, or 32-bit code running
on x86-64).

Cheers, Andreas

--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 23 2003 - 22:00:23 EST