diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-06-04 09:26:49 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-06-04 09:26:49 -0500 |
commit | a3416197447e7846a927b6ccb4f1edb3a1982443 (patch) | |
tree | 5bc8954542b3dc382bfe5737636007b5bb6aa28e /include | |
parent | e47dccc64b6ca570e4db96fd5fdb3bef251eb559 (diff) | |
parent | 5b91704469c0f801e0219f26458356872c4145ab (diff) | |
download | qemu-a3416197447e7846a927b6ccb4f1edb3a1982443.zip qemu-a3416197447e7846a927b6ccb4f1edb3a1982443.tar.gz qemu-a3416197447e7846a927b6ccb4f1edb3a1982443.tar.bz2 |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
# By Stefan Hajnoczi (6) and others
# Via Kevin Wolf
* kwolf/for-anthony:
block: dump snapshot and image info to specified output
block: move qmp and info dump related code to block/qapi.c
block: move snapshot code in block.c to block/snapshot.c
block: drop bs_snapshots global variable
qemu-iotests: make create_image() common
qemu-iotests: make compare_images() common
qemu-iotests: make cancel_and_wait() common
qemu-iotests: make assert_no_active_block_jobs() common
block: add block driver read only whitelist
qemu-iotests: fix 054 cluster size help output
Message-id: 1370349940-4703-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/block/block.h | 31 | ||||
-rw-r--r-- | include/block/block_int.h | 1 | ||||
-rw-r--r-- | include/block/qapi.h | 43 | ||||
-rw-r--r-- | include/block/snapshot.h | 53 |
4 files changed, 100 insertions, 28 deletions
diff --git a/include/block/block.h b/include/block/block.h index 1251c5c..dc5b388 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -27,17 +27,6 @@ typedef struct BlockFragInfo { uint64_t compressed_clusters; } BlockFragInfo; -typedef struct QEMUSnapshotInfo { - char id_str[128]; /* unique snapshot id */ - /* the following fields are informative. They are not needed for - the consistency of the snapshot */ - char name[256]; /* user chosen name */ - uint64_t vm_state_size; /* VM state info size */ - uint32_t date_sec; /* UTC date of the snapshot */ - uint32_t date_nsec; - uint64_t vm_clock_nsec; /* VM clock relative to boot */ -} QEMUSnapshotInfo; - /* Callbacks for block device models */ typedef struct BlockDevOps { /* @@ -124,7 +113,8 @@ void bdrv_init(void); void bdrv_init_with_whitelist(void); BlockDriver *bdrv_find_protocol(const char *filename); BlockDriver *bdrv_find_format(const char *format_name); -BlockDriver *bdrv_find_whitelisted_format(const char *format_name); +BlockDriver *bdrv_find_whitelisted_format(const char *format_name, + bool readonly); int bdrv_create(BlockDriver *drv, const char* filename, QEMUOptionParameter *options); int bdrv_create_file(const char* filename, QEMUOptionParameter *options); @@ -328,23 +318,8 @@ void bdrv_get_backing_filename(BlockDriverState *bs, char *filename, int filename_size); void bdrv_get_full_backing_filename(BlockDriverState *bs, char *dest, size_t sz); -BlockInfo *bdrv_query_info(BlockDriverState *s); -BlockStats *bdrv_query_stats(const BlockDriverState *bs); -int bdrv_can_snapshot(BlockDriverState *bs); int bdrv_is_snapshot(BlockDriverState *bs); -BlockDriverState *bdrv_snapshots(void); -int bdrv_snapshot_create(BlockDriverState *bs, - QEMUSnapshotInfo *sn_info); -int bdrv_snapshot_goto(BlockDriverState *bs, - const char *snapshot_id); -int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id); -int bdrv_snapshot_list(BlockDriverState *bs, - QEMUSnapshotInfo **psn_info); -int bdrv_snapshot_load_tmp(BlockDriverState *bs, - const char *snapshot_name); -char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn); - -char *get_human_readable_size(char *buf, int buf_size, int64_t size); + int path_is_absolute(const char *path); void path_combine(char *dest, int dest_size, const char *base_path, diff --git a/include/block/block_int.h b/include/block/block_int.h index 6078dd3..ba52247 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -33,6 +33,7 @@ #include "qapi/qmp/qerror.h" #include "monitor/monitor.h" #include "qemu/hbitmap.h" +#include "block/snapshot.h" #define BLOCK_FLAG_ENCRYPT 1 #define BLOCK_FLAG_COMPAT6 4 diff --git a/include/block/qapi.h b/include/block/qapi.h new file mode 100644 index 0000000..e6e568d --- /dev/null +++ b/include/block/qapi.h @@ -0,0 +1,43 @@ +/* + * Block layer qmp and info dump related functions + * + * Copyright (c) 2003-2008 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef BLOCK_QAPI_H +#define BLOCK_QAPI_H + +#include "qapi-types.h" +#include "block/block.h" +#include "block/snapshot.h" + +void bdrv_collect_snapshots(BlockDriverState *bs , ImageInfo *info); +void bdrv_collect_image_info(BlockDriverState *bs, + ImageInfo *info, + const char *filename); +BlockInfo *bdrv_query_info(BlockDriverState *s); +BlockStats *bdrv_query_stats(const BlockDriverState *bs); + +void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f, + QEMUSnapshotInfo *sn); +void bdrv_image_info_dump(fprintf_function func_fprintf, void *f, + ImageInfo *info); +#endif diff --git a/include/block/snapshot.h b/include/block/snapshot.h new file mode 100644 index 0000000..eaf61f0 --- /dev/null +++ b/include/block/snapshot.h @@ -0,0 +1,53 @@ +/* + * Block layer snapshot related functions + * + * Copyright (c) 2003-2008 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef SNAPSHOT_H +#define SNAPSHOT_H + +#include "qemu-common.h" + +typedef struct QEMUSnapshotInfo { + char id_str[128]; /* unique snapshot id */ + /* the following fields are informative. They are not needed for + the consistency of the snapshot */ + char name[256]; /* user chosen name */ + uint64_t vm_state_size; /* VM state info size */ + uint32_t date_sec; /* UTC date of the snapshot */ + uint32_t date_nsec; + uint64_t vm_clock_nsec; /* VM clock relative to boot */ +} QEMUSnapshotInfo; + +int bdrv_snapshot_find(BlockDriverState *bs, QEMUSnapshotInfo *sn_info, + const char *name); +int bdrv_can_snapshot(BlockDriverState *bs); +int bdrv_snapshot_create(BlockDriverState *bs, + QEMUSnapshotInfo *sn_info); +int bdrv_snapshot_goto(BlockDriverState *bs, + const char *snapshot_id); +int bdrv_snapshot_delete(BlockDriverState *bs, const char *snapshot_id); +int bdrv_snapshot_list(BlockDriverState *bs, + QEMUSnapshotInfo **psn_info); +int bdrv_snapshot_load_tmp(BlockDriverState *bs, + const char *snapshot_name); +#endif |