2009-07-21 00:00:26

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [patch 27/54] Staging: hv: remove ULONG and LONG typedefs

On Friday 17 July 2009, Greg Kroah-Hartman wrote:
> From: Greg Kroah-Hartman <[email protected]>
>
> The ULONG and LONG typedefs are now removed from the Hyper-V driver
> code
>

This conversion is not equivalent:

> //
> -// unsigned types
> -//
> -typedef unsigned int ULONG;
> -
> -//
> -// signed types
> -//
> -typedef int LONG;

- // redefine the world, because we can
- extern char *i;
- void abs(unsigned u);
- #define FALSE (2)

;-)

> --- a/drivers/staging/hv/include/StorVscApi.h
> +++ b/drivers/staging/hv/include/StorVscApi.h
> @@ -117,7 +117,7 @@ typedef struct _STORVSC_DRIVER_OBJECT {
> } STORVSC_DRIVER_OBJECT;
>
> typedef struct _STORVSC_DEVICE_INFO {
> - ULONG PortNumber;
> + unsigned long PortNumber;
> unsigned char PathId;
> unsigned char TargetId;
> } STORVSC_DEVICE_INFO;

If this is an API (as the header file name suggests), you just changed it.
Same for the other hunks in this patch.

Arnd <><


2009-07-21 00:50:24

by Hank Janssen

[permalink] [raw]
Subject: RE: [patch 27/54] Staging: hv: remove ULONG and LONG typedefs



Arnd,

Thanks for this and the other mails reviewing the code.

My TODO list keeps on getting bigger :). I will check into all of these and correct them.

Keep them coming!

Thanks!

Hank.


-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: Monday, July 20, 2009 5:00 PM
To: [email protected]
Cc: Greg Kroah-Hartman; [email protected]; [email protected]; [email protected]; Greg KH; Sam Ramji; Haiyang Zhang; Hank Janssen; [email protected]
Subject: Re: [patch 27/54] Staging: hv: remove ULONG and LONG typedefs

On Friday 17 July 2009, Greg Kroah-Hartman wrote:
> From: Greg Kroah-Hartman <[email protected]>
>
> The ULONG and LONG typedefs are now removed from the Hyper-V driver
> code
>

This conversion is not equivalent:

> //
> -// unsigned types
> -//
> -typedef unsigned int ULONG;
> -
> -//
> -// signed types
> -//
> -typedef int LONG;

- // redefine the world, because we can
- extern char *i;
- void abs(unsigned u);
- #define FALSE (2)

;-)

> --- a/drivers/staging/hv/include/StorVscApi.h
> +++ b/drivers/staging/hv/include/StorVscApi.h
> @@ -117,7 +117,7 @@ typedef struct _STORVSC_DRIVER_OBJECT {
> } STORVSC_DRIVER_OBJECT;
>
> typedef struct _STORVSC_DEVICE_INFO {
> - ULONG PortNumber;
> + unsigned long PortNumber;
> unsigned char PathId;
> unsigned char TargetId;
> } STORVSC_DEVICE_INFO;

If this is an API (as the header file name suggests), you just changed it.
Same for the other hunks in this patch.

Arnd <><

2009-07-21 02:49:10

by Greg KH

[permalink] [raw]
Subject: Re: [patch 27/54] Staging: hv: remove ULONG and LONG typedefs

On Mon, Jul 20, 2009 at 07:38:23PM -0700, Greg KH wrote:
> On Tue, Jul 21, 2009 at 02:00:16AM +0200, Arnd Bergmann wrote:
> > On Friday 17 July 2009, Greg Kroah-Hartman wrote:
> > > From: Greg Kroah-Hartman <[email protected]>
> > >
> > > The ULONG and LONG typedefs are now removed from the Hyper-V driver
> > > code
> > >
> >
> > This conversion is not equivalent:
> >
> > > //
> > > -// unsigned types
> > > -//
> > > -typedef unsigned int ULONG;
> > > -
> > > -//
> > > -// signed types
> > > -//
> > > -typedef int LONG;
> >
> > - // redefine the world, because we can
> > - extern char *i;
> > - void abs(unsigned u);
> > - #define FALSE (2)
> >
> > ;-)
> >
> > > --- a/drivers/staging/hv/include/StorVscApi.h
> > > +++ b/drivers/staging/hv/include/StorVscApi.h
> > > @@ -117,7 +117,7 @@ typedef struct _STORVSC_DRIVER_OBJECT {
> > > } STORVSC_DRIVER_OBJECT;
> > >
> > > typedef struct _STORVSC_DEVICE_INFO {
> > > - ULONG PortNumber;
> > > + unsigned long PortNumber;
> > > unsigned char PathId;
> > > unsigned char TargetId;
> > > } STORVSC_DEVICE_INFO;
> >
> > If this is an API (as the header file name suggests), you just changed it.
> > Same for the other hunks in this patch.
>
> Ah crap, you're right, that's all wrong, nice catch.
>
> I'll go redo it to be "unsigned int", but for some reason, the code
> still seems to work properly :)

Ok, here's the updated version. Thanks for the review.

Hank, a lot of these should probably be converted to "real" kernel
types, like u32, or u64 if it's really needed. Especially if they are
crossing the kernel/hypervisor boundry.

thanks,

greg k-h

-------------
From: Greg Kroah-Hartman <[email protected]>
Subject: Staging: hv: remove ULONG and LONG typedefs

From: Greg Kroah-Hartman <[email protected]>

The ULONG and LONG typedefs are now removed from the Hyper-V driver
code.

Cc: Hank Janssen <[email protected]>
Cc: Haiyang Zhang <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
drivers/staging/hv/StorVsc.c | 2 +-
drivers/staging/hv/include/StorVscApi.h | 2 +-
drivers/staging/hv/include/osd.h | 10 ----------
drivers/staging/hv/include/vstorage.h | 12 ++++++------
4 files changed, 8 insertions(+), 18 deletions(-)

--- a/drivers/staging/hv/StorVsc.c
+++ b/drivers/staging/hv/StorVsc.c
@@ -62,7 +62,7 @@ typedef struct _STORVSC_DEVICE{

// Each unique Port/Path/Target represents 1 channel ie scsi controller. In reality, the pathid, targetid is always 0
// and the port is set by us
- ULONG PortNumber;
+ unsigned int PortNumber;
unsigned char PathId;
unsigned char TargetId;

--- a/drivers/staging/hv/include/StorVscApi.h
+++ b/drivers/staging/hv/include/StorVscApi.h
@@ -117,7 +117,7 @@ typedef struct _STORVSC_DRIVER_OBJECT {
} STORVSC_DRIVER_OBJECT;

typedef struct _STORVSC_DEVICE_INFO {
- ULONG PortNumber;
+ unsigned int PortNumber;
unsigned char PathId;
unsigned char TargetId;
} STORVSC_DEVICE_INFO;
--- a/drivers/staging/hv/include/osd.h
+++ b/drivers/staging/hv/include/osd.h
@@ -95,16 +95,6 @@ typedef struct _DLIST_ENTRY {
} DLIST_ENTRY;

//
-// unsigned types
-//
-typedef unsigned int ULONG;
-
-//
-// signed types
-//
-typedef int LONG;
-
-//
// Other types
//
typedef unsigned long SIZE_T;
--- a/drivers/staging/hv/include/vstorage.h
+++ b/drivers/staging/hv/include/vstorage.h
@@ -155,7 +155,7 @@ typedef struct
unsigned char DataIn;
unsigned char Reserved;

- ULONG DataTransferLength;
+ unsigned int DataTransferLength;

union
{
@@ -185,11 +185,11 @@ typedef struct
//
// Note: port number is only really known on the client side
//
- ULONG PortNumber;
+ unsigned int PortNumber;

- ULONG Flags;
+ unsigned int Flags;

- ULONG MaxTransferBytes;
+ unsigned int MaxTransferBytes;

//
// This id is unique for each channel and will correspond with
@@ -249,13 +249,13 @@ typedef struct _VSTOR_PACKET
// Flags - see below for values
//

- ULONG Flags;
+ unsigned int Flags;

//
// Status of the request returned from the server side.
//

- ULONG Status;
+ unsigned int Status;

//
// Data payload area

2009-07-21 02:48:56

by Greg KH

[permalink] [raw]
Subject: Re: [patch 27/54] Staging: hv: remove ULONG and LONG typedefs

On Tue, Jul 21, 2009 at 02:00:16AM +0200, Arnd Bergmann wrote:
> On Friday 17 July 2009, Greg Kroah-Hartman wrote:
> > From: Greg Kroah-Hartman <[email protected]>
> >
> > The ULONG and LONG typedefs are now removed from the Hyper-V driver
> > code
> >
>
> This conversion is not equivalent:
>
> > //
> > -// unsigned types
> > -//
> > -typedef unsigned int ULONG;
> > -
> > -//
> > -// signed types
> > -//
> > -typedef int LONG;
>
> - // redefine the world, because we can
> - extern char *i;
> - void abs(unsigned u);
> - #define FALSE (2)
>
> ;-)
>
> > --- a/drivers/staging/hv/include/StorVscApi.h
> > +++ b/drivers/staging/hv/include/StorVscApi.h
> > @@ -117,7 +117,7 @@ typedef struct _STORVSC_DRIVER_OBJECT {
> > } STORVSC_DRIVER_OBJECT;
> >
> > typedef struct _STORVSC_DEVICE_INFO {
> > - ULONG PortNumber;
> > + unsigned long PortNumber;
> > unsigned char PathId;
> > unsigned char TargetId;
> > } STORVSC_DEVICE_INFO;
>
> If this is an API (as the header file name suggests), you just changed it.
> Same for the other hunks in this patch.

Ah crap, you're right, that's all wrong, nice catch.

I'll go redo it to be "unsigned int", but for some reason, the code
still seems to work properly :)

thanks,

greg k-h

2009-07-21 08:32:14

by Bernd Petrovitsch

[permalink] [raw]
Subject: Re: [patch 27/54] Staging: hv: remove ULONG and LONG typedefs

On Tue, 2009-07-21 at 02:00 +0200, Arnd Bergmann wrote:
> On Friday 17 July 2009, Greg Kroah-Hartman wrote:
> > From: Greg Kroah-Hartman <[email protected]>
> >
> > The ULONG and LONG typedefs are now removed from the Hyper-V driver
> > code
>
> This conversion is not equivalent:
[...]
> - // redefine the world, because we can
[...]
> - #define FALSE (2)
That has been done already by the SNMP folks - see
http://www.faqs.org/rfcs/rfc1903.html under "TruthValue".
S,CNR and for off-topic ...

> ;-)
;-) either ....

Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services