[libvirt] [PATCH V3] util: Add more virsysfs functions for handling resctrl sysfs

Erik Skultety eskultet at redhat.com
Fri Mar 31 10:28:26 UTC 2017


>  #define VIR_SYSFS_VALUE_MAXLEN 8192
>  #define SYSFS_SYSTEM_PATH "/sys/devices/system"
> +#define SYSFS_RESCTRL_PATH "/sys/fs/resctrl"
>
>  static const char *sysfs_system_path = SYSFS_SYSTEM_PATH;
> +static const char *sysfs_resctrl_path = SYSFS_RESCTRL_PATH;
>
>
>  void virSysfsSetSystemPath(const char *path)
> @@ -55,6 +58,20 @@ virSysfsGetSystemPath(void)
>      return sysfs_system_path;
>  }
>
> +void virSysfsSetResctrlPath(const char *path)
> +{
> +    if (path)
> +        sysfs_resctrl_path  = path;
> +    else
> +        sysfs_resctrl_path = SYSFS_RESCTRL_PATH;
> +}
> +
> +const char *
> +virSysfsGetResctrlPath(void)
> +{
> +    return sysfs_resctrl_path;
> +}
> +

NACK

This leads to an unnecessary code duplication (applies for most of the
functions introduced by this patch). Instead, virsysfs should be made generic
enough so it could be reused by any module doing sysfs related tasks, like for
example the recently added mediated device framework (otherwise a new
sysfs_foo_path = "/sys/bus/mdev/devices/" would need to be created as well).

Erik




More information about the libvir-list mailing list