Skip to content

Commit

Permalink
block/curl: Drop TFTP "support"
Browse files Browse the repository at this point in the history
Because TFTP does not support byte ranges, it was never usable with our
curl block driver. Since apparently nobody has ever complained loudly
enough for someone to take care of the issue until now, it seems
reasonable to assume that nobody has ever actually used it.

Therefore, it should be safe to just drop it from curl's protocol list.

[Jeff Cody: Below is additional summary pulled, with some rewording,
            from followup emails between Max and Markus, to explain what
            worked and what didn't]

TFTP would sometimes work, to a limited extent, for images <= the curl
"readahead" size, so long as reads started at offset zero.  By default,
that readahead size is 256KB.

Reads starting at a non-zero offset would also have returned data from a
zero offset.  It can become more complicated still, with mixed reads at
zero offset and non-zero offsets, due to data buffering.

In short, TFTP could only have worked before in very specific scenarios
with unrealistic expectations and constraints.

Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Kevin Wolf <[email protected]>
Reviewed-by: Jeff Cody <[email protected]>
Message-id: [email protected]
Signed-off-by: Jeff Cody <[email protected]>
  • Loading branch information
XanClic authored and codyprime committed Nov 15, 2016
1 parent 0a4c0c3 commit 23dce38
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 27 deletions.
20 changes: 1 addition & 19 deletions block/curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ static CURLMcode __curl_multi_socket_action(CURLM *multi_handle,
#endif

#define PROTOCOLS (CURLPROTO_HTTP | CURLPROTO_HTTPS | \
CURLPROTO_FTP | CURLPROTO_FTPS | \
CURLPROTO_TFTP)
CURLPROTO_FTP | CURLPROTO_FTPS)

#define CURL_NUM_STATES 8
#define CURL_NUM_ACB 8
Expand Down Expand Up @@ -886,29 +885,12 @@ static BlockDriver bdrv_ftps = {
.bdrv_attach_aio_context = curl_attach_aio_context,
};

static BlockDriver bdrv_tftp = {
.format_name = "tftp",
.protocol_name = "tftp",

.instance_size = sizeof(BDRVCURLState),
.bdrv_parse_filename = curl_parse_filename,
.bdrv_file_open = curl_open,
.bdrv_close = curl_close,
.bdrv_getlength = curl_getlength,

.bdrv_aio_readv = curl_aio_readv,

.bdrv_detach_aio_context = curl_detach_aio_context,
.bdrv_attach_aio_context = curl_attach_aio_context,
};

static void curl_block_init(void)
{
bdrv_register(&bdrv_http);
bdrv_register(&bdrv_https);
bdrv_register(&bdrv_ftp);
bdrv_register(&bdrv_ftps);
bdrv_register(&bdrv_tftp);
}

block_init(curl_block_init);
2 changes: 1 addition & 1 deletion docs/qmp-commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,7 @@ Each json-object contain the following:
"file", "file", "ftp", "ftps", "host_cdrom",
"host_device", "http", "https",
"nbd", "parallels", "qcow", "qcow2", "raw",
"tftp", "vdi", "vmdk", "vpc", "vvfat"
"vdi", "vmdk", "vpc", "vvfat"
- "backing_file": backing file name (json-string, optional)
- "backing_file_depth": number of files in the backing file chain (json-int)
- "encrypted": true if encrypted, false otherwise (json-bool)
Expand Down
7 changes: 3 additions & 4 deletions qapi/block-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@
# 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg',
# 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device',
# 'http', 'https', 'luks', 'nbd', 'parallels', 'qcow',
# 'qcow2', 'raw', 'tftp', 'vdi', 'vmdk', 'vpc', 'vvfat'
# 'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat'
# 2.2: 'archipelago' added, 'cow' dropped
# 2.3: 'host_floppy' deprecated
# 2.5: 'host_floppy' dropped
# 2.6: 'luks' added
# 2.8: 'replication' added
# 2.8: 'replication' added, 'tftp' dropped
#
# @backing_file: #optional the name of the backing file (for copy-on-write)
#
Expand Down Expand Up @@ -1723,7 +1723,7 @@
'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom',
'host_device', 'http', 'https', 'luks', 'nbd', 'nfs', 'null-aio',
'null-co', 'parallels', 'qcow', 'qcow2', 'qed', 'quorum', 'raw',
'replication', 'ssh', 'tftp', 'vdi', 'vhdx', 'vmdk', 'vpc',
'replication', 'ssh', 'vdi', 'vhdx', 'vmdk', 'vpc',
'vvfat' ] }

##
Expand Down Expand Up @@ -2410,7 +2410,6 @@
'replication':'BlockdevOptionsReplication',
# TODO sheepdog: Wait for structured options
'ssh': 'BlockdevOptionsSsh',
'tftp': 'BlockdevOptionsCurl',
'vdi': 'BlockdevOptionsGenericFormat',
'vhdx': 'BlockdevOptionsGenericFormat',
'vmdk': 'BlockdevOptionsGenericCOWFormat',
Expand Down
6 changes: 3 additions & 3 deletions qemu-options.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2606,8 +2606,8 @@ qemu-system-x86_64 --drive file=gluster://192.0.2.1/testvol/a.img

See also @url{http://www.gluster.org}.

@item HTTP/HTTPS/FTP/FTPS/TFTP
QEMU supports read-only access to files accessed over http(s), ftp(s) and tftp.
@item HTTP/HTTPS/FTP/FTPS
QEMU supports read-only access to files accessed over http(s) and ftp(s).

Syntax using a single filename:
@example
Expand All @@ -2617,7 +2617,7 @@ Syntax using a single filename:
where:
@table @option
@item protocol
'http', 'https', 'ftp', 'ftps', or 'tftp'.
'http', 'https', 'ftp', or 'ftps'.

@item username
Optional username for authentication to the remote server.
Expand Down

0 comments on commit 23dce38

Please sign in to comment.