[libvirt] [PATCHv8 04/17] util: Add interface to determine monitor path
John Ferlan
jferlan at redhat.com
Tue Nov 13 23:14:21 UTC 2018
On 11/12/18 8:31 AM, Wang Huaqiang wrote:
> Add interface for resctrl monitor to determine the path.
>
> Signed-off-by: Wang Huaqiang <huaqiang.wang at intel.com>
>
> Reviewed-by: John Ferlan <jferlan at redhat.com>
> ---
> src/libvirt_private.syms | 1 +
> src/util/virresctrl.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
> src/util/virresctrl.h | 5 ++++-
> 3 files changed, 60 insertions(+), 1 deletion(-)
>
[...]
> diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c
> index 463555c..aa062c3 100644
> --- a/src/util/virresctrl.c
> +++ b/src/util/virresctrl.c
[...]
> +int
> +virResctrlMonitorDeterminePath(virResctrlMonitorPtr monitor,
> + const char *machinename)
> +{
> + VIR_AUTOFREE(char *) parentpath = NULL;
> +
> + if (!monitor) {
> + virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> + _("Invalid resctrl monitor"));
> + return -1;
> + }
In the v7 in a follow-up to patch 4 we agreed the following check was fine:
if (!monitor->alloc) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Missing resctrl monitor alloc"));
return -1;
}
> +
> + if (monitor->path) {
> + virReportError(VIR_ERR_INTERNAL_ERROR,
> + _("Resctrl monitor path is already set to '%s'"),
> + monitor->path);
> + return -1;
> + }
> +
> + if (monitor->id && monitor->alloc && monitor->alloc->id) {
> + if (STREQ(monitor->id, monitor->alloc->id)) {
> + if (VIR_STRDUP(monitor->path, monitor->alloc->path) < 0)
> + return -1;
> + return 0;
> + }
> + }
Changing the above to
if (STREQ_NULLABLE(monitor->id, monitor->alloc->id)) {
if (VIR_STRDUP(monitor->path, monitor->alloc->path) < 0)
return -1;
return 0;
With that,
Reviewed-by: John Ferlan <jferlan at redhat.com>
John
[...]
More information about the libvir-list
mailing list