2 * QEMU backup related definitions
4 * Copyright (C) 2013 Proxmox Server Solutions
7 * Dietmar Maurer (dietmar@proxmox.com)
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
17 #include <uuid/uuid.h>
18 #include "block/block.h"
20 #define BACKUP_CLUSTER_BITS 16
21 #define BACKUP_CLUSTER_SIZE (1<<BACKUP_CLUSTER_BITS)
22 #define BACKUP_BLOCKS_PER_CLUSTER (BACKUP_CLUSTER_SIZE/BDRV_SECTOR_SIZE)
24 typedef int BackupDumpFunc(void *opaque
, BlockDriverState
*bs
,
25 int64_t cluster_num
, unsigned char *buf
);
27 void backup_job_start(BlockDriverState
*bs
, bool cancel
);
29 int backup_job_create(BlockDriverState
*bs
, BackupDumpFunc
*backup_dump_cb
,
30 BlockDriverCompletionFunc
*backup_complete_cb
,
31 void *opaque
, int64_t speed
);
33 typedef struct BackupDriver
{
35 void *(*open
)(const char *filename
, uuid_t uuid
, Error
**errp
);
36 int (*close
)(void *opaque
, Error
**errp
);
37 int (*register_config
)(void *opaque
, const char *name
, gpointer data
,
39 int (*register_stream
)(void *opaque
, const char *devname
, size_t size
);
40 int (*dump
)(void *opaque
, uint8_t dev_id
, int64_t cluster_num
,
41 unsigned char *buf
, size_t *zero_bytes
);
42 int (*complete
)(void *opaque
, uint8_t dev_id
, int ret
);
45 #endif /* QEMU_BACKUP_H */