[libvirt] [PATCH v6 04/11] Helper functions for host TPM support

Stefan Berger stefanb at linux.vnet.ibm.com
Fri Apr 12 20:34:04 UTC 2013


On 04/12/2013 03:40 PM, Eric Blake wrote:
> On 04/12/2013 12:47 PM, Stefan Berger wrote:
>> After a further simplification the patch now looks like this:
>>
>>
>> Implement helper function to create the TPM's sysfs cancel file.
>>
>> Signed-off-by: Stefan Berger <stefanb at linux.vnet.ibm.com>
>> Reviewed-by: Corey Bryant <coreyb at linux.vnet.ibm.com>
>> Tested-by: Corey Bryant <coreyb at linux.vnet.ibm.com>
>>
>> ---
>> +char *
>> +virTPMCreateCancelPath(const char *devpath)
>> +{
>> +    char *path = NULL;
>> +    const char *dev;
>> +
>> +    if (devpath) {
>> +        dev = strrchr(devpath, '/');
>> +        if (dev) {
>> +            dev++;
>> +            if (virAsprintf(&path, "/sys/class/misc/%s/device/cancel",
>> +                            dev) < 0) {
> Do we need to worry about systems that don't mount sysfs at /sys?  But
> if there is someone in such a situation, they can provide a patch for
> further configuration tuning.

Right...

>
>> +                virReportOOMError();
>> +                goto cleanup;
>> +            }
>> +        } else {
>> +            virReportError(VIR_ERR_INTERNAL_ERROR,
>> +                           _("TPM device path %s is invalid"), devpath);
>> +        }
>> +    } else {
>> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>> +                       _("Missing TPM device path"));
>> +    }
>> +
>> +cleanup:
>> +    return path;
>> +}
> Looks okay to me.
>
Sounds like an ACK...




More information about the libvir-list mailing list