Hal Patch for __u8 types

JP Rosevear jpr at novell.com
Thu Jul 14 11:50:57 PDT 2005


On Thu, 2005-07-14 at 16:27 +0100, Alvaro Lopez Ortega wrote:
> JP Rosevear wrote:
> 
>  >>   As far a I have seen, there are two options:
>  >>
>  >>   - Check for asm/types.h with AC_CHECK_HEADERS. It found, use the
>  >>     HAVE_ASM_TYPES_H definition to include the header in each
> source
>  >>     file.
>  >>
>  >>   - Remove the check for __u8 and redefine the Linux kernel types
> with
>  >>     C types always, even if it is a Linux box.
>  >>
>  >>   The second approach is a little bit dirtier at the base, but it
> will
>  >>   keep the source code a little bit cleaner.
>  >
>  > This was failing for me with the 2.6.12 kernel headers in the glibc
> we
>  > are using for suse 10.0.
> 
>    JP, David; please check if this makes everybody happy.
> 
> -- 
> Greetings, alo.
> 
> 
> 
> 
> 
> 
> 
> differences
> between files
> attachment
> (hal-linux-types.diff)
> 
>  configure.in |   29 +++++++++++++++++++----------
>  1 files changed, 19 insertions(+), 10 deletions(-)
> 
> Index: configure.in
> ===================================================================
> RCS file: /cvs/hal/hal/configure.in,v
> retrieving revision 1.92
> diff -u -r1.92 configure.in
> --- configure.in        13 Jul 2005 00:08:16 -0000      1.92
> +++ configure.in        14 Jul 2005 15:04:44 -0000
> @@ -35,16 +35,16 @@
>  
>  AC_CHECK_HEADERS([sys/ioccom.h])
>  
> -AC_CHECK_TYPE(__u8, ,
> -              [AC_DEFINE(__s8,  int8_t,   [Signed 8 bits type])
> -               AC_DEFINE(__u8,  uint8_t,  [Unsigned 8 bits type])
> -               AC_DEFINE(__s16, int16_t,  [Signed 16 bits type])
> -               AC_DEFINE(__u16, uint16_t, [Unsigned 16 bits type])
> -               AC_DEFINE(__s32, int32_t,  [Signed 32 bits type])
> -               AC_DEFINE(__u32, uint32_t, [Unsigned 32 bits type])
> -               AC_DEFINE(__s64, int64_t,  [Signed 64 bits type])
> -               AC_DEFINE(__u64, uint64_t, [Unsigned 64 bits type])],
> -               /usr/include/sys/types.h)
> +AC_CHECK_HEADERS([asm/types.h],,
> +                 [AC_DEFINE(__s8,  int8_t,   [Signed 8 bits type])
> +                  AC_DEFINE(__u8,  uint8_t,  [Unsigned 8 bits type])
> +                  AC_DEFINE(__s16, int16_t,  [Signed 16 bits type])
> +                  AC_DEFINE(__u16, uint16_t, [Unsigned 16 bits type])
> +                  AC_DEFINE(__s32, int32_t,  [Signed 32 bits type])
> +                  AC_DEFINE(__u32, uint32_t, [Unsigned 32 bits type])
> +                  AC_DEFINE(__s64, int64_t,  [Signed 64 bits type])
> +                  AC_DEFINE(__u64, uint64_t, [Unsigned 64 bits
> type])],
> +                          [#include <sys/types.h>])

>  AC_ARG_WITH(os-type,     [  --with-os-type=<os>     Distribution or
> OS (redhat)])
>  AC_ARG_WITH(pid-file,    [  --with-pid-file=<file>  PID file for HAL
> daemon])
> @@ -511,6 +511,15 @@
>  drive_id/Makefile
>  volume_id/Makefile
>  ])
> +
> +cat >>config.h <<_______EOF
> +
> +/* Make Linux types available all along the project */
> +#ifdef HAVE_SYS_ASM_H
> +# include <asm/types.h>
> +#endif
> +_______EOF
> +
>  

I don't think you want to do this.  config.h can also be replaced with
-D passes to the compiler, which is why people do the #ifdef
HAVE_CONFIG_H thing afaik.  I think you just want to conditionally
include asm/types.h in the source files themselves.

This patch also doesn't solve the linux/hdreg.h problem.

Perhaps the real problem is that the drive_id code isn't machine
agnostic and the alternative of breaking up host specific code like in
agents/hald is also not done.

-JP
-- 
JP Rosevear <jpr at novell.com>
Novell, Inc.

_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list