From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzkDg-0007Vn-K4 for qemu-devel@nongnu.org; Fri, 10 Aug 2012 04:05:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SzkDa-0006yz-VJ for qemu-devel@nongnu.org; Fri, 10 Aug 2012 04:05:20 -0400 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:60454) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SzkDa-0006yR-AS for qemu-devel@nongnu.org; Fri, 10 Aug 2012 04:05:14 -0400 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 10 Aug 2012 13:35:08 +0530 Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q7A855P026279990 for ; Fri, 10 Aug 2012 13:35:05 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q7A855SN015117 for ; Fri, 10 Aug 2012 18:05:05 +1000 Message-ID: <5024C096.9040007@linux.vnet.ibm.com> Date: Fri, 10 Aug 2012 16:04:38 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1344507050-11054-1-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [qemu-devel] [PATCH V2 0/3] [RFC] libqblock draft code v2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: stefanha@gmail.com, aliguori@us.ibm.com, qemu-devel@nongnu.org, pbonzini@redhat.com Thanks for your review, sorry I have forgot some fixing you mentioned before, will correct them this time. 于 2012-8-10 1:12, Blue Swirl 写道: > On Thu, Aug 9, 2012 at 10:10 AM, Wenchao Xia wrote: >> This patch intrudce libqblock API, libqblock-test is used as a test case. >> >> V2: >> Using struct_size and [xxx]_new [xxx]_free to keep ABI. >> Using embbed structure to class format options in image creating. >> Format specific options were brought to surface. >> Image format was changed to enum interger instead of string. >> Some API were renamed. >> Internel error with errno was saved and with an API caller can get it. >> ALL flags used were defined in libqblock.h. >> >> Something need discuss: >> Embbed structure or union could make the model more friendly, but that >> make ABI more difficult, because we need to check every embbed structure's >> size and guess compiler's memory arrangement. This means #pragma pack(4) >> or struct_size, offset_next in every structure. Any better way to solve it? >> or make every structure a plain one? > > I'd still use accessor functions instead of structure passing, it > would avoid these problems. > Do you mean some function like : CreateOption_Filename_Set(const char *filename) CreateOption_Format_Set(const char *filename) It can solve the issue, with a cost of more small APIs in header files that user should use. Not sure if there is a good way to make it more friendly as an object language: "oc.filename = name;" automatically call CreateOption_Filename_Set, API CreateOption_Filename_Set is invisible to user. > Packing can even introduce a new set of problems since we don't > control the CFLAGS of the client of the library. indeed, I tried to handle the difference in function qboo_adjust_o2n, found that structure member alignment is hard to deal. >> AIO is missing, need a prototype. >> >> Wenchao Xia (3): >> adding libqblock >> libqblock API >> libqblock test case >> >> Makefile | 3 + >> block.c | 2 +- >> block.h | 1 + >> libqblock-test.c | 197 ++++++++++++++++ >> libqblock.c | 670 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> libqblock.h | 447 ++++++++++++++++++++++++++++++++++++ >> 6 files changed, 1319 insertions(+), 1 deletions(-) >> create mode 100644 libqblock-test.c >> create mode 100644 libqblock.c >> create mode 100644 libqblock.h >> >> >> > -- Best Regards Wenchao Xia