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@xxxxxxxxxxxxxxxxxx> > Reviewed-by: Corey Bryant <coreyb@xxxxxxxxxxxxxxxxxx> > Tested-by: Corey Bryant <coreyb@xxxxxxxxxxxxxxxxxx> > > --- > +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. > + 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. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list