curl.c (fcb7e040f5c69ca1f0678f991ab5354488a9e192) curl.c (c86422c5549c0983b4b4525b8f56a1c69dd67aa1)
1/*
2 * QEMU Block driver for CURL images
3 *
4 * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
5 *
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

--- 944 unchanged lines hidden (view full) ---

953 g_hash_table_destroy(s->sockets);
954 g_free(s->cookie);
955 g_free(s->url);
956 g_free(s->username);
957 g_free(s->proxyusername);
958 g_free(s->proxypassword);
959}
960
1/*
2 * QEMU Block driver for CURL images
3 *
4 * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
5 *
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

--- 944 unchanged lines hidden (view full) ---

953 g_hash_table_destroy(s->sockets);
954 g_free(s->cookie);
955 g_free(s->url);
956 g_free(s->username);
957 g_free(s->proxyusername);
958 g_free(s->proxypassword);
959}
960
961static int64_t curl_getlength(BlockDriverState *bs)
961static int64_t coroutine_fn curl_co_getlength(BlockDriverState *bs)
962{
963 BDRVCURLState *s = bs->opaque;
964 return s->len;
965}
966
967static void curl_refresh_filename(BlockDriverState *bs)
968{
969 BDRVCURLState *s = bs->opaque;

--- 27 unchanged lines hidden (view full) ---

997static BlockDriver bdrv_http = {
998 .format_name = "http",
999 .protocol_name = "http",
1000
1001 .instance_size = sizeof(BDRVCURLState),
1002 .bdrv_parse_filename = curl_parse_filename,
1003 .bdrv_file_open = curl_open,
1004 .bdrv_close = curl_close,
962{
963 BDRVCURLState *s = bs->opaque;
964 return s->len;
965}
966
967static void curl_refresh_filename(BlockDriverState *bs)
968{
969 BDRVCURLState *s = bs->opaque;

--- 27 unchanged lines hidden (view full) ---

997static BlockDriver bdrv_http = {
998 .format_name = "http",
999 .protocol_name = "http",
1000
1001 .instance_size = sizeof(BDRVCURLState),
1002 .bdrv_parse_filename = curl_parse_filename,
1003 .bdrv_file_open = curl_open,
1004 .bdrv_close = curl_close,
1005 .bdrv_getlength = curl_getlength,
1005 .bdrv_co_getlength = curl_co_getlength,
1006
1007 .bdrv_co_preadv = curl_co_preadv,
1008
1009 .bdrv_detach_aio_context = curl_detach_aio_context,
1010 .bdrv_attach_aio_context = curl_attach_aio_context,
1011
1012 .bdrv_refresh_filename = curl_refresh_filename,
1013 .strong_runtime_opts = curl_strong_runtime_opts,
1014};
1015
1016static BlockDriver bdrv_https = {
1017 .format_name = "https",
1018 .protocol_name = "https",
1019
1020 .instance_size = sizeof(BDRVCURLState),
1021 .bdrv_parse_filename = curl_parse_filename,
1022 .bdrv_file_open = curl_open,
1023 .bdrv_close = curl_close,
1006
1007 .bdrv_co_preadv = curl_co_preadv,
1008
1009 .bdrv_detach_aio_context = curl_detach_aio_context,
1010 .bdrv_attach_aio_context = curl_attach_aio_context,
1011
1012 .bdrv_refresh_filename = curl_refresh_filename,
1013 .strong_runtime_opts = curl_strong_runtime_opts,
1014};
1015
1016static BlockDriver bdrv_https = {
1017 .format_name = "https",
1018 .protocol_name = "https",
1019
1020 .instance_size = sizeof(BDRVCURLState),
1021 .bdrv_parse_filename = curl_parse_filename,
1022 .bdrv_file_open = curl_open,
1023 .bdrv_close = curl_close,
1024 .bdrv_getlength = curl_getlength,
1024 .bdrv_co_getlength = curl_co_getlength,
1025
1026 .bdrv_co_preadv = curl_co_preadv,
1027
1028 .bdrv_detach_aio_context = curl_detach_aio_context,
1029 .bdrv_attach_aio_context = curl_attach_aio_context,
1030
1031 .bdrv_refresh_filename = curl_refresh_filename,
1032 .strong_runtime_opts = curl_strong_runtime_opts,
1033};
1034
1035static BlockDriver bdrv_ftp = {
1036 .format_name = "ftp",
1037 .protocol_name = "ftp",
1038
1039 .instance_size = sizeof(BDRVCURLState),
1040 .bdrv_parse_filename = curl_parse_filename,
1041 .bdrv_file_open = curl_open,
1042 .bdrv_close = curl_close,
1025
1026 .bdrv_co_preadv = curl_co_preadv,
1027
1028 .bdrv_detach_aio_context = curl_detach_aio_context,
1029 .bdrv_attach_aio_context = curl_attach_aio_context,
1030
1031 .bdrv_refresh_filename = curl_refresh_filename,
1032 .strong_runtime_opts = curl_strong_runtime_opts,
1033};
1034
1035static BlockDriver bdrv_ftp = {
1036 .format_name = "ftp",
1037 .protocol_name = "ftp",
1038
1039 .instance_size = sizeof(BDRVCURLState),
1040 .bdrv_parse_filename = curl_parse_filename,
1041 .bdrv_file_open = curl_open,
1042 .bdrv_close = curl_close,
1043 .bdrv_getlength = curl_getlength,
1043 .bdrv_co_getlength = curl_co_getlength,
1044
1045 .bdrv_co_preadv = curl_co_preadv,
1046
1047 .bdrv_detach_aio_context = curl_detach_aio_context,
1048 .bdrv_attach_aio_context = curl_attach_aio_context,
1049
1050 .bdrv_refresh_filename = curl_refresh_filename,
1051 .strong_runtime_opts = curl_strong_runtime_opts,
1052};
1053
1054static BlockDriver bdrv_ftps = {
1055 .format_name = "ftps",
1056 .protocol_name = "ftps",
1057
1058 .instance_size = sizeof(BDRVCURLState),
1059 .bdrv_parse_filename = curl_parse_filename,
1060 .bdrv_file_open = curl_open,
1061 .bdrv_close = curl_close,
1044
1045 .bdrv_co_preadv = curl_co_preadv,
1046
1047 .bdrv_detach_aio_context = curl_detach_aio_context,
1048 .bdrv_attach_aio_context = curl_attach_aio_context,
1049
1050 .bdrv_refresh_filename = curl_refresh_filename,
1051 .strong_runtime_opts = curl_strong_runtime_opts,
1052};
1053
1054static BlockDriver bdrv_ftps = {
1055 .format_name = "ftps",
1056 .protocol_name = "ftps",
1057
1058 .instance_size = sizeof(BDRVCURLState),
1059 .bdrv_parse_filename = curl_parse_filename,
1060 .bdrv_file_open = curl_open,
1061 .bdrv_close = curl_close,
1062 .bdrv_getlength = curl_getlength,
1062 .bdrv_co_getlength = curl_co_getlength,
1063
1064 .bdrv_co_preadv = curl_co_preadv,
1065
1066 .bdrv_detach_aio_context = curl_detach_aio_context,
1067 .bdrv_attach_aio_context = curl_attach_aio_context,
1068
1069 .bdrv_refresh_filename = curl_refresh_filename,
1070 .strong_runtime_opts = curl_strong_runtime_opts,
1071};
1072
1073static void curl_block_init(void)
1074{
1075 bdrv_register(&bdrv_http);
1076 bdrv_register(&bdrv_https);
1077 bdrv_register(&bdrv_ftp);
1078 bdrv_register(&bdrv_ftps);
1079}
1080
1081block_init(curl_block_init);
1063
1064 .bdrv_co_preadv = curl_co_preadv,
1065
1066 .bdrv_detach_aio_context = curl_detach_aio_context,
1067 .bdrv_attach_aio_context = curl_attach_aio_context,
1068
1069 .bdrv_refresh_filename = curl_refresh_filename,
1070 .strong_runtime_opts = curl_strong_runtime_opts,
1071};
1072
1073static void curl_block_init(void)
1074{
1075 bdrv_register(&bdrv_http);
1076 bdrv_register(&bdrv_https);
1077 bdrv_register(&bdrv_ftp);
1078 bdrv_register(&bdrv_ftps);
1079}
1080
1081block_init(curl_block_init);