Re: [PATCH 3/3] nodedev: reset active config data on udev remove event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/21/24 16:28, Jonathon Jongsma wrote:
+void
+nodeDeviceDefResetMdevActiveConfig(virNodeDeviceDef *def)
+{
+    size_t i = 0;
+    virMediatedDeviceConfig *active_config;
+
+    if (def->caps->data.type != VIR_NODE_DEV_CAP_MDEV)
+        return;
+
+    active_config = &def->caps->data.mdev.active_config;
+
+    g_clear_pointer(&active_config->type, g_free);
+    for (i = 0; i < active_config->nattributes; i++)
+        virMediatedDeviceAttrFree(active_config->attributes[i]);
+    g_clear_pointer(&active_config->attributes, g_free);
+    active_config->nattributes = 0;
+}
+
+

A good portion of this function is duplicating code that exists in virNodeDevCapsDefFree(). Let's just factor that code out into a virMediatedDeviceConfigClear() function and then use it from both locations.

OK, will do.

--
Mit freundlichen Grüßen/Kind regards
   Boris Fiuczynski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux