From 49780457810325f0fd40811bfda7f4ec391de7a7 Mon Sep 17 00:00:00 2001 From: aliguori Date: Thu, 5 Mar 2009 19:42:19 +0000 Subject: [PATCH] block: Introduce bdrv_get_encrypted_filename (Jan Kiszka) Introduce bdrv_get_encrypted_filename service to allow more informative password prompting. Signed-off-by: Jan Kiszka Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10_0@6696 c046a42c-6fe2-441c-8c8c-71466251a162 --- block.c | 10 ++++++++++ block.h | 1 + 2 files changed, 11 insertions(+) diff --git a/block.c b/block.c index 6bbc389ff0..e35c9a65aa 100644 --- a/block.c +++ b/block.c @@ -1134,6 +1134,16 @@ void bdrv_info_stats (void) } } +const char *bdrv_get_encrypted_filename(BlockDriverState *bs) +{ + if (bs->backing_hd && bs->backing_hd->encrypted) + return bs->backing_file; + else if (bs->encrypted) + return bs->filename; + else + return NULL; +} + void bdrv_get_backing_filename(BlockDriverState *bs, char *filename, int filename_size) { diff --git a/block.h b/block.h index aa26ef3982..a01fa31b0c 100644 --- a/block.h +++ b/block.h @@ -152,6 +152,7 @@ int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors); int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi); +const char *bdrv_get_encrypted_filename(BlockDriverState *bs); void bdrv_get_backing_filename(BlockDriverState *bs, char *filename, int filename_size); int bdrv_snapshot_create(BlockDriverState *bs, -- 2.11.4.GIT