On 01/13/2015 09:18 AM, Chen Hanxiao wrote:
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/storage/storage_backend.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index b990a82..5ce3566 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -156,6 +156,32 @@ enum {
#define READ_BLOCK_SIZE_DEFAULT (1024 * 1024)
#define WRITE_BLOCK_SIZE_DEFAULT (4 * 1024)
+/*
+ * Perform the O(1) btrfs clone operation, if possible.
+ * Upon success, return 0. Otherwise, return -1 and set errno.
+ */
+#if !defined(BTRFS_IOCTL_MAGIC)
+# define BTRFS_IOCTL_MAGIC 0x94
+#endif
+
+#define BTRFS_IOC_CLONE _IOW (BTRFS_IOCTL_MAGIC, 9, int)
+
Instead of redefining the constants, can we check for btrfs.h at configure
time and wrap the function in #ifdef BTRFS_IOC_CLONE ?
Jan