Skip to content

block: Strip protocol prefixes from filenames

Max Reitz qemu-devel 2 versions – Applied

Status from this message: Thanks, applied to my block tree:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 2 repliesApplied
  2. v15 patches 8 repliesSuperseded

Changes in v2 from the cover letter

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

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/5block/raw-posix: bdrv_parse_filename() for hdevblock/raw-posix.c+10 -00 replies
2/5block/raw-posix: bdrv_parse_filename() for floppyblock/raw-posix.c+10 -00 replies
3/5block/raw-posix: bdrv_parse_filename() for cdromblock/raw-posix.c+15 -01 reply
4/5block/raw-posix: Strip protocol prefix on creationblock/raw-posix.c+12 -00 replies
5/5block/raw-win32: bdrv_parse_filename() for hdevblock/raw-win32.c+10 -00 replies

Reviews trailers per patch

All 5 patches have a Reviewed-by or Acked-by.

PatchBenoit Canet
1/5R-b
2/5R-b
3/5R-b
4/5R-b
5/5R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/5] block: Strip protocol prefixes from filenames

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(+)
Signature · 1 line
1.9.0