[openib-general] [PATCH RFC 18/21] ofed_1_2 Backportinfiniband/hw/cxgb3/core/cxio_resource.c to sles9sp3

Michael S. Tsirkin mst at mellanox.co.il
Tue Jan 16 06:20:45 PST 2007


> Quoting Steve WIse <swise at opengridcomputing.com>:
> Subject: Re: [PATCH  RFC 18/21] ofed_1_2 Backportinfiniband/hw/cxgb3/core/cxio_resource.c to sles9sp3
> 
> 
> > Surely random32 can be a macro in kernel_addons?
> > 
> 
> I started out trying to back-port random32().  But it was too hairy and
> not worth the effort IMO.  I don't know how make random32() use
> get_random_bytes() in a macro and return the value. Show me how.

Use a gcc extension:

#define random32() ({ int random32_internal_variable;             \
		    get_random_bytes(&random32_internal_variable);\
		    random32_internal_variable; })

or just make it an inline function

-- 
MST




More information about the general mailing list