* vircgroupmock.c:462:22: error: static variable 'fakesysfsdir' is used in an inline function with external linkage [-Werror,-Wstatic-in-inline]
*/
char *fakerootdir;
-char *fakesysfspcidir;
# define SYSFS_PCI_PREFIX "/sys/bus/pci/"
int fd = -1;
VIR_AUTOFREE(char *) newpath = NULL;
- if (virAsprintfQuiet(&newpath, "%s/%s",
- fakesysfspcidir,
- path + strlen(SYSFS_PCI_PREFIX)) < 0) {
+ if (virAsprintfQuiet(&newpath, "%s/%s", fakerootdir, path) < 0) {
errno = ENOMEM;
goto cleanup;
}
init_env();
if (STRPREFIX(path, SYSFS_PCI_PREFIX)) {
- if (virAsprintfQuiet(newpath, "%s/%s",
- fakesysfspcidir,
+ if (virAsprintfQuiet(newpath, "%s/sys/bus/pci/%s",
+ fakerootdir,
path + strlen(SYSFS_PCI_PREFIX)) < 0) {
errno = ENOMEM;
return -1;
if (VIR_ALLOC_QUIET(dev) < 0 ||
virAsprintfQuiet(&configSrc, "%s/virpcitestdata/%s.config",
abs_srcdir, id) < 0 ||
- virAsprintfQuiet(&devpath, "%s/devices/%s", fakesysfspcidir, data->id) < 0)
+ virAsprintfQuiet(&devpath, "%s/sys/bus/pci/devices/%s", fakerootdir, data->id) < 0)
ABORT_OOM();
memcpy(dev, data, sizeof(*dev));
if (VIR_ALLOC_QUIET(driver) < 0 ||
VIR_STRDUP_QUIET(driver->name, name) < 0 ||
- virAsprintfQuiet(&driverpath, "%s/drivers/%s", fakesysfspcidir, name) < 0)
+ virAsprintfQuiet(&driverpath, "%s/sys/bus/pci/drivers/%s", fakerootdir, name) < 0)
ABORT_OOM();
driver->fail = fail;
}
/* Make symlink under device tree */
- if (virAsprintfQuiet(&devpath, "%s/devices/%s/driver",
- fakesysfspcidir, dev->id) < 0 ||
- virAsprintfQuiet(&driverpath, "%s/drivers/%s",
- fakesysfspcidir, driver->name) < 0) {
+ if (virAsprintfQuiet(&devpath, "%s/sys/bus/pci/devices/%s/driver",
+ fakerootdir, dev->id) < 0 ||
+ virAsprintfQuiet(&driverpath, "%s/sys/bus/pci/drivers/%s",
+ fakerootdir, driver->name) < 0) {
errno = ENOMEM;
return -1;
}
/* Make symlink under driver tree */
VIR_FREE(devpath);
VIR_FREE(driverpath);
- if (virAsprintfQuiet(&devpath, "%s/devices/%s",
- fakesysfspcidir, dev->id) < 0 ||
- virAsprintfQuiet(&driverpath, "%s/drivers/%s/%s",
- fakesysfspcidir, driver->name, dev->id) < 0) {
+ if (virAsprintfQuiet(&devpath, "%s/sys/bus/pci/devices/%s",
+ fakerootdir, dev->id) < 0 ||
+ virAsprintfQuiet(&driverpath, "%s/sys/bus/pci/drivers/%s/%s",
+ fakerootdir, driver->name, dev->id) < 0) {
errno = ENOMEM;
return -1;
}
}
/* Make symlink under device tree */
- if (virAsprintfQuiet(&devpath, "%s/devices/%s/driver",
- fakesysfspcidir, dev->id) < 0 ||
- virAsprintfQuiet(&driverpath, "%s/drivers/%s/%s",
- fakesysfspcidir, driver->name, dev->id) < 0) {
+ if (virAsprintfQuiet(&devpath, "%s/sys/bus/pci/devices/%s/driver",
+ fakerootdir, dev->id) < 0 ||
+ virAsprintfQuiet(&driverpath, "%s/sys/bus/pci/drivers/%s/%s",
+ fakerootdir, driver->name, dev->id) < 0) {
errno = ENOMEM;
return -1;
}
static void
init_env(void)
{
- if (fakerootdir && fakesysfspcidir)
+ VIR_AUTOFREE(char *) fakesysfspcidir = NULL;
+
+ if (fakerootdir)
return;
if (!(fakerootdir = getenv("LIBVIRT_FAKE_ROOT_DIR")))