On 01/19/2015 12:15 PM, Paolo Bonzini wrote:


On 13/01/2015 04:34, John Snow wrote:
+tests/ahci-test$(EXESUF): tests/ahci-test.o $(libqos-pc-obj-y) \
+                          tests/libqos/ahci.o

Why not add this to libqos-pc-obj-y or libqos-obj-y?


No strong reason, it's just that I am the only user at the moment. I can start sharing it with the other qtests.


+ * Allocate space in the guest using information in the AHCIQState object.
+ */
+uint64_t ahci_alloc(AHCIQState *ahci, size_t bytes)
+{
+    g_assert(ahci);
+    g_assert(ahci->parent);
+    return qmalloc(ahci->parent, bytes);

No need to assert if you'd get a subsequent NULL pointer access.


As in, "If you segfault, then you won't need an assertion" ?
I think I like the "assertion failed" message a little better than a mystery SIGSEGV.

Unless I am misinterpreting you.

+}
+
+void ahci_free(AHCIQState *ahci, uint64_t addr)
+{
+    g_assert(ahci);
+    g_assert(ahci->parent);
+    qfree(ahci->parent, addr);
+}

Same here.

+    g_assert(ahci->hba_base != 0);

Comparing void * to NULL.  Not a problem since I think hba_base should
become an uint32_t anyway.

Paolo


Or uint64_t?

Thanks,
--js

Reply via email to