block: Remove bdrv_parse_cache_flags()
All users are converted to bdrv_parse_cache_mode() now. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
19dbecdcee
commit
53e8ae0100
29
block.c
29
block.c
@ -645,21 +645,23 @@ int bdrv_parse_discard_flags(const char *mode, int *flags)
|
|||||||
*
|
*
|
||||||
* Return 0 on success, -1 if the cache mode was invalid.
|
* Return 0 on success, -1 if the cache mode was invalid.
|
||||||
*/
|
*/
|
||||||
int bdrv_parse_cache_flags(const char *mode, int *flags)
|
int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough)
|
||||||
{
|
{
|
||||||
*flags &= ~BDRV_O_CACHE_MASK;
|
*flags &= ~BDRV_O_CACHE_MASK;
|
||||||
|
|
||||||
if (!strcmp(mode, "off") || !strcmp(mode, "none")) {
|
if (!strcmp(mode, "off") || !strcmp(mode, "none")) {
|
||||||
*flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB;
|
*writethrough = false;
|
||||||
|
*flags |= BDRV_O_NOCACHE;
|
||||||
} else if (!strcmp(mode, "directsync")) {
|
} else if (!strcmp(mode, "directsync")) {
|
||||||
|
*writethrough = true;
|
||||||
*flags |= BDRV_O_NOCACHE;
|
*flags |= BDRV_O_NOCACHE;
|
||||||
} else if (!strcmp(mode, "writeback")) {
|
} else if (!strcmp(mode, "writeback")) {
|
||||||
*flags |= BDRV_O_CACHE_WB;
|
*writethrough = false;
|
||||||
} else if (!strcmp(mode, "unsafe")) {
|
} else if (!strcmp(mode, "unsafe")) {
|
||||||
*flags |= BDRV_O_CACHE_WB;
|
*writethrough = false;
|
||||||
*flags |= BDRV_O_NO_FLUSH;
|
*flags |= BDRV_O_NO_FLUSH;
|
||||||
} else if (!strcmp(mode, "writethrough")) {
|
} else if (!strcmp(mode, "writethrough")) {
|
||||||
/* this is the default */
|
*writethrough = true;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -667,23 +669,6 @@ int bdrv_parse_cache_flags(const char *mode, int *flags)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough)
|
|
||||||
{
|
|
||||||
int ret = bdrv_parse_cache_flags(mode, flags);
|
|
||||||
if (ret < 0) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*flags & BDRV_O_CACHE_WB) {
|
|
||||||
*flags &= ~BDRV_O_CACHE_WB;
|
|
||||||
*writethrough = false;
|
|
||||||
} else {
|
|
||||||
*writethrough = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the options and flags that a temporary snapshot should get, based on
|
* Returns the options and flags that a temporary snapshot should get, based on
|
||||||
* the originally requested flags (the originally requested image will have
|
* the originally requested flags (the originally requested image will have
|
||||||
|
@ -208,7 +208,6 @@ void bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top);
|
|||||||
void bdrv_replace_in_backing_chain(BlockDriverState *old,
|
void bdrv_replace_in_backing_chain(BlockDriverState *old,
|
||||||
BlockDriverState *new);
|
BlockDriverState *new);
|
||||||
|
|
||||||
int bdrv_parse_cache_flags(const char *mode, int *flags);
|
|
||||||
int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough);
|
int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough);
|
||||||
int bdrv_parse_discard_flags(const char *mode, int *flags);
|
int bdrv_parse_discard_flags(const char *mode, int *flags);
|
||||||
BdrvChild *bdrv_open_child(const char *filename,
|
BdrvChild *bdrv_open_child(const char *filename,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user