[openib-general] Re: [PATCH][0/19] kDAPL: More cleanups in dat.h

James Lentini jlentini at netapp.com
Wed May 18 07:12:06 PDT 2005


On Wed, 18 May 2005, Michael S. Tsirkin wrote:

> Quoting r. Roland Dreier <roland at topspin.com>:
>> Subject: Re: [PATCH][0/19] kDAPL: More cleanups in dat.h
>>
>>     James> DAPL was using the uintptr_t type when casting to an
>>     James> integer type from a pointer type. Is there another type
>>     James> that the kernel uses for this purpose? I know that long is
>>     James> typically used, but according to Harbison and Stelle this
>>     James> is not guaranteed to be correct.
>
> AFAIK that appeared in the C99 standard.
> You need #include <stdint.h> to get these types though.

The problem is stdint.h is a user level include file. The linux kernel 
sources don't contain a common definition of uintptr_t. There is a 
#define for uintptr_t in drivers/net/sk98lin/h/skdrv1st.h in 2.6.11, 
but obviously that was not intended for general use.

I'll go with unsigned long.

>> The assumption that pointers can be safely cast to and from unsigned
>> long is used all over the Linux kernel.  In other words, use "unsigned
>> long" instead of "uintptr_t".
>>
>>  - R.
>
> Right. Its OK because kernel requires gcc.
>
> -- 
> MST - Michael S. Tsirkin
>



More information about the general mailing list