提交 f2f656d4 编写于 作者: D Dave Allan 提交者: Daniel Veillard

Removing devicePath member from dev struct

I realized that I inadvertently added a member to the def struct to
contain each device's sysfs path when there was an existing member in the
dev struct for "OS specific path to device metadat, eg sysfs"  Since the
udev backend needs to record the sysfs path while it's in the process of
creating the device, before the dev struct gets allocated, I chose to
remove the member from the dev struct.

* src/conf/node_device_conf.c src/conf/node_device_conf.h
  src/node_device/node_device_driver.c src/node_device/node_device_hal.c
  src/node_device/node_device_udev.c: remove devicePath from the
  structure and use def->sysfs_path instead
上级 0fe55374
......@@ -156,7 +156,6 @@ void virNodeDeviceObjFree(virNodeDeviceObjPtr dev)
if (!dev)
return;
VIR_FREE(dev->devicePath);
virNodeDeviceDefFree(dev->def);
if (dev->privateFree)
(*dev->privateFree)(dev->privateData);
......
......@@ -178,7 +178,6 @@ typedef virNodeDeviceObj *virNodeDeviceObjPtr;
struct _virNodeDeviceObj {
virMutex lock;
char *devicePath; /* OS specific path to device metadat, eg sysfs */
virNodeDeviceDefPtr def; /* device definition */
void *privateData; /* driver-specific private data */
void (*privateFree)(void *data); /* destructor for private data */
......
......@@ -85,7 +85,7 @@ static int update_driver_name(virConnectPtr conn,
VIR_FREE(dev->def->driver);
if (virAsprintf(&driver_link, "%s/driver", dev->devicePath) < 0) {
if (virAsprintf(&driver_link, "%s/driver", dev->def->sysfs_path) < 0) {
virReportOOMError(conn);
goto cleanup;
}
......
......@@ -470,7 +470,7 @@ static void dev_create(const char *udi)
dev->privateData = privData;
dev->privateFree = free_udi;
dev->devicePath = devicePath;
dev->def->sysfs_path = devicePath;
virNodeDeviceObjUnlock(dev);
......
......@@ -1230,13 +1230,6 @@ static int udevAddOneDevice(struct udev_device *device)
goto out;
}
dev->devicePath = strdup(udev_device_get_devpath(device));
if (dev->devicePath == NULL) {
virReportOOMError(NULL);
virNodeDeviceObjRemove(&driverState->devs, dev);
goto out;
}
virNodeDeviceObjUnlock(dev);
ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册