qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Modify qemu-img can not create local filename c


From: jun muzi
Subject: Re: [Qemu-devel] [PATCH] Modify qemu-img can not create local filename contain ":"
Date: Wed, 5 Mar 2014 23:33:43 +0800

>> Currently, a protocol prefix is only defined to end with a colon, not
>> with ":/" or "://". There are already protocol block drivers which do
>> not require a slash after the colon such as blkdebug or blkverify and I
> >deem it rather impossible to redefine their filename format now (in
>> order to make them use ":/").

>It should ALWAYS be possible to open a file via absolute path, or via
>'./file:with:colon'.  That is, our check for a protocol should be any
>prefix that contains a ':' prior to a '/'.

Yes, check in the code,
static int path_has_protocol(const char *path)
{
    ...
    p = path + strcspn(path, ":/");
    ...
}
strcspn() function will return the anterior location of ":" or "/" in the path. When the filename contains ':' via absolute path(eg: /home/file:with:colon) or relative path(eg:./file:with:colon), the strcspn() function will return the location of "/", then the path_has_protocol() function will return 0.
Based on above discussion, when create image via :
# qemu-img create -f qcow2 ip-192.168.254.185\:asdf 5G
let qemu give more error information except "qemu-img: Unknown protocol 'ip-192.168.254.185:asdf'". Such as:
qemu-img: Unknown protocol 'ip-192.168.254.185:asdf'
Or using absolute path or relative path to create locale file.
---------
This maybe the most simple method to fixed this issue. thx.

Jun Li

reply via email to

[Prev in Thread] Current Thread [Next in Thread]