qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V14 07/10] libqblock: libqblock API design and t


From: Wenchao Xia
Subject: Re: [Qemu-devel] [PATCH V14 07/10] libqblock: libqblock API design and type defines
Date: Thu, 24 Jan 2013 09:46:51 +0800
User-agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130107 Thunderbird/17.0.2

于 2013-1-24 2:04, Eric Blake 写道:
On 01/23/2013 04:18 AM, Wenchao Xia wrote:
   Public API design header files: libqblock.h, libqblock-error.h.
Public type define header files: libqblock-types.h. Private internal used
header files: libqblock-internal. For ABI some reserved bytes are used in
structure defines.

Important APIs:
   1 QBlockContext. This structure was used to retrieve errors, every thread
must create one first.
   2 QBlockImage. It stands for an block image object.
   3 QBlockStaticInfo. It contains static information such as location, backing
file, size.
   4 Sync I/O. It is similar to C file open, read, write and close operations.

Signed-off-by: Wenchao Xia <address@hidden>
---

+++ b/libqblock/libqblock-error.h
@@ -0,0 +1,49 @@
+/*
+ * QEMU block layer library
+ *
+ * Copyright IBM, Corp. 2012

2012-2013 now, for all new files in this series.

  OK.

+++ b/libqblock/libqblock-types.h

+#if defined(__GNUC__) && __GNUC__ >= 4
+    #ifdef LIBQB_BUILD
+        #define DLL_PUBLIC __attribute__((visibility("default")))
+    #else

s/visibility/__visibility__/, to avoid namespace pollution issues.  As
it is, the macro name DLL_PUBLIC is not namespace-safe, and you are
making it harder to use your header as part of a larger project that
might also want to use the name DLL_PUBLIC but for some other purpose.

  OK, I will use LIBQB_DLL_PUBLIC instead.

+/**
+ * struct QBlockLocationInfo: contains information about how to find the image
+ *
+ * @prot_type: protocol type, now only support FILE.
+ * @o_file: file protocol related attributes.
+ * @reserved: reserved bytes for ABI.
+ */
+#define QBLOCK_PROT_OPTIONS_UNION_SIZE (512)
+typedef struct QBlockLocationInfo {
+    QBlockProtocol prot_type;
+    union {
+        QBlockProtocolOptionsFile o_file;
+        uint64_t reserved[QBLOCK_PROT_OPTIONS_UNION_SIZE/8];

Magic number 8.  It would be better to use
[QBLOCK_PROG_OPTIONS_UNION_SIZE/sizeof(uint64_t)].

+
+/* whether compact to vmdk verion 6 */

s/verion/version/



--
Best Regards

Wenchao Xia




reply via email to

[Prev in Thread] Current Thread [Next in Thread]