From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKWxW-0006UA-8l for qemu-devel@nongnu.org; Mon, 03 Mar 2014 12:47:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKWxQ-0005ne-3q for qemu-devel@nongnu.org; Mon, 03 Mar 2014 12:47:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16327) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKWxP-0005n2-R8 for qemu-devel@nongnu.org; Mon, 03 Mar 2014 12:47:16 -0500 Message-ID: <5314C01B.2020301@redhat.com> Date: Mon, 03 Mar 2014 18:47:07 +0100 From: Max Reitz MIME-Version: 1.0 References: <1393855339-13878-1-git-send-email-junmuzi@gmail.com> In-Reply-To: <1393855339-13878-1-git-send-email-junmuzi@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] Modify qemu-img can not create local filename contain ":" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jun Li , qemu-devel@nongnu.org On 03.03.2014 15:02, Jun Li wrote: > Such as how to visit glusterfs: > file=3Dgluster://1.2.3.4/testvol/a.img > file=3Dgluster+tcp://1.2.3.4/testvol/a.img > file=3Dgluster+tcp://1.2.3.4:24007/testvol/dir/a.img > file=3Dgluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img > file=3Dgluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img > file=3Dgluster+tcp://server.domain.com:24007/testvol/dir/a.img > file=3Dgluster+rdma://1.2.3.4:24007/testvol/a.img > ---- > So if only the path contain "://", the path maybe contain a protocol. S= o use > strstr() to replace func strcspn(). > > Signed-off-by: Jun Li > --- > block.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > Currently, a protocol prefix is only defined to end with a colon, not=20 with ":/" or "://". There are already protocol block drivers which do=20 not require a slash after the colon such as blkdebug or blkverify and I=20 deem it rather impossible to redefine their filename format now (in=20 order to make them use ":/"). Thus, I do not think it will be this easy. I am in fact not even sure=20 whether it is possible at all (automagically doing the right thing) =96=20 currently, a colon simpy is the separator between protocol and filename.=20 Just using the "file" protocol per default for the whole filename if=20 there is no protocol with a name equal to the pre-colon part is probably=20 not what we want, since the user may actually be referring to some=20 protocol that the qemu version he/she is using does not support (yet),=20 in which case creating a file with a name including the pre-colon part=20 (the protocol name) is most probably not the right thing to do. Henceforth, in my opinion, we either have to ask the user in that case=20 or we introduce some new option which disables protocol prefixes. I=20 think the easiest way to do the latter is to introduce a=20 bdrv_parse_filename() function for the "file" protocol drivers which=20 remove a "file:" prefix if given. Then, the user could just specify=20 "file:foo:bar.img" to reference a file named "foo:bar.img". Currently, the behavior is that such a prefix will be interpreted=20 correctly (the "file" protocol is selected) but it is not removed. Thus,=20 "file:foo:bar.img" will actually reference a file named=20 "file:foo:bar.img". One could argue that removing the prefix therefore=20 breaks current behavior, but I sincerely hope nobody has relied on that=20 behavior so far. Max