diff mbox series

[4/7] copy-on-read: Support refreshing filename

Message ID 1587407806-109784-5-git-send-email-andrey.shinkevich@virtuozzo.com (mailing list archive)
State New, archived
Headers show
Series Apply COR-filter to the block-stream permanently | expand

Commit Message

Andrey Shinkevich April 20, 2020, 6:36 p.m. UTC
Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
---
 block/copy-on-read.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Vladimir Sementsov-Ogievskiy April 21, 2020, 12:36 p.m. UTC | #1
Some information about why we need it would be nice.

Still I see same function in commit.c, so most probably it's OK.


20.04.2020 21:36, Andrey Shinkevich wrote:
> Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
> ---
>   block/copy-on-read.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/block/copy-on-read.c b/block/copy-on-read.c
> index ad6577d..e45eab9 100644
> --- a/block/copy-on-read.c
> +++ b/block/copy-on-read.c
> @@ -21,6 +21,7 @@
>    */
>   
>   #include "qemu/osdep.h"
> +#include "qemu/cutils.h"
>   #include "block/block_int.h"
>   #include "qemu/module.h"
>   
> @@ -141,6 +142,11 @@ static bool cor_recurse_is_first_non_filter(BlockDriverState *bs,
>       return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate);
>   }
>   
> +static void cor_refresh_filename(BlockDriverState *bs)
> +{
> +    pstrcpy(bs->exact_filename, sizeof(bs->exact_filename),
> +            bs->file->bs->filename);
> +}
>   
>   static BlockDriver bdrv_copy_on_read = {
>       .format_name                        = "copy-on-read",
> @@ -161,6 +167,7 @@ static BlockDriver bdrv_copy_on_read = {
>       .bdrv_lock_medium                   = cor_lock_medium,
>   
>       .bdrv_recurse_is_first_non_filter   = cor_recurse_is_first_non_filter,
> +    .bdrv_refresh_filename              = cor_refresh_filename,
>   
>       .has_variable_length                = true,
>       .is_filter                          = true,
>
diff mbox series

Patch

diff --git a/block/copy-on-read.c b/block/copy-on-read.c
index ad6577d..e45eab9 100644
--- a/block/copy-on-read.c
+++ b/block/copy-on-read.c
@@ -21,6 +21,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/cutils.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
 
@@ -141,6 +142,11 @@  static bool cor_recurse_is_first_non_filter(BlockDriverState *bs,
     return bdrv_recurse_is_first_non_filter(bs->file->bs, candidate);
 }
 
+static void cor_refresh_filename(BlockDriverState *bs)
+{
+    pstrcpy(bs->exact_filename, sizeof(bs->exact_filename),
+            bs->file->bs->filename);
+}
 
 static BlockDriver bdrv_copy_on_read = {
     .format_name                        = "copy-on-read",
@@ -161,6 +167,7 @@  static BlockDriver bdrv_copy_on_read = {
     .bdrv_lock_medium                   = cor_lock_medium,
 
     .bdrv_recurse_is_first_non_filter   = cor_recurse_is_first_non_filter,
+    .bdrv_refresh_filename              = cor_refresh_filename,
 
     .has_variable_length                = true,
     .is_filter                          = true,