Re: Typo in biovar.h?

2011-05-13 Thread Mark Kettenis
 From: Vadim Zhukov persg...@gmail.com
 Date: Fri, 13 May 2011 13:10:10 +0400
 
 Hello all.
 
 Looks like there is a typo in ioctl number...

What makes you think this is a typo?

 Index: biovar.h
 ===
 RCS file: /cvs/src/sys/dev/biovar.h,v
 retrieving revision 1.39
 diff -u -p -r1.39 biovar.h
 --- biovar.h  14 Apr 2011 02:41:40 -  1.39
 +++ biovar.h  13 May 2011 09:08:54 -
 @@ -213,7 +213,7 @@ struct bioc_discipline {
   void*bd_data;
  };
  
 -#define BIOCINSTALLBOOT _IOWR('B', 40, struct bioc_installboot)
 +#define BIOCINSTALLBOOT _IOWR('B', 41, struct bioc_installboot)
  struct bioc_installboot {
   void*bb_cookie;
   charbb_dev[16];



Re: Typo in biovar.h?

2011-05-13 Thread Mike Belopuhov
On Fri, May 13, 2011 at 11:26 AM, Mark Kettenis mark.kette...@xs4all.nl wrote:
 From: Vadim Zhukov persg...@gmail.com
 Date: Fri, 13 May 2011 13:10:10 +0400

 Hello all.

 Looks like there is a typo in ioctl number...

 What makes you think this is a typo?


there are two ioctls with the same command number:

#define BIOCDISCIPLINE _IOWR('B', 40, struct bioc_discipline)
#define BIOCINSTALLBOOT _IOWR('B', 40, struct bioc_installboot)



Re: Typo in biovar.h?

2011-05-13 Thread Otto Moerbeek
On Fri, May 13, 2011 at 11:39:01AM +0200, Mike Belopuhov wrote:

 On Fri, May 13, 2011 at 11:26 AM, Mark Kettenis mark.kette...@xs4all.nl 
 wrote:
  From: Vadim Zhukov persg...@gmail.com
  Date: Fri, 13 May 2011 13:10:10 +0400
 
  Hello all.
 
  Looks like there is a typo in ioctl number...
 
  What makes you think this is a typo?
 
 
 there are two ioctls with the same command number:
 
 #define BIOCDISCIPLINE _IOWR('B', 40, struct bioc_discipline)
 #define BIOCINSTALLBOOT _IOWR('B', 40, struct bioc_installboot)

Only if the two structs happen to have the same size they will clash.

-Otto



Re: Typo in biovar.h?

2011-05-13 Thread Mike Belopuhov
On Fri, May 13, 2011 at 11:50 AM, Otto Moerbeek o...@drijf.net wrote:
 On Fri, May 13, 2011 at 11:39:01AM +0200, Mike Belopuhov wrote:

 On Fri, May 13, 2011 at 11:26 AM, Mark Kettenis mark.kette...@xs4all.nl
wrote:
  From: Vadim Zhukov persg...@gmail.com
  Date: Fri, 13 May 2011 13:10:10 +0400
 
  Hello all.
 
  Looks like there is a typo in ioctl number...
 
  What makes you think this is a typo?
 

 there are two ioctls with the same command number:

 #define BIOCDISCIPLINE _IOWR('B', 40, struct bioc_discipline)
 #define BIOCINSTALLBOOT _IOWR('B', 40, struct bioc_installboot)

 Only if the two structs happen to have the same size they will clash.


indeed.  but was it intentional to have them both set to 40
in the first place?

-Otto



Re: Typo in biovar.h?

2011-05-13 Thread Mark Kettenis
 Date: Fri, 13 May 2011 11:50:12 +0200
 From: Otto Moerbeek o...@drijf.net
 Cc: Mark Kettenis mark.kette...@xs4all.nl, tech@openbsd.org
 Content-Disposition: inline
 X-XS4ALL-DNSBL-Checked: mxdrop237.xs4all.nl checked 82.161.50.143 against DNS 
 blacklists
 X-CNFS-Analysis: v=1.1 cv=BV6iOS6O7aV3pd42iKzuhu9AXfb4rD1J2pLXhYW4ImA= c=1
  sm=0 a=wom5GMh1gUkA:10 a=LCHf3gNu8b0A:10 a=kj9zAlcOel0A:10
  a=95R9LHwUiM9XYnuOhzEgLA==:17 a=pGLkceIS:8 a=eP-CJI4udlGgNzqIaiQA:9
  a=CjuIK1q_8ugA:10 a=MSl-tDqOz04A:10 a=sNZjZ9wWoAtMnVvd:21
  a=I_BvQy_iL38IfVgA:21 a=95R9LHwUiM9XYnuOhzEgLA==:117
 X-Virus-Scanned: by XS4ALL Virus Scanner
 X-XS4ALL-Spam-Score: 0.0 () none
 X-XS4ALL-Spam: NO
 Envelope-To: mark.kette...@xs4all.nl
 
 On Fri, May 13, 2011 at 11:39:01AM +0200, Mike Belopuhov wrote:
 
  On Fri, May 13, 2011 at 11:26 AM, Mark Kettenis mark.kette...@xs4all.nl 
  wrote:
   From: Vadim Zhukov persg...@gmail.com
   Date: Fri, 13 May 2011 13:10:10 +0400
  
   Hello all.
  
   Looks like there is a typo in ioctl number...
  
   What makes you think this is a typo?
  
  
  there are two ioctls with the same command number:
  
  #define BIOCDISCIPLINE _IOWR('B', 40, struct bioc_discipline)
  #define BIOCINSTALLBOOT _IOWR('B', 40, struct bioc_installboot)
 
 Only if the two structs happen to have the same size they will clash.

It's still a bad idea to use the same command number.  I believe we
encode the size of the structure in there as a sanity check, not to
extend the ioctl namespace.



Re: Typo in biovar.h?

2011-05-13 Thread Otto Moerbeek
On Fri, May 13, 2011 at 12:29:22PM +0200, Mark Kettenis wrote:

  On Fri, May 13, 2011 at 11:39:01AM +0200, Mike Belopuhov wrote:
  
   On Fri, May 13, 2011 at 11:26 AM, Mark Kettenis mark.kette...@xs4all.nl 
   wrote:
From: Vadim Zhukov persg...@gmail.com
Date: Fri, 13 May 2011 13:10:10 +0400
   
Hello all.
   
Looks like there is a typo in ioctl number...
   
What makes you think this is a typo?
   
   
   there are two ioctls with the same command number:
   
   #define BIOCDISCIPLINE _IOWR('B', 40, struct bioc_discipline)
   #define BIOCINSTALLBOOT _IOWR('B', 40, struct bioc_installboot)
  
  Only if the two structs happen to have the same size they will clash.
 
 It's still a bad idea to use the same command number.  I believe we
 encode the size of the structure in there as a sanity check, not to
 extend the ioctl namespace.

I agree with that, so if the ABI change will not cause too many
troubles, it should be fixed. 

-Otto



Re: Typo in biovar.h?

2011-05-13 Thread Stuart Henderson
On 2011/05/13 12:34, Otto Moerbeek wrote:
 On Fri, May 13, 2011 at 12:29:22PM +0200, Mark Kettenis wrote:
 
   On Fri, May 13, 2011 at 11:39:01AM +0200, Mike Belopuhov wrote:
   
On Fri, May 13, 2011 at 11:26 AM, Mark Kettenis 
mark.kette...@xs4all.nl wrote:
 From: Vadim Zhukov persg...@gmail.com
 Date: Fri, 13 May 2011 13:10:10 +0400

 Hello all.

 Looks like there is a typo in ioctl number...

 What makes you think this is a typo?


there are two ioctls with the same command number:

#define BIOCDISCIPLINE _IOWR('B', 40, struct bioc_discipline)
#define BIOCINSTALLBOOT _IOWR('B', 40, struct bioc_installboot)
   
   Only if the two structs happen to have the same size they will clash.
  
  It's still a bad idea to use the same command number.  I believe we
  encode the size of the structure in there as a sanity check, not to
  extend the ioctl namespace.
 
 I agree with that, so if the ABI change will not cause too many
 troubles, it should be fixed. 

It's only used by installboot, and only when installing a boot
loader onto a softraid volume, so I think this is fairly safe.

Side-note, BIOCINSTALLBOOT is missing from bio(4).



Re: Typo in biovar.h?

2011-05-13 Thread Marco Peereboom
On Fri, May 13, 2011 at 11:57:37AM +0200, Mike Belopuhov wrote:
 On Fri, May 13, 2011 at 11:50 AM, Otto Moerbeek o...@drijf.net wrote:
  On Fri, May 13, 2011 at 11:39:01AM +0200, Mike Belopuhov wrote:
 
  On Fri, May 13, 2011 at 11:26 AM, Mark Kettenis mark.kette...@xs4all.nl
 wrote:
   From: Vadim Zhukov persg...@gmail.com
   Date: Fri, 13 May 2011 13:10:10 +0400
  
   Hello all.
  
   Looks like there is a typo in ioctl number...
  
   What makes you think this is a typo?
  
 
  there are two ioctls with the same command number:
 
  #define BIOCDISCIPLINE _IOWR('B', 40, struct bioc_discipline)
  #define BIOCINSTALLBOOT _IOWR('B', 40, struct bioc_installboot)
 
  Only if the two structs happen to have the same size they will clash.
 
 
 indeed.  but was it intentional to have them both set to 40
 in the first place?

I'll venture and guess this was unintended.  We should make it unique
and I am ok with the original diff that makes it 41.

 
 -Otto