As some kind of follow-up to the "block: Strip 'file:' prefix from
filenames" series, this series does the same thing for other protocol
drivers.

All protocol drivers which implement bdrv_probe() may rely on them being
selected based on that function returning success alone. However, they
may have been chosen through a protocol prefix as well. Thus, if they
currently do not implement bdrv_parse_filename(), they may be unaware of
that possible prefix and therefore fail to interpret such filenames
(and, in fact, all of those are unaware).

This series makes these drivers strip their respective prefix through
bdrv_parse_filename() and in bdrv_create(), if implemented.

The following protocol drivers are not touched by this series since they
already implement bdrv_parse_filename() and are thus very likely aware
of the prefix:
 - vvfat, nbd, blkdebug, blkverify, ssh, curl

The following protocol drivers are not touched by this series since they
do not implement bdrv_probe() and therefore always receive a prefixed
filename (unless they are selected through QMP options) which makes them
pretty much guaranteed to handle these prefixes correctly:
 - nfs, sheepdog, rbd, quorum, gluster, iscsi

Thus, only drivers implementing bdrv_probe() and not implementing
bdrv_parse_filename() have been touched.


Please note that this series does not strip the prefix in bdrv_probe().
This is due to the driver being selected anyway later on through the
protocol prefix, even though bdrv_probe() returned 0. More importantly,
according to a comment in bdrv_find_protocol() in block.c about why
bdrv_probe() occurs before the protocol prefix is interpreted, it seems
actually more desirable not to strip the prefix in bdrv_probe() (since
it may in fact not be a prefix but rather some obscure device naming
schema).


v2:
 - Patch 3: Use a common cdrom_parse_filename() for both Linux and
            FreeBSD [Benoît]
 - Patch 4: Fixed commit message [Eric]



Key:
[----] : patches are identical
[####] : number of functional differences between upstream/downstream patch
[down] : patch is downstream-only
The flags [FC] indicate (F)unctional and (C)ontextual differences, respectively

001/5:[----] [--] 'block/raw-posix: bdrv_parse_filename() for hdev'
002/5:[----] [--] 'block/raw-posix: bdrv_parse_filename() for floppy'
003/5:[0013] [FC] 'block/raw-posix: bdrv_parse_filename() for cdrom'
004/5:[----] [--] 'block/raw-posix: Strip protocol prefix on creation'
005/5:[----] [--] 'block/raw-win32: bdrv_parse_filename() for hdev'



Max Reitz (5):
  block/raw-posix: bdrv_parse_filename() for hdev
  block/raw-posix: bdrv_parse_filename() for floppy
  block/raw-posix: bdrv_parse_filename() for cdrom
  block/raw-posix: Strip protocol prefix on creation
  block/raw-win32: bdrv_parse_filename() for hdev

 block/raw-posix.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 block/raw-win32.c | 10 ++++++++++
 2 files changed, 57 insertions(+)

-- 
1.9.0


Reply via email to