δΊ 2012-9-3 22:20, Eric Blake ει:
On 09/03/2012 03:18 AM, Wenchao Xia wrote:
This patch contains public type and defines used in APIs.
Signed-off-by: Wenchao Xia <xiaw...@linux.vnet.ibm.com>
---
libqblock/libqblock-types.h | 228 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 228 insertions(+), 0 deletions(-)
create mode 100644 libqblock/libqblock-types.h
diff --git a/libqblock/libqblock-types.h b/libqblock/libqblock-types.h
new file mode 100644
index 0000000..3389bda
--- /dev/null
+++ b/libqblock/libqblock-types.h
@@ -0,0 +1,228 @@
+#ifndef LIBQBLOCK_TYPES_H
Missing a copyright header. Shame.
+#define LIBQBLOCK_TYPES_H
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdbool.h>
I see use of stdint (uint8_t) and stdbool (bool), but isn't
<sys/types.h> better than <stdio.h> and <stdlib.h> for size_t?
right, thanks.
+
+/**
+ * QBlockInfoImageStatic: information about the block image.
+ *
+ * @loc: location info.
+ * @fmt_type: format type.
+ * @virt_size: virtual size in bytes.
+ * @backing_loc: backing file location, its type is QB_PROT_NONE if not exist.
+ * @allocated_size: allocated size in bytes, negative if not available.
Reading this...
+ * @encrypt: encrypt flag.
+ */
+struct QBlockInfoImageStatic {
+ struct QBlockOptionLoc loc;
+ enum QBlockFormat fmt_type;
+ size_t virt_size;
+ /* advance info */
+ struct QBlockOptionLoc backing_loc;
+ size_t allocated_size;
...negative is not possible for size_t. Did you mean ssize_t?
you are right.
--
Best Regards
Wenchao Xia