[ofa-general] Re: [PATCH] osm: handle first syntax error in policy file
Yevgeny Kliteynik
kliteyn at dev.mellanox.co.il
Thu Nov 15 07:36:50 PST 2007
Sasha Khapyorsky wrote:
> On 15:56 Thu 15 Nov , Yevgeny Kliteynik wrote:
>> Sasha Khapyorsky wrote:
>>> Hi Yevgeny,
>>> On 14:03 Thu 15 Nov , Yevgeny Kliteynik wrote:
>>>> When parsing QoS policy file for the first time, print
>>>> first syntax error to stdout and to the osm log.
>>>>
>>>> Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
>>>> ---
>>>> opensm/opensm/osm_qos_parser.y | 11 ++++++++++-
>>>> 1 files changed, 10 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/opensm/opensm/osm_qos_parser.y
>>>> b/opensm/opensm/osm_qos_parser.y
>>>> index 4738831..71f41fe 100644
>>>> --- a/opensm/opensm/osm_qos_parser.y
>>>> +++ b/opensm/opensm/osm_qos_parser.y
>>>> @@ -1873,12 +1873,21 @@ int __qos_parser_wrap()
>>>>
>>>> void __qos_parser_error (char *s)
>>>> {
>>>> + static boolean_t first_time = TRUE;
>>> Could we avoid using static variables?
>> Would you prefer global flags instead?
>
> Not really.
>
>> Is there any other way? Nothing comes to mind right now...
>
> Could you pass parameters to parser, then this flag could be kept as
> part of the structure.
>
>>> (But seems __qos_parser_error() function itself should be declared as
>>> static).
>> Sorry, can't do - it's defined by yacc, and
>> it's even declared as extern in this file.
>
> Isn't it hand made part?
>
> This works for me:
>
Indeed...
Anyway, as I said, I'll repost the patch.
-- Yevgeny
> diff --git a/opensm/opensm/osm_qos_parser.y b/opensm/opensm/osm_qos_parser.y
> index 4738831..d9e1567 100644
> --- a/opensm/opensm/osm_qos_parser.y
> +++ b/opensm/opensm/osm_qos_parser.y
> @@ -124,9 +124,9 @@ static void __parser_add_partition_list_to_port_map(
> static void __parser_add_map_to_port_map(
> cl_qmap_t * p_dmap,
> cl_map_t * p_smap);
> +static void __qos_parser_error (char *s);
>
> extern char * __qos_parser_text;
> -extern void __qos_parser_error (char *s);
> extern int __qos_parser_lex (void);
> extern FILE * __qos_parser_in;
> extern int errno;
> @@ -1871,7 +1871,7 @@ int __qos_parser_wrap()
> /***************************************************
> ***************************************************/
>
> -void __qos_parser_error (char *s)
> +static void __qos_parser_error (char *s)
> {
> OSM_LOG_ENTER(p_qos_parser_osm_log, __qos_parser_error);
> osm_log(p_qos_parser_osm_log, OSM_LOG_ERROR,
>
>
> Sasha
>
More information about the general
mailing list