2 * QEMU Block driver for CURL images
4 * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 #include "qemu/osdep.h"
25 #include "qemu-common.h"
26 #include "qemu/error-report.h"
27 #include "block/block_int.h"
28 #include "qapi/qmp/qbool.h"
29 #include "qapi/qmp/qstring.h"
30 #include <curl/curl.h>
33 // #define DEBUG_VERBOSE
36 #define DPRINTF(fmt, ...) do { printf(fmt, ## __VA_ARGS__); } while (0)
38 #define DPRINTF(fmt, ...) do { } while (0)
41 #if LIBCURL_VERSION_NUM >= 0x071000
42 /* The multi interface timer callback was introduced in 7.16.0 */
43 #define NEED_CURL_TIMER_CALLBACK
44 #define HAVE_SOCKET_ACTION
47 #ifndef HAVE_SOCKET_ACTION
48 /* If curl_multi_socket_action isn't available, define it statically here in
49 * terms of curl_multi_socket. Note that ev_bitmask will be ignored, which is
50 * less efficient but still safe. */
51 static CURLMcode
__curl_multi_socket_action(CURLM
*multi_handle
,
56 return curl_multi_socket(multi_handle
, sockfd
, running_handles
);
58 #define curl_multi_socket_action __curl_multi_socket_action
61 #define PROTOCOLS (CURLPROTO_HTTP | CURLPROTO_HTTPS | \
62 CURLPROTO_FTP | CURLPROTO_FTPS | \
65 #define CURL_NUM_STATES 8
66 #define CURL_NUM_ACB 8
67 #define SECTOR_SIZE 512
68 #define READ_AHEAD_DEFAULT (256 * 1024)
69 #define CURL_TIMEOUT_DEFAULT 5
70 #define CURL_TIMEOUT_MAX 10000
72 #define FIND_RET_NONE 0
74 #define FIND_RET_WAIT 2
76 #define CURL_BLOCK_OPT_URL "url"
77 #define CURL_BLOCK_OPT_READAHEAD "readahead"
78 #define CURL_BLOCK_OPT_SSLVERIFY "sslverify"
79 #define CURL_BLOCK_OPT_TIMEOUT "timeout"
80 #define CURL_BLOCK_OPT_COOKIE "cookie"
84 typedef struct CURLAIOCB
{
96 typedef struct CURLState
98 struct BDRVCURLState
*s
;
99 CURLAIOCB
*acb
[CURL_NUM_ACB
];
101 curl_socket_t sock_fd
;
107 char errmsg
[CURL_ERROR_SIZE
];
111 typedef struct BDRVCURLState
{
115 CURLState states
[CURL_NUM_STATES
];
117 size_t readahead_size
;
122 AioContext
*aio_context
;
125 static void curl_clean_state(CURLState
*s
);
126 static void curl_multi_do(void *arg
);
127 static void curl_multi_read(void *arg
);
129 #ifdef NEED_CURL_TIMER_CALLBACK
130 static int curl_timer_cb(CURLM
*multi
, long timeout_ms
, void *opaque
)
132 BDRVCURLState
*s
= opaque
;
134 DPRINTF("CURL: timer callback timeout_ms %ld\n", timeout_ms
);
135 if (timeout_ms
== -1) {
136 timer_del(&s
->timer
);
138 int64_t timeout_ns
= (int64_t)timeout_ms
* 1000 * 1000;
140 qemu_clock_get_ns(QEMU_CLOCK_REALTIME
) + timeout_ns
);
146 static int curl_sock_cb(CURL
*curl
, curl_socket_t fd
, int action
,
147 void *userp
, void *sp
)
150 CURLState
*state
= NULL
;
151 curl_easy_getinfo(curl
, CURLINFO_PRIVATE
, (char **)&state
);
155 DPRINTF("CURL (AIO): Sock action %d on fd %d\n", action
, fd
);
158 aio_set_fd_handler(s
->aio_context
, fd
, false,
159 curl_multi_read
, NULL
, state
);
162 aio_set_fd_handler(s
->aio_context
, fd
, false,
163 NULL
, curl_multi_do
, state
);
165 case CURL_POLL_INOUT
:
166 aio_set_fd_handler(s
->aio_context
, fd
, false,
167 curl_multi_read
, curl_multi_do
, state
);
169 case CURL_POLL_REMOVE
:
170 aio_set_fd_handler(s
->aio_context
, fd
, false,
178 static size_t curl_header_cb(void *ptr
, size_t size
, size_t nmemb
, void *opaque
)
180 BDRVCURLState
*s
= opaque
;
181 size_t realsize
= size
* nmemb
;
182 const char *accept_line
= "Accept-Ranges: bytes";
184 if (realsize
>= strlen(accept_line
)
185 && strncmp((char *)ptr
, accept_line
, strlen(accept_line
)) == 0) {
186 s
->accept_range
= true;
192 static size_t curl_read_cb(void *ptr
, size_t size
, size_t nmemb
, void *opaque
)
194 CURLState
*s
= ((CURLState
*)opaque
);
195 size_t realsize
= size
* nmemb
;
198 DPRINTF("CURL: Just reading %zd bytes\n", realsize
);
200 if (!s
|| !s
->orig_buf
)
203 if (s
->buf_off
>= s
->buf_len
) {
204 /* buffer full, read nothing */
207 realsize
= MIN(realsize
, s
->buf_len
- s
->buf_off
);
208 memcpy(s
->orig_buf
+ s
->buf_off
, ptr
, realsize
);
209 s
->buf_off
+= realsize
;
211 for(i
=0; i
<CURL_NUM_ACB
; i
++) {
212 CURLAIOCB
*acb
= s
->acb
[i
];
217 if ((s
->buf_off
>= acb
->end
)) {
218 qemu_iovec_from_buf(acb
->qiov
, 0, s
->orig_buf
+ acb
->start
,
219 acb
->end
- acb
->start
);
220 acb
->common
.cb(acb
->common
.opaque
, 0);
229 static int curl_find_buf(BDRVCURLState
*s
, size_t start
, size_t len
,
233 size_t end
= start
+ len
;
235 for (i
=0; i
<CURL_NUM_STATES
; i
++) {
236 CURLState
*state
= &s
->states
[i
];
237 size_t buf_end
= (state
->buf_start
+ state
->buf_off
);
238 size_t buf_fend
= (state
->buf_start
+ state
->buf_len
);
240 if (!state
->orig_buf
)
245 // Does the existing buffer cover our section?
246 if ((start
>= state
->buf_start
) &&
247 (start
<= buf_end
) &&
248 (end
>= state
->buf_start
) &&
251 char *buf
= state
->orig_buf
+ (start
- state
->buf_start
);
253 qemu_iovec_from_buf(acb
->qiov
, 0, buf
, len
);
254 acb
->common
.cb(acb
->common
.opaque
, 0);
259 // Wait for unfinished chunks
261 (start
>= state
->buf_start
) &&
262 (start
<= buf_fend
) &&
263 (end
>= state
->buf_start
) &&
268 acb
->start
= start
- state
->buf_start
;
269 acb
->end
= acb
->start
+ len
;
271 for (j
=0; j
<CURL_NUM_ACB
; j
++) {
272 if (!state
->acb
[j
]) {
274 return FIND_RET_WAIT
;
280 return FIND_RET_NONE
;
283 static void curl_multi_check_completion(BDRVCURLState
*s
)
287 /* Try to find done transfers, so we can free the easy
291 msg
= curl_multi_info_read(s
->multi
, &msgs_in_queue
);
293 /* Quit when there are no more completions */
297 if (msg
->msg
== CURLMSG_DONE
) {
298 CURLState
*state
= NULL
;
299 curl_easy_getinfo(msg
->easy_handle
, CURLINFO_PRIVATE
,
302 /* ACBs for successful messages get completed in curl_read_cb */
303 if (msg
->data
.result
!= CURLE_OK
) {
305 static int errcount
= 100;
307 /* Don't lose the original error message from curl, since
308 * it contains extra data.
311 error_report("curl: %s", state
->errmsg
);
312 if (--errcount
== 0) {
313 error_report("curl: further errors suppressed");
317 for (i
= 0; i
< CURL_NUM_ACB
; i
++) {
318 CURLAIOCB
*acb
= state
->acb
[i
];
324 acb
->common
.cb(acb
->common
.opaque
, -EPROTO
);
326 state
->acb
[i
] = NULL
;
330 curl_clean_state(state
);
336 static void curl_multi_do(void *arg
)
338 CURLState
*s
= (CURLState
*)arg
;
347 r
= curl_multi_socket_action(s
->s
->multi
, s
->sock_fd
, 0, &running
);
348 } while(r
== CURLM_CALL_MULTI_PERFORM
);
352 static void curl_multi_read(void *arg
)
354 CURLState
*s
= (CURLState
*)arg
;
357 curl_multi_check_completion(s
->s
);
360 static void curl_multi_timeout_do(void *arg
)
362 #ifdef NEED_CURL_TIMER_CALLBACK
363 BDRVCURLState
*s
= (BDRVCURLState
*)arg
;
370 curl_multi_socket_action(s
->multi
, CURL_SOCKET_TIMEOUT
, 0, &running
);
372 curl_multi_check_completion(s
);
378 static CURLState
*curl_init_state(BlockDriverState
*bs
, BDRVCURLState
*s
)
380 CURLState
*state
= NULL
;
384 for (i
=0; i
<CURL_NUM_STATES
; i
++) {
385 for (j
=0; j
<CURL_NUM_ACB
; j
++)
386 if (s
->states
[i
].acb
[j
])
388 if (s
->states
[i
].in_use
)
391 state
= &s
->states
[i
];
396 aio_poll(bdrv_get_aio_context(bs
), true);
401 state
->curl
= curl_easy_init();
405 curl_easy_setopt(state
->curl
, CURLOPT_URL
, s
->url
);
406 curl_easy_setopt(state
->curl
, CURLOPT_SSL_VERIFYPEER
,
407 (long) s
->sslverify
);
409 curl_easy_setopt(state
->curl
, CURLOPT_COOKIE
, s
->cookie
);
411 curl_easy_setopt(state
->curl
, CURLOPT_TIMEOUT
, (long)s
->timeout
);
412 curl_easy_setopt(state
->curl
, CURLOPT_WRITEFUNCTION
,
413 (void *)curl_read_cb
);
414 curl_easy_setopt(state
->curl
, CURLOPT_WRITEDATA
, (void *)state
);
415 curl_easy_setopt(state
->curl
, CURLOPT_PRIVATE
, (void *)state
);
416 curl_easy_setopt(state
->curl
, CURLOPT_AUTOREFERER
, 1);
417 curl_easy_setopt(state
->curl
, CURLOPT_FOLLOWLOCATION
, 1);
418 curl_easy_setopt(state
->curl
, CURLOPT_NOSIGNAL
, 1);
419 curl_easy_setopt(state
->curl
, CURLOPT_ERRORBUFFER
, state
->errmsg
);
420 curl_easy_setopt(state
->curl
, CURLOPT_FAILONERROR
, 1);
422 /* Restrict supported protocols to avoid security issues in the more
423 * obscure protocols. For example, do not allow POP3/SMTP/IMAP see
426 * Restricting protocols is only supported from 7.19.4 upwards.
428 #if LIBCURL_VERSION_NUM >= 0x071304
429 curl_easy_setopt(state
->curl
, CURLOPT_PROTOCOLS
, PROTOCOLS
);
430 curl_easy_setopt(state
->curl
, CURLOPT_REDIR_PROTOCOLS
, PROTOCOLS
);
434 curl_easy_setopt(state
->curl
, CURLOPT_VERBOSE
, 1);
443 static void curl_clean_state(CURLState
*s
)
446 curl_multi_remove_handle(s
->s
->multi
, s
->curl
);
450 static void curl_parse_filename(const char *filename
, QDict
*options
,
453 qdict_put(options
, CURL_BLOCK_OPT_URL
, qstring_from_str(filename
));
456 static void curl_detach_aio_context(BlockDriverState
*bs
)
458 BDRVCURLState
*s
= bs
->opaque
;
461 for (i
= 0; i
< CURL_NUM_STATES
; i
++) {
462 if (s
->states
[i
].in_use
) {
463 curl_clean_state(&s
->states
[i
]);
465 if (s
->states
[i
].curl
) {
466 curl_easy_cleanup(s
->states
[i
].curl
);
467 s
->states
[i
].curl
= NULL
;
469 g_free(s
->states
[i
].orig_buf
);
470 s
->states
[i
].orig_buf
= NULL
;
473 curl_multi_cleanup(s
->multi
);
477 timer_del(&s
->timer
);
480 static void curl_attach_aio_context(BlockDriverState
*bs
,
481 AioContext
*new_context
)
483 BDRVCURLState
*s
= bs
->opaque
;
485 aio_timer_init(new_context
, &s
->timer
,
486 QEMU_CLOCK_REALTIME
, SCALE_NS
,
487 curl_multi_timeout_do
, s
);
490 s
->multi
= curl_multi_init();
491 s
->aio_context
= new_context
;
492 curl_multi_setopt(s
->multi
, CURLMOPT_SOCKETFUNCTION
, curl_sock_cb
);
493 #ifdef NEED_CURL_TIMER_CALLBACK
494 curl_multi_setopt(s
->multi
, CURLMOPT_TIMERDATA
, s
);
495 curl_multi_setopt(s
->multi
, CURLMOPT_TIMERFUNCTION
, curl_timer_cb
);
499 static QemuOptsList runtime_opts
= {
501 .head
= QTAILQ_HEAD_INITIALIZER(runtime_opts
.head
),
504 .name
= CURL_BLOCK_OPT_URL
,
505 .type
= QEMU_OPT_STRING
,
506 .help
= "URL to open",
509 .name
= CURL_BLOCK_OPT_READAHEAD
,
510 .type
= QEMU_OPT_SIZE
,
511 .help
= "Readahead size",
514 .name
= CURL_BLOCK_OPT_SSLVERIFY
,
515 .type
= QEMU_OPT_BOOL
,
516 .help
= "Verify SSL certificate"
519 .name
= CURL_BLOCK_OPT_TIMEOUT
,
520 .type
= QEMU_OPT_NUMBER
,
521 .help
= "Curl timeout"
524 .name
= CURL_BLOCK_OPT_COOKIE
,
525 .type
= QEMU_OPT_STRING
,
526 .help
= "Pass the cookie or list of cookies with each request"
528 { /* end of list */ }
532 static int curl_open(BlockDriverState
*bs
, QDict
*options
, int flags
,
535 BDRVCURLState
*s
= bs
->opaque
;
536 CURLState
*state
= NULL
;
538 Error
*local_err
= NULL
;
543 static int inited
= 0;
545 if (flags
& BDRV_O_RDWR
) {
546 error_setg(errp
, "curl block device does not support writes");
550 opts
= qemu_opts_create(&runtime_opts
, NULL
, 0, &error_abort
);
551 qemu_opts_absorb_qdict(opts
, options
, &local_err
);
553 error_propagate(errp
, local_err
);
557 s
->readahead_size
= qemu_opt_get_size(opts
, CURL_BLOCK_OPT_READAHEAD
,
559 if ((s
->readahead_size
& 0x1ff) != 0) {
560 error_setg(errp
, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512",
565 s
->timeout
= qemu_opt_get_number(opts
, CURL_BLOCK_OPT_TIMEOUT
,
566 CURL_TIMEOUT_DEFAULT
);
567 if (s
->timeout
> CURL_TIMEOUT_MAX
) {
568 error_setg(errp
, "timeout parameter is too large or negative");
572 s
->sslverify
= qemu_opt_get_bool(opts
, CURL_BLOCK_OPT_SSLVERIFY
, true);
574 cookie
= qemu_opt_get(opts
, CURL_BLOCK_OPT_COOKIE
);
575 s
->cookie
= g_strdup(cookie
);
577 file
= qemu_opt_get(opts
, CURL_BLOCK_OPT_URL
);
579 error_setg(errp
, "curl block driver requires an 'url' option");
584 curl_global_init(CURL_GLOBAL_ALL
);
588 DPRINTF("CURL: Opening %s\n", file
);
589 s
->aio_context
= bdrv_get_aio_context(bs
);
590 s
->url
= g_strdup(file
);
591 state
= curl_init_state(bs
, s
);
597 s
->accept_range
= false;
598 curl_easy_setopt(state
->curl
, CURLOPT_NOBODY
, 1);
599 curl_easy_setopt(state
->curl
, CURLOPT_HEADERFUNCTION
,
601 curl_easy_setopt(state
->curl
, CURLOPT_HEADERDATA
, s
);
602 if (curl_easy_perform(state
->curl
))
604 curl_easy_getinfo(state
->curl
, CURLINFO_CONTENT_LENGTH_DOWNLOAD
, &d
);
609 if ((!strncasecmp(s
->url
, "http://", strlen("http://"))
610 || !strncasecmp(s
->url
, "https://", strlen("https://")))
611 && !s
->accept_range
) {
612 pstrcpy(state
->errmsg
, CURL_ERROR_SIZE
,
613 "Server does not support 'range' (byte ranges).");
616 DPRINTF("CURL: Size = %zd\n", s
->len
);
618 curl_clean_state(state
);
619 curl_easy_cleanup(state
->curl
);
622 curl_attach_aio_context(bs
, bdrv_get_aio_context(bs
));
628 error_setg(errp
, "CURL: Error opening file: %s", state
->errmsg
);
629 curl_easy_cleanup(state
->curl
);
638 static const AIOCBInfo curl_aiocb_info
= {
639 .aiocb_size
= sizeof(CURLAIOCB
),
643 static void curl_readv_bh_cb(void *p
)
649 BDRVCURLState
*s
= acb
->common
.bs
->opaque
;
651 qemu_bh_delete(acb
->bh
);
654 size_t start
= acb
->sector_num
* SECTOR_SIZE
;
657 // In case we have the requested data already (e.g. read-ahead),
658 // we can just call the callback and be done.
659 switch (curl_find_buf(s
, start
, acb
->nb_sectors
* SECTOR_SIZE
, acb
)) {
669 // No cache found, so let's start a new request
670 state
= curl_init_state(acb
->common
.bs
, s
);
672 acb
->common
.cb(acb
->common
.opaque
, -EIO
);
678 acb
->end
= (acb
->nb_sectors
* SECTOR_SIZE
);
681 g_free(state
->orig_buf
);
682 state
->buf_start
= start
;
683 state
->buf_len
= acb
->end
+ s
->readahead_size
;
684 end
= MIN(start
+ state
->buf_len
, s
->len
) - 1;
685 state
->orig_buf
= g_try_malloc(state
->buf_len
);
686 if (state
->buf_len
&& state
->orig_buf
== NULL
) {
687 curl_clean_state(state
);
688 acb
->common
.cb(acb
->common
.opaque
, -ENOMEM
);
694 snprintf(state
->range
, 127, "%zd-%zd", start
, end
);
695 DPRINTF("CURL (AIO): Reading %d at %zd (%s)\n",
696 (acb
->nb_sectors
* SECTOR_SIZE
), start
, state
->range
);
697 curl_easy_setopt(state
->curl
, CURLOPT_RANGE
, state
->range
);
699 curl_multi_add_handle(s
->multi
, state
->curl
);
701 /* Tell curl it needs to kick things off */
702 curl_multi_socket_action(s
->multi
, CURL_SOCKET_TIMEOUT
, 0, &running
);
705 static BlockAIOCB
*curl_aio_readv(BlockDriverState
*bs
,
706 int64_t sector_num
, QEMUIOVector
*qiov
, int nb_sectors
,
707 BlockCompletionFunc
*cb
, void *opaque
)
711 acb
= qemu_aio_get(&curl_aiocb_info
, bs
, cb
, opaque
);
714 acb
->sector_num
= sector_num
;
715 acb
->nb_sectors
= nb_sectors
;
717 acb
->bh
= aio_bh_new(bdrv_get_aio_context(bs
), curl_readv_bh_cb
, acb
);
718 qemu_bh_schedule(acb
->bh
);
722 static void curl_close(BlockDriverState
*bs
)
724 BDRVCURLState
*s
= bs
->opaque
;
726 DPRINTF("CURL: Close\n");
727 curl_detach_aio_context(bs
);
733 static int64_t curl_getlength(BlockDriverState
*bs
)
735 BDRVCURLState
*s
= bs
->opaque
;
739 static BlockDriver bdrv_http
= {
740 .format_name
= "http",
741 .protocol_name
= "http",
743 .instance_size
= sizeof(BDRVCURLState
),
744 .bdrv_parse_filename
= curl_parse_filename
,
745 .bdrv_file_open
= curl_open
,
746 .bdrv_close
= curl_close
,
747 .bdrv_getlength
= curl_getlength
,
749 .bdrv_aio_readv
= curl_aio_readv
,
751 .bdrv_detach_aio_context
= curl_detach_aio_context
,
752 .bdrv_attach_aio_context
= curl_attach_aio_context
,
755 static BlockDriver bdrv_https
= {
756 .format_name
= "https",
757 .protocol_name
= "https",
759 .instance_size
= sizeof(BDRVCURLState
),
760 .bdrv_parse_filename
= curl_parse_filename
,
761 .bdrv_file_open
= curl_open
,
762 .bdrv_close
= curl_close
,
763 .bdrv_getlength
= curl_getlength
,
765 .bdrv_aio_readv
= curl_aio_readv
,
767 .bdrv_detach_aio_context
= curl_detach_aio_context
,
768 .bdrv_attach_aio_context
= curl_attach_aio_context
,
771 static BlockDriver bdrv_ftp
= {
772 .format_name
= "ftp",
773 .protocol_name
= "ftp",
775 .instance_size
= sizeof(BDRVCURLState
),
776 .bdrv_parse_filename
= curl_parse_filename
,
777 .bdrv_file_open
= curl_open
,
778 .bdrv_close
= curl_close
,
779 .bdrv_getlength
= curl_getlength
,
781 .bdrv_aio_readv
= curl_aio_readv
,
783 .bdrv_detach_aio_context
= curl_detach_aio_context
,
784 .bdrv_attach_aio_context
= curl_attach_aio_context
,
787 static BlockDriver bdrv_ftps
= {
788 .format_name
= "ftps",
789 .protocol_name
= "ftps",
791 .instance_size
= sizeof(BDRVCURLState
),
792 .bdrv_parse_filename
= curl_parse_filename
,
793 .bdrv_file_open
= curl_open
,
794 .bdrv_close
= curl_close
,
795 .bdrv_getlength
= curl_getlength
,
797 .bdrv_aio_readv
= curl_aio_readv
,
799 .bdrv_detach_aio_context
= curl_detach_aio_context
,
800 .bdrv_attach_aio_context
= curl_attach_aio_context
,
803 static BlockDriver bdrv_tftp
= {
804 .format_name
= "tftp",
805 .protocol_name
= "tftp",
807 .instance_size
= sizeof(BDRVCURLState
),
808 .bdrv_parse_filename
= curl_parse_filename
,
809 .bdrv_file_open
= curl_open
,
810 .bdrv_close
= curl_close
,
811 .bdrv_getlength
= curl_getlength
,
813 .bdrv_aio_readv
= curl_aio_readv
,
815 .bdrv_detach_aio_context
= curl_detach_aio_context
,
816 .bdrv_attach_aio_context
= curl_attach_aio_context
,
819 static void curl_block_init(void)
821 bdrv_register(&bdrv_http
);
822 bdrv_register(&bdrv_https
);
823 bdrv_register(&bdrv_ftp
);
824 bdrv_register(&bdrv_ftps
);
825 bdrv_register(&bdrv_tftp
);
828 block_init(curl_block_init
);