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

Re: [Xen-devel] [PATCH v3 2/6] xen/PMU: Sysfs interface for setting Xen PMU mode



On 07/07/14 15:04, Boris Ostrovsky wrote:
> On 07/04/2014 06:27 AM, David Vrabel wrote:
>> On 03/07/14 20:14, Boris Ostrovsky wrote:
>>> Set Xen's PMU mode via /sys/hypervisor/pmu/pmu_mode. Add XENPMU
>>> hypercall.
>>>
>> [...]
>>> +static ssize_t pmu_mode_store(struct hyp_sysfs_attr *attr,
>>> +                  const char *buffer, size_t len)
>>> +{
>>> +    int ret;
>>> +    struct xen_pmu_params xp;
>>> +    int i;
>>> +
>>> +    for (i = 0; i < ARRAY_SIZE(pmu_modes); i++) {
>>> +        if (strncmp(buffer, pmu_modes[i].name,
>>> +                strlen(pmu_modes[i].name)) == 0) {
>>> +            xp.val = pmu_modes[i].mode;
>>> +            break;
>>> +        }
>>> +    }
>> This looks like it would accept "office" as "off" (etc) which I don't
>> think it is what we want.  I assume the intention is to allow either
>> "off\n" or "off"?
> 
> Yes, I should make this check more precise.

There's an existing strim() helper that might be useful.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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