]> xenbits.xensource.com Git - libvirt.git/commitdiff
Removing devicePath member from dev struct
authorDave Allan <dallan@redhat.com>
Thu, 19 Nov 2009 15:02:18 +0000 (16:02 +0100)
committerDaniel Veillard <veillard@redhat.com>
Thu, 19 Nov 2009 15:02:18 +0000 (16:02 +0100)
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

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

index f55c9c76c3079b5bd5b1084c1738c5953d033bf3..f2faeec62cd92ccf24eee31b476759b8df754b50 100644 (file)
@@ -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);
index 639a7e7a705e91a9988811012ee4c500cf7bb52b..7a20bd67bbb5ee8c03a64a6c5a0726e963c1d3dc 100644 (file)
@@ -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 */
index b474d434e5e8cb66b118b101e915aabbd98e7a11..f083f168a2c4f351e265c7e1de87de73299831e3 100644 (file)
@@ -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;
     }
index 1e1d872cd24d68ee811e3f64702f92c6b51da0c3..31c17644841e7c467c2da92e8fa46a8f9358859e 100644 (file)
@@ -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);
 
index 4ddf360fe61818632f6ffac16951f0ea027cbc4a..9b48052929be4ec6c2952807e7b4da24dcd1b71d 100644 (file)
@@ -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;