[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/2] xen/dom0: Add a dom0-iommu=none option



>>> On 21.12.18 at 13:55, <andrew.cooper3@xxxxxxxxxx> wrote:
> On 21/12/2018 12:13, Jan Beulich wrote:
>>>>> On 21.12.18 at 00:40, <andrew.cooper3@xxxxxxxxxx> wrote:
>>> @@ -271,6 +272,26 @@ int parse_boolean(const char *name, const char *s, 
>>> const char *e)
>>>      return -1;
>>>  }
>>>  
>>> +int cmdline_strcmp(const char *frag, const char *name)
>> __init ?
> 
> I think there are some runtime parameters in need of some fixing as well.

Ideally we'd drop __init at the point such a change indeed goes in. As
a compromise you may want to mention the reason for the omission
in the description (preferably with a concrete example).

>>> +{
>>> +    while ( 1 )
>>> +    {
>>> +        int res = (*frag - *name);
>>> +
>>> +        if ( res || *name == '\0' )
>>> +        {
>>> +            /* NUL in 'name' matching punctuation in 'frag' implies 
>>> success. */
>>> +            if ( *name == '\0' && ispunct(*frag) )
>>> +                res = 0;
>> Isn't ispunct() true for dashes and perhaps also underscores?
>> I don't think it can be this generic, the more that ...
>>
>>> --- a/xen/include/xen/lib.h
>>> +++ b/xen/include/xen/lib.h
>>> @@ -79,6 +79,13 @@ int parse_bool(const char *s, const char *e);
>>>   */
>>>  int parse_boolean(const char *name, const char *s, const char *e);
>>>  
>>> +/**
>>> + * Very similar to strcmp(), but will declare a match if the NUL in 'name'
>>> + * lines up with punctuationin 'frag'.  Designed for picking exact string
>>> + * matches out of a comma-separated command line fragment.
>>> + */
>>> +int cmdline_strcmp(const char *frag, const char *name);
>> ... you talk of commas only here.
> 
> I actually borrowed this function from my CPUID cmdline patch.  In 99%
> of cases, we only need to match = and , but we have some other
> parameters such as psr= which use : for delimiters, hence the use of
> ispunct().
> 
> As an alternative, I could revert back to explicitly checking the
> expected punctuation.  It is not as if this is a fastpath.

Imo this would be better than treating punctuation we don't want
to consider separators the same as intended-to-be-separators.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.