diff --git a/repos/libports/src/app/fetchurl/component.cc b/repos/libports/src/app/fetchurl/component.cc index 478d2362cf..4d747ba61e 100644 --- a/repos/libports/src/app/fetchurl/component.cc +++ b/repos/libports/src/app/fetchurl/component.cc @@ -38,8 +38,10 @@ namespace Fetchurl { struct User_data; struct Main; - typedef Genode::String<256> Url; - typedef Genode::Path<256> Path; + using namespace Genode; + + typedef String<256> Url; + typedef Path<256> Path; } static size_t write_callback(char *ptr, @@ -52,13 +54,13 @@ static int progress_callback(void *userdata, curl_off_t ultotal, curl_off_t ulnow); -class Fetchurl::Fetch : Genode::List::Element +class Fetchurl::Fetch : List::Element { - friend class Genode::List; + friend class List; public: - using Genode::List::Element::next; + using List::Element::next; Main &main; @@ -86,9 +88,9 @@ class Fetchurl::Fetch : Genode::List::Element struct Fetchurl::User_data { Timer::Connection &timer; - Genode::Milliseconds last_ms; - Genode::Milliseconds const max_timeout; - Genode::Milliseconds curr_timeout; + Milliseconds last_ms; + Milliseconds const max_timeout; + Milliseconds curr_timeout; Fetchurl::Fetch &fetch; }; @@ -100,20 +102,20 @@ struct Fetchurl::Main Libc::Env &_env; - Genode::Heap _heap { _env.pd(), _env.rm() }; + Heap _heap { _env.pd(), _env.rm() }; Timer::Connection _timer { _env, "reporter" }; - Genode::Constructible _reporter { }; + Constructible _reporter { }; - Genode::List _fetches { }; + List _fetches { }; Timer::One_shot_timeout
_report_timeout { _timer, *this, &Main::_report }; - Genode::Duration _report_delay { Genode::Milliseconds { 0 } }; + Duration _report_delay { Milliseconds { 0 } }; - Genode::Milliseconds _progress_timeout { 10u * 1000 }; + Milliseconds _progress_timeout { 10u * 1000 }; bool _ignore_result { false }; @@ -135,7 +137,7 @@ struct Fetchurl::Main if (!_reporter.constructed()) return; - _reporter->generate([&] (Genode::Xml_generator &xml) { + _reporter->generate([&] (Xml_generator &xml) { for (Fetch *f = _fetches.first(); f; f = f->next()) { xml.node("fetch", [&] { xml.attribute("url", f->url); @@ -149,9 +151,9 @@ struct Fetchurl::Main }); } - void _report(Genode::Duration) { _report(); } + void _report(Duration) { _report(); } - void parse_config(Genode::Xml_node const &config_node) + void parse_config(Xml_node const &config_node) { using namespace Genode; @@ -176,10 +178,10 @@ struct Fetchurl::Main _progress_timeout.value = config_node.attribute_value("progress_timeout", _progress_timeout.value); - auto const parse_fn = [&] (Genode::Xml_node node) { + auto const parse_fn = [&] (Xml_node node) { if (!node.has_attribute("url") || !node.has_attribute("path")) { - Genode::error("error reading 'fetch' XML node"); + error("error reading 'fetch' XML node"); return; } @@ -202,14 +204,14 @@ struct Fetchurl::Main Main(Libc::Env &e) : _env(e) { - _env.config([&] (Genode::Xml_node const &config) { + _env.config([&] (Xml_node const &config) { parse_config(config); }); } CURLcode _process_fetch(CURL *_curl, Fetch &_fetch) { - Genode::log("fetch ", _fetch.url); + log("fetch ", _fetch.url, " to ", _fetch.path); char const *out_path = _fetch.path.base(); @@ -230,7 +232,7 @@ struct Fetchurl::Main if (end_of_elem && (sub_path_len == 0)) continue; - Genode::String<256> sub_path(Genode::Cstring(out_path, sub_path_len)); + String<256> sub_path(Cstring(out_path, sub_path_len)); /* skip '/' */ sub_path_len++; @@ -244,7 +246,7 @@ struct Fetchurl::Main /* create directory for sub path */ if (mkdir(sub_path.string(), 0777) < 0) { - Genode::error("failed to create directory ", sub_path); + error("failed to create directory ", sub_path); return CURLE_FAILED_INIT; } } @@ -253,15 +255,15 @@ struct Fetchurl::Main if (fd == -1) { switch (errno) { case EACCES: - Genode::error("permission denied at ", out_path); break; + error("permission denied at ", out_path); break; case EEXIST: - Genode::error(out_path, " already exists"); break; + error(out_path, " already exists"); break; case EISDIR: - Genode::error(out_path, " is a directory"); break; + error(out_path, " is a directory"); break; case ENOSPC: - Genode::error("cannot create ", out_path, ", out of space"); break; + error("cannot create ", out_path, ", out of space"); break; default: - Genode::error("creation of ", out_path, " failed (errno=", errno, ")"); + error("creation of ", out_path, " failed (errno=", errno, ")"); } return CURLE_FAILED_INIT; } @@ -285,7 +287,7 @@ struct Fetchurl::Main .timer = _timer, .last_ms = _timer.curr_time().trunc_to_plain_ms(), .max_timeout = _progress_timeout, - .curr_timeout = Genode::Milliseconds { 0 }, + .curr_timeout = Milliseconds { 0 }, .fetch = _fetch, }; curl_easy_setopt(_curl, CURLOPT_PROGRESSDATA, &ud); @@ -307,7 +309,7 @@ struct Fetchurl::Main if (res != CURLE_OK) { unsigned long response_code = -1; curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &response_code); - Genode::error(curl_easy_strerror(res), " (code=", response_code, "), failed to fetch ", _fetch.url); + error(curl_easy_strerror(res), " (code=", response_code, "), failed to fetch ", _fetch.url); } return res; } @@ -318,7 +320,7 @@ struct Fetchurl::Main CURL *curl = curl_easy_init(); if (!curl) { - Genode::error("failed to initialize libcurl"); + error("failed to initialize libcurl"); return -1; }