Re: [PATCH 3/4] sys/reboot: boolize C_A_D

2013-06-02 Thread Joe Perches
On Fri, 2013-05-31 at 16:02 -0700, Andrew Morton wrote:
> there's no rule
> which states that sizeof(bool) must equal sizeof(int).

For gcc, sizeof(_Bool) isn't sizeof(int) so it would
work for one endian but not the other.

gcc has sizeof(_Bool) == sizeof(unsigned char)

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


Re: [PATCH 3/4] sys/reboot: boolize C_A_D

2013-06-02 Thread li guang
在 2013-05-31五的 16:02 -0700,Andrew Morton写道:
> On Thu, 30 May 2013 15:58:05 +0800 liguang  wrote:
> 
> > --- a/include/linux/reboot.h
> > +++ b/include/linux/reboot.h
> > @@ -35,7 +35,7 @@ extern void kernel_restart(char *cmd);
> >  extern void kernel_halt(void);
> >  extern void kernel_power_off(void);
> >  
> > -extern int C_A_D; /* for sysctl */
> > +extern bool C_A_D; /* for sysctl */
> >  void ctrl_alt_del(void);
> 
> This means that the pointer in kernel/sysctl.c:kern_table.data now
> points at a bool but is declared to have size sizeof(int).
> 
> That happens to work with current gcc verions, but there's no rule
> which states that sizeof(bool) must equal sizeof(int).
> 
> And I'm not sure that changing kern_table to use sizeof(bool) is really
> worth all the bother.

OK, got it,

Thanks!

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


Re: [PATCH 3/4] sys/reboot: boolize C_A_D

2013-06-02 Thread li guang
在 2013-05-31五的 16:02 -0700,Andrew Morton写道:
 On Thu, 30 May 2013 15:58:05 +0800 liguang lig.f...@cn.fujitsu.com wrote:
 
  --- a/include/linux/reboot.h
  +++ b/include/linux/reboot.h
  @@ -35,7 +35,7 @@ extern void kernel_restart(char *cmd);
   extern void kernel_halt(void);
   extern void kernel_power_off(void);
   
  -extern int C_A_D; /* for sysctl */
  +extern bool C_A_D; /* for sysctl */
   void ctrl_alt_del(void);
 
 This means that the pointer in kernel/sysctl.c:kern_table.data now
 points at a bool but is declared to have size sizeof(int).
 
 That happens to work with current gcc verions, but there's no rule
 which states that sizeof(bool) must equal sizeof(int).
 
 And I'm not sure that changing kern_table to use sizeof(bool) is really
 worth all the bother.

OK, got it,

Thanks!

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


Re: [PATCH 3/4] sys/reboot: boolize C_A_D

2013-06-02 Thread Joe Perches
On Fri, 2013-05-31 at 16:02 -0700, Andrew Morton wrote:
 there's no rule
 which states that sizeof(bool) must equal sizeof(int).

For gcc, sizeof(_Bool) isn't sizeof(int) so it would
work for one endian but not the other.

gcc has sizeof(_Bool) == sizeof(unsigned char)

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


Re: [PATCH 3/4] sys/reboot: boolize C_A_D

2013-05-31 Thread Andrew Morton
On Thu, 30 May 2013 15:58:05 +0800 liguang  wrote:

> --- a/include/linux/reboot.h
> +++ b/include/linux/reboot.h
> @@ -35,7 +35,7 @@ extern void kernel_restart(char *cmd);
>  extern void kernel_halt(void);
>  extern void kernel_power_off(void);
>  
> -extern int C_A_D; /* for sysctl */
> +extern bool C_A_D; /* for sysctl */
>  void ctrl_alt_del(void);

This means that the pointer in kernel/sysctl.c:kern_table.data now
points at a bool but is declared to have size sizeof(int).

That happens to work with current gcc verions, but there's no rule
which states that sizeof(bool) must equal sizeof(int).

And I'm not sure that changing kern_table to use sizeof(bool) is really
worth all the bother.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/4] sys/reboot: boolize C_A_D

2013-05-31 Thread Andrew Morton
On Thu, 30 May 2013 15:58:05 +0800 liguang lig.f...@cn.fujitsu.com wrote:

 --- a/include/linux/reboot.h
 +++ b/include/linux/reboot.h
 @@ -35,7 +35,7 @@ extern void kernel_restart(char *cmd);
  extern void kernel_halt(void);
  extern void kernel_power_off(void);
  
 -extern int C_A_D; /* for sysctl */
 +extern bool C_A_D; /* for sysctl */
  void ctrl_alt_del(void);

This means that the pointer in kernel/sysctl.c:kern_table.data now
points at a bool but is declared to have size sizeof(int).

That happens to work with current gcc verions, but there's no rule
which states that sizeof(bool) must equal sizeof(int).

And I'm not sure that changing kern_table to use sizeof(bool) is really
worth all the bother.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/