[openib-general] RE: [PATCH] Opensm - cl_event_wheel casting

Yael Kalka yael at mellanox.co.il
Sat Feb 11 23:56:05 PST 2006


Hi Hal,
I am not sure it really matters, as the timeout used will be of uint32_t size
anyways.
If you think using the max 32 bit makes more sense - I am fine with that too.
Yael

-----Original Message-----
From: Hal Rosenstock [mailto:halr at voltaire.com]
Sent: Thursday, February 09, 2006 5:29 PM
To: Yael Kalka
Cc: openib-general at openib.org; Eitan Zahavi
Subject: Re: [PATCH] Opensm - cl_event_wheel casting


Hi Yael,

On Mon, 2006-02-06 at 03:53, Yael Kalka wrote:
> Hi Hal,
> 
> The following patch adds the casting done in a clearer way - to avoid
> compilation errors in windows. Also - added a clear message if the
> timeout was trimmed (due to the casting).
> 
> Thanks,
> Yael
> 
> Signed-off-by:  Yael Kalka <yael at mellanox.co.il>
> 
> Index: complib/cl_event_wheel.c
> ===================================================================
> --- complib/cl_event_wheel.c    (revision 5307)
> +++ complib/cl_event_wheel.c    (working copy)
> @@ -426,8 +426,18 @@ cl_event_wheel_reg(
>       * cl_timer_stop(&p_event_wheel->timer);
>       */
>  
> +    /* The timeout for the cl_timer_start should be given as uint32_t.
> +       if there is an overflow - warn about it. */
> +    if ( timeout > (uint32_t)timeout )
> +    {
> +      osm_log (p_event_wheel->p_log, OSM_LOG_INFO,
> +               "cl_event_wheel_reg: "
> +               "timeout requested is too large. Using timeout: %u \n",
> +               (uint32_t)timeout );
> +    }
> +
>      /* start the timer to the timeout [msec] */
> -    cl_status = cl_timer_start(&p_event_wheel->timer, timeout);
> +    cl_status = cl_timer_start(&p_event_wheel->timer, (uint32_t)timeout);

Shouldn't this use the max 32 bit timeout here rather than the low 32
bits ?

-- Hal

>      if (cl_status != CL_SUCCESS)
>      {
> 



More information about the general mailing list