Patchwork [V2,2/4] block: make path_hash_protocol public.

login
register
mail settings
Submitter Benoît Canet
Date Jan. 28, 2013, 5:04 p.m.
Message ID <1359392680-15838-3-git-send-email-benoit@irqsave.net>
Download mbox | patch
Permalink /patch/216284/
State New
Headers show

Comments

Benoît Canet - Jan. 28, 2013, 5:04 p.m.
Signed-off-by: Benoit Canet <benoit@irqsave.net>
---
 block.c               |    2 +-
 include/block/block.h |    1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
Eric Blake - Jan. 28, 2013, 5:56 p.m.
On 01/28/2013 10:04 AM, Benoît Canet wrote:
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  block.c               |    2 +-
>  include/block/block.h |    1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)

s/hash/has/ in the subject line.


>  /* check if the path starts with "<protocol>:" */
> -static int path_has_protocol(const char *path)
> +int path_has_protocol(const char *path)
>  {

While you are touching this function, does it make sense to change it to
return 'bool' instead of 'int'?
Benoît Canet - Jan. 29, 2013, 12:02 p.m.
> While you are touching this function, does it make sense to change it to
> return 'bool' instead of 'int'?
I think so.

Benoît
Kevin Wolf - Jan. 29, 2013, 12:12 p.m.
Am 28.01.2013 18:04, schrieb Benoît Canet:
> Signed-off-by: Benoit Canet <benoit@irqsave.net>
> ---
>  block.c               |    2 +-
>  include/block/block.h |    1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/block.c b/block.c
> index 41a9ac0..843583f 100644
> --- a/block.c
> +++ b/block.c
> @@ -195,7 +195,7 @@ static void bdrv_io_limits_intercept(BlockDriverState *bs,
>  }
>  
>  /* check if the path starts with "<protocol>:" */
> -static int path_has_protocol(const char *path)
> +int path_has_protocol(const char *path)

Please add a prefix when making the function public, like
bdrv_path_has_protocol().

Does it really need to be in block.h or would block_int.h suffice?

Kevin

Patch

diff --git a/block.c b/block.c
index 41a9ac0..843583f 100644
--- a/block.c
+++ b/block.c
@@ -195,7 +195,7 @@  static void bdrv_io_limits_intercept(BlockDriverState *bs,
 }
 
 /* check if the path starts with "<protocol>:" */
-static int path_has_protocol(const char *path)
+int path_has_protocol(const char *path)
 {
     const char *p;
 
diff --git a/include/block/block.h b/include/block/block.h
index 12470fc..b7be2d2 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -121,6 +121,7 @@  bool bdrv_io_limits_enabled(BlockDriverState *bs);
 void bdrv_init(void);
 void bdrv_init_with_whitelist(void);
 BlockDriver *bdrv_find_protocol(const char *filename);
+int path_has_protocol(const char *path);
 BlockDriver *bdrv_find_format(const char *format_name);
 BlockDriver *bdrv_find_whitelisted_format(const char *format_name);
 int bdrv_create(BlockDriver *drv, const char* filename,