From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57335) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDGQv-0005uv-5b for qemu-devel@nongnu.org; Mon, 19 Jan 2015 12:48:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YDGQp-00041x-1M for qemu-devel@nongnu.org; Mon, 19 Jan 2015 12:48:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45159) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YDGQo-0003za-Qm for qemu-devel@nongnu.org; Mon, 19 Jan 2015 12:48:06 -0500 Message-ID: <54BD4352.5000009@redhat.com> Date: Mon, 19 Jan 2015 12:48:02 -0500 From: John Snow MIME-Version: 1.0 References: <1421120079-987-1-git-send-email-jsnow@redhat.com> <1421120079-987-15-git-send-email-jsnow@redhat.com> <54BD3BB3.1020902@redhat.com> In-Reply-To: <54BD3BB3.1020902@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 14/14] libqos/ahci: create libqos/ahci.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: kwolf@redhat.com, marc.mari.barcelo@gmail.com, armbru@redhat.com, stefanha@redhat.com, mreitz@redhat.com 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