Re: [PATCH v3 01/12] conf: Add definitions for 'uid' and 'fid' PCI address attributes

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

 





在 2018/8/16 下午10:38, Andrea Bolognani 写道:
On Tue, 2018-08-07 at 17:10 +0800, Yi Min Zhao wrote:
+typedef struct _virZPCIDeviceAddress virZPCIDeviceAddress;
+typedef virZPCIDeviceAddress *virZPCIDeviceAddressPtr;
+struct _virZPCIDeviceAddress {
+    unsigned int zpci_fid;
+    unsigned int zpci_uid;
+    bool fid_assigned;
+    bool uid_assigned;
+};
A couple of questions about the approach here, one of which I have
mentioned already and one of which I probably haven't (my bad):

   * do you really need to have separate booleans tracking whether
     or not either id has been assigned? Wouldn't the same approach
     as virPCIDeviceAddressIsEmpty() work, eg. consider the address
     absent if both are zero and present otherwise?

   * especially if you don't need the additional booleans, would it
     be preferable to just add the two ids to the existing struct
     instead of declaring a new one that you'll have to allocate
     and make sure it's not NULL before accessing it? Again, I seem
     to remember Laine feeling somewhat strongly about the topic.

Cosmetic issues:
Sorry, forgot this comment.

   * uid should be listed before fid;
Sure.

   * the zpci_ prefix is unnecessary if you have a separate struct
     that contains "ZPCI" in the name. But see above :)

Let's see your response to another mail.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[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