Everywhere: Add sv suffix to strings relying on StringView(char const*)

Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
This commit is contained in:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
Notes: sideshowbarker 2024-07-17 09:27:05 +09:00
762 changed files with 8315 additions and 8316 deletions

View file

@ -12,29 +12,29 @@
namespace AK { namespace AK {
static constexpr Array<StringView, 7> long_day_names = { static constexpr Array<StringView, 7> long_day_names = {
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" "Sunday"sv, "Monday"sv, "Tuesday"sv, "Wednesday"sv, "Thursday"sv, "Friday"sv, "Saturday"sv
}; };
static constexpr Array<StringView, 7> short_day_names = { static constexpr Array<StringView, 7> short_day_names = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" "Sun"sv, "Mon"sv, "Tue"sv, "Wed"sv, "Thu"sv, "Fri"sv, "Sat"sv
}; };
static constexpr Array<StringView, 7> mini_day_names = { static constexpr Array<StringView, 7> mini_day_names = {
"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" "Su"sv, "Mo"sv, "Tu"sv, "We"sv, "Th"sv, "Fr"sv, "Sa"sv
}; };
static constexpr Array<StringView, 7> micro_day_names = { static constexpr Array<StringView, 7> micro_day_names = {
"S", "M", "T", "W", "T", "F", "S" "S"sv, "M"sv, "T"sv, "W"sv, "T"sv, "F"sv, "S"sv
}; };
static constexpr Array<StringView, 12> long_month_names = { static constexpr Array<StringView, 12> long_month_names = {
"January", "February", "March", "April", "May", "June", "January"sv, "February"sv, "March"sv, "April"sv, "May"sv, "June"sv,
"July", "August", "September", "October", "November", "December" "July"sv, "August"sv, "September"sv, "October"sv, "November"sv, "December"sv
}; };
static constexpr Array<StringView, 12> short_month_names = { static constexpr Array<StringView, 12> short_month_names = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jan"sv, "Feb"sv, "Mar"sv, "Apr"sv, "May"sv, "Jun"sv,
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" "Jul"sv, "Aug"sv, "Sep"sv, "Oct"sv, "Nov"sv, "Dec"sv
}; };
} }

View file

@ -114,7 +114,7 @@ StringView FormatParser::consume_literal()
if (consume_specific("}}")) if (consume_specific("}}"))
continue; continue;
if (next_is(is_any_of("{}"))) if (next_is(is_any_of("{}"sv)))
return m_input.substring_view(begin, tell() - begin); return m_input.substring_view(begin, tell() - begin);
consume(); consume();
@ -170,7 +170,7 @@ bool FormatParser::consume_specifier(FormatSpecifier& specifier)
if (!consume_specific('}')) if (!consume_specific('}'))
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
specifier.flags = ""; specifier.flags = ""sv;
} }
return true; return true;
@ -287,16 +287,16 @@ ErrorOr<void> FormatBuilder::put_u64(
if (prefix) { if (prefix) {
if (base == 2) { if (base == 2) {
if (upper_case) if (upper_case)
TRY(m_builder.try_append("0B")); TRY(m_builder.try_append("0B"sv));
else else
TRY(m_builder.try_append("0b")); TRY(m_builder.try_append("0b"sv));
} else if (base == 8) { } else if (base == 8) {
TRY(m_builder.try_append("0")); TRY(m_builder.try_append("0"sv));
} else if (base == 16) { } else if (base == 16) {
if (upper_case) if (upper_case)
TRY(m_builder.try_append("0X")); TRY(m_builder.try_append("0X"sv));
else else
TRY(m_builder.try_append("0x")); TRY(m_builder.try_append("0x"sv));
} }
} }
return {}; return {};
@ -587,8 +587,8 @@ ErrorOr<void> vformat(StringBuilder& builder, StringView fmtstr, TypeErasedForma
void StandardFormatter::parse(TypeErasedFormatParams& params, FormatParser& parser) void StandardFormatter::parse(TypeErasedFormatParams& params, FormatParser& parser)
{ {
if (StringView { "<^>" }.contains(parser.peek(1))) { if ("<^>"sv.contains(parser.peek(1))) {
VERIFY(!parser.next_is(is_any_of("{}"))); VERIFY(!parser.next_is(is_any_of("{}"sv)));
m_fill = parser.consume(); m_fill = parser.consume();
} }
@ -788,7 +788,7 @@ ErrorOr<void> Formatter<bool>::format(FormatBuilder& builder, bool value)
return builder.put_hexdump({ &value, sizeof(value) }, m_width.value_or(32), m_fill); return builder.put_hexdump({ &value, sizeof(value) }, m_width.value_or(32), m_fill);
} else { } else {
Formatter<StringView> formatter { *this }; Formatter<StringView> formatter { *this };
return formatter.format(builder, value ? "true" : "false"); return formatter.format(builder, value ? "true"sv : "false"sv);
} }
} }
#ifndef KERNEL #ifndef KERNEL

View file

@ -638,7 +638,7 @@ template<typename T, bool Supported = false>
struct __FormatIfSupported : Formatter<StringView> { struct __FormatIfSupported : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, FormatIfSupported<T> const&) ErrorOr<void> format(FormatBuilder& builder, FormatIfSupported<T> const&)
{ {
return Formatter<StringView>::format(builder, "?"); return Formatter<StringView>::format(builder, "?"sv);
} }
}; };
template<typename T> template<typename T>
@ -673,15 +673,15 @@ struct Formatter<Error> : Formatter<FormatString> {
{ {
#if defined(__serenity__) && defined(KERNEL) #if defined(__serenity__) && defined(KERNEL)
if (error.is_errno()) if (error.is_errno())
return Formatter<FormatString>::format(builder, "Error(errno={})", error.code()); return Formatter<FormatString>::format(builder, "Error(errno={})"sv, error.code());
return Formatter<FormatString>::format(builder, "Error({})", error.string_literal()); return Formatter<FormatString>::format(builder, "Error({})"sv, error.string_literal());
#else #else
if (error.is_syscall()) if (error.is_syscall())
return Formatter<FormatString>::format(builder, "{}: {} (errno={})", error.string_literal(), strerror(error.code()), error.code()); return Formatter<FormatString>::format(builder, "{}: {} (errno={})"sv, error.string_literal(), strerror(error.code()), error.code());
if (error.is_errno()) if (error.is_errno())
return Formatter<FormatString>::format(builder, "{} (errno={})", strerror(error.code()), error.code()); return Formatter<FormatString>::format(builder, "{} (errno={})"sv, strerror(error.code()), error.code());
return Formatter<FormatString>::format(builder, "{}", error.string_literal()); return Formatter<FormatString>::format(builder, "{}"sv, error.string_literal());
#endif #endif
} }
}; };
@ -691,8 +691,8 @@ struct Formatter<ErrorOr<T, ErrorType>> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, ErrorOr<T, ErrorType> const& error_or) ErrorOr<void> format(FormatBuilder& builder, ErrorOr<T, ErrorType> const& error_or)
{ {
if (error_or.is_error()) if (error_or.is_error())
return Formatter<FormatString>::format(builder, "{}", error_or.error()); return Formatter<FormatString>::format(builder, "{}"sv, error_or.error());
return Formatter<FormatString>::format(builder, "{{{}}}", error_or.value()); return Formatter<FormatString>::format(builder, "{{{}}}"sv, error_or.value());
} }
}; };

View file

@ -95,7 +95,7 @@ public:
return consume_specific(StringView { next, __builtin_strlen(next) }); return consume_specific(StringView { next, __builtin_strlen(next) });
} }
constexpr char consume_escaped_character(char escape_char = '\\', StringView escape_map = "n\nr\rt\tb\bf\f") constexpr char consume_escaped_character(char escape_char = '\\', StringView escape_map = "n\nr\rt\tb\bf\f"sv)
{ {
if (!consume_specific(escape_char)) if (!consume_specific(escape_char))
return consume(); return consume();
@ -234,8 +234,8 @@ constexpr auto is_not_any_of(StringView values)
return [values](auto c) { return !values.contains(c); }; return [values](auto c) { return !values.contains(c); };
} }
constexpr auto is_path_separator = is_any_of("/\\"); constexpr auto is_path_separator = is_any_of("/\\"sv);
constexpr auto is_quote = is_any_of("'\""); constexpr auto is_quote = is_any_of("'\""sv);
} }

View file

@ -193,7 +193,7 @@ inline void JsonValue::serialize(Builder& builder) const
m_value.as_object->serialize(builder); m_value.as_object->serialize(builder);
break; break;
case Type::Bool: case Type::Bool:
builder.append(m_value.as_bool ? "true" : "false"); builder.append(m_value.as_bool ? "true"sv : "false"sv);
break; break;
#if !defined(KERNEL) #if !defined(KERNEL)
case Type::Double: case Type::Double:
@ -213,7 +213,7 @@ inline void JsonValue::serialize(Builder& builder) const
builder.appendff("{}", as_u64()); builder.appendff("{}", as_u64());
break; break;
case Type::Null: case Type::Null:
builder.append("null"); builder.append("null"sv);
break; break;
default: default:
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();

View file

@ -103,9 +103,9 @@ public:
{ {
TRY(begin_item(key)); TRY(begin_item(key));
if constexpr (IsLegacyBuilder<Builder>) if constexpr (IsLegacyBuilder<Builder>)
TRY(m_builder.try_append(value ? "true" : "false")); TRY(m_builder.try_append(value ? "true"sv : "false"sv));
else else
TRY(m_builder.append(value ? "true" : "false")); TRY(m_builder.append(value ? "true"sv : "false"sv));
return {}; return {};
} }
@ -234,11 +234,11 @@ private:
if constexpr (IsLegacyBuilder<Builder>) { if constexpr (IsLegacyBuilder<Builder>) {
TRY(m_builder.try_append('"')); TRY(m_builder.try_append('"'));
TRY(m_builder.try_append_escaped_for_json(key)); TRY(m_builder.try_append_escaped_for_json(key));
TRY(m_builder.try_append("\":")); TRY(m_builder.try_append("\":"sv));
} else { } else {
TRY(m_builder.append('"')); TRY(m_builder.append('"'));
TRY(m_builder.append_escaped_for_json(key)); TRY(m_builder.append_escaped_for_json(key));
TRY(m_builder.append("\":")); TRY(m_builder.append("\":"sv));
} }
return {}; return {};
} }

View file

@ -34,12 +34,12 @@ JsonValue JsonPath::resolve(JsonValue const& top_root) const
String JsonPath::to_string() const String JsonPath::to_string() const
{ {
StringBuilder builder; StringBuilder builder;
builder.append("{ ."); builder.append("{ ."sv);
for (auto const& el : *this) { for (auto const& el : *this) {
builder.append(" > "); builder.append("sv > "sv);
builder.append(el.to_string()); builder.append(el.to_string());
} }
builder.append(" }"); builder.append("sv }"sv);
return builder.to_string(); return builder.to_string();
} }

View file

@ -133,7 +133,7 @@ String LexicalPath::relative_path(StringView a_path, StringView a_prefix)
{ {
if (!a_path.starts_with('/') || !a_prefix.starts_with('/')) { if (!a_path.starts_with('/') || !a_prefix.starts_with('/')) {
// FIXME: This should probably VERIFY or return an Optional<String>. // FIXME: This should probably VERIFY or return an Optional<String>.
return {}; return ""sv;
} }
if (a_path == a_prefix) if (a_path == a_prefix)
@ -171,7 +171,7 @@ LexicalPath LexicalPath::prepend(StringView value) const
LexicalPath LexicalPath::parent() const LexicalPath LexicalPath::parent() const
{ {
return append(".."); return append(".."sv);
} }
} }

View file

@ -45,7 +45,7 @@ template<>
struct AK::Formatter<AK::SourceLocation> : AK::Formatter<FormatString> { struct AK::Formatter<AK::SourceLocation> : AK::Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, AK::SourceLocation location) ErrorOr<void> format(FormatBuilder& builder, AK::SourceLocation location)
{ {
return AK::Formatter<FormatString>::format(builder, "[\x1b[34m{}\x1b[0m @ {}:{}]", location.function_name(), location.filename(), location.line_number()); return AK::Formatter<FormatString>::format(builder, "[\x1b[34m{}\x1b[0m @ {}:{}]"sv, location.function_name(), location.filename(), location.line_number());
} }
}; };

View file

@ -346,13 +346,13 @@ String escape_html_entities(StringView html)
StringBuilder builder; StringBuilder builder;
for (size_t i = 0; i < html.length(); ++i) { for (size_t i = 0; i < html.length(); ++i) {
if (html[i] == '<') if (html[i] == '<')
builder.append("&lt;"); builder.append("&lt;"sv);
else if (html[i] == '>') else if (html[i] == '>')
builder.append("&gt;"); builder.append("&gt;"sv);
else if (html[i] == '&') else if (html[i] == '&')
builder.append("&amp;"); builder.append("&amp;"sv);
else if (html[i] == '"') else if (html[i] == '"')
builder.append("&quot;"); builder.append("&quot;"sv);
else else
builder.append(html[i]); builder.append(html[i]);
} }

View file

@ -180,19 +180,19 @@ ErrorOr<void> StringBuilder::try_append_escaped_for_json(StringView string)
for (auto ch : string) { for (auto ch : string) {
switch (ch) { switch (ch) {
case '\b': case '\b':
TRY(try_append("\\b")); TRY(try_append("\\b"sv));
break; break;
case '\n': case '\n':
TRY(try_append("\\n")); TRY(try_append("\\n"sv));
break; break;
case '\t': case '\t':
TRY(try_append("\\t")); TRY(try_append("\\t"sv));
break; break;
case '\"': case '\"':
TRY(try_append("\\\"")); TRY(try_append("\\\""sv));
break; break;
case '\\': case '\\':
TRY(try_append("\\\\")); TRY(try_append("\\\\"sv));
break; break;
default: default:
if (ch >= 0 && ch <= 0x1f) if (ch >= 0 && ch <= 0x1f)

View file

@ -329,7 +329,7 @@ StringView trim(StringView str, StringView characters, TrimMode mode)
if (mode == TrimMode::Left || mode == TrimMode::Both) { if (mode == TrimMode::Left || mode == TrimMode::Both) {
for (size_t i = 0; i < str.length(); ++i) { for (size_t i = 0; i < str.length(); ++i) {
if (substring_length == 0) if (substring_length == 0)
return ""; return ""sv;
if (!characters.contains(str[i])) if (!characters.contains(str[i]))
break; break;
++substring_start; ++substring_start;
@ -340,7 +340,7 @@ StringView trim(StringView str, StringView characters, TrimMode mode)
if (mode == TrimMode::Right || mode == TrimMode::Both) { if (mode == TrimMode::Right || mode == TrimMode::Both) {
for (size_t i = str.length() - 1; i > 0; --i) { for (size_t i = str.length() - 1; i > 0; --i) {
if (substring_length == 0) if (substring_length == 0)
return ""; return ""sv;
if (!characters.contains(str[i])) if (!characters.contains(str[i]))
break; break;
--substring_length; --substring_length;
@ -352,7 +352,7 @@ StringView trim(StringView str, StringView characters, TrimMode mode)
StringView trim_whitespace(StringView str, TrimMode mode) StringView trim_whitespace(StringView str, TrimMode mode)
{ {
return trim(str, " \n\t\v\f\r", mode); return trim(str, " \n\t\v\f\r"sv, mode);
} }
Optional<size_t> find(StringView haystack, char needle, size_t start) Optional<size_t> find(StringView haystack, char needle, size_t start)

View file

@ -221,7 +221,7 @@ String URL::serialize_data_url() const
builder.append(':'); builder.append(':');
builder.append(m_data_mime_type); builder.append(m_data_mime_type);
if (m_data_payload_is_base64) if (m_data_payload_is_base64)
builder.append(";base64"); builder.append(";base64"sv);
builder.append(','); builder.append(',');
// NOTE: The specification does not say anything about encoding this, but we should encode at least control and non-ASCII // NOTE: The specification does not say anything about encoding this, but we should encode at least control and non-ASCII
// characters (since this is also a valid representation of the same data URL). // characters (since this is also a valid representation of the same data URL).
@ -239,7 +239,7 @@ String URL::serialize(ExcludeFragment exclude_fragment) const
builder.append(':'); builder.append(':');
if (!m_host.is_null()) { if (!m_host.is_null()) {
builder.append("//"); builder.append("//"sv);
if (includes_credentials()) { if (includes_credentials()) {
builder.append(percent_encode(m_username, PercentEncodeSet::Userinfo)); builder.append(percent_encode(m_username, PercentEncodeSet::Userinfo));
@ -259,7 +259,7 @@ String URL::serialize(ExcludeFragment exclude_fragment) const
builder.append(percent_encode(m_paths[0], PercentEncodeSet::Path)); builder.append(percent_encode(m_paths[0], PercentEncodeSet::Path));
} else { } else {
if (m_host.is_null() && m_paths.size() > 1 && m_paths[0].is_empty()) if (m_host.is_null() && m_paths.size() > 1 && m_paths[0].is_empty())
builder.append("/."); builder.append("/."sv);
for (auto& segment : m_paths) { for (auto& segment : m_paths) {
builder.append('/'); builder.append('/');
builder.append(percent_encode(segment, PercentEncodeSet::Path)); builder.append(percent_encode(segment, PercentEncodeSet::Path));
@ -293,7 +293,7 @@ String URL::serialize_for_display() const
builder.append(':'); builder.append(':');
if (!m_host.is_null()) { if (!m_host.is_null()) {
builder.append("//"); builder.append("//"sv);
builder.append(m_host); builder.append(m_host);
if (m_port.has_value()) if (m_port.has_value())
builder.appendff(":{}", *m_port); builder.appendff(":{}", *m_port);
@ -303,7 +303,7 @@ String URL::serialize_for_display() const
builder.append(percent_encode(m_paths[0], PercentEncodeSet::Path)); builder.append(percent_encode(m_paths[0], PercentEncodeSet::Path));
} else { } else {
if (m_host.is_null() && m_paths.size() > 1 && m_paths[0].is_empty()) if (m_host.is_null() && m_paths.size() > 1 && m_paths[0].is_empty())
builder.append("/."); builder.append("/."sv);
for (auto& segment : m_paths) { for (auto& segment : m_paths) {
builder.append('/'); builder.append('/');
builder.append(percent_encode(segment, PercentEncodeSet::Path)); builder.append(percent_encode(segment, PercentEncodeSet::Path));

View file

@ -155,18 +155,18 @@ static String percent_encode_after_encoding(StringView input, URL::PercentEncode
Optional<URL> URLParser::parse_data_url(StringView raw_input) Optional<URL> URLParser::parse_data_url(StringView raw_input)
{ {
dbgln_if(URL_PARSER_DEBUG, "URLParser::parse_data_url: Parsing '{}'.", raw_input); dbgln_if(URL_PARSER_DEBUG, "URLParser::parse_data_url: Parsing '{}'.", raw_input);
VERIFY(raw_input.starts_with("data:")); VERIFY(raw_input.starts_with("data:"sv));
auto input = raw_input.substring_view(5); auto input = raw_input.substring_view(5);
auto comma_offset = input.find(','); auto comma_offset = input.find(',');
if (!comma_offset.has_value()) if (!comma_offset.has_value())
return {}; return {};
auto mime_type = StringUtils::trim(input.substring_view(0, comma_offset.value()), "\t\n\f\r ", TrimMode::Both); auto mime_type = StringUtils::trim(input.substring_view(0, comma_offset.value()), "\t\n\f\r "sv, TrimMode::Both);
auto encoded_body = input.substring_view(comma_offset.value() + 1); auto encoded_body = input.substring_view(comma_offset.value() + 1);
auto body = URL::percent_decode(encoded_body); auto body = URL::percent_decode(encoded_body);
bool is_base64_encoded = false; bool is_base64_encoded = false;
if (mime_type.ends_with("base64", CaseSensitivity::CaseInsensitive)) { if (mime_type.ends_with("base64"sv, CaseSensitivity::CaseInsensitive)) {
auto substring_view = mime_type.substring_view(0, mime_type.length() - 6); auto substring_view = mime_type.substring_view(0, mime_type.length() - 6);
auto trimmed_substring_view = StringUtils::trim(substring_view, " ", TrimMode::Right); auto trimmed_substring_view = StringUtils::trim(substring_view, " "sv, TrimMode::Right);
if (trimmed_substring_view.ends_with(';')) { if (trimmed_substring_view.ends_with(';')) {
is_base64_encoded = true; is_base64_encoded = true;
mime_type = trimmed_substring_view.substring_view(0, trimmed_substring_view.length() - 1); mime_type = trimmed_substring_view.substring_view(0, trimmed_substring_view.length() - 1);
@ -174,14 +174,14 @@ Optional<URL> URLParser::parse_data_url(StringView raw_input)
} }
StringBuilder builder; StringBuilder builder;
if (mime_type.starts_with(";") || mime_type.is_empty()) { if (mime_type.starts_with(";"sv) || mime_type.is_empty()) {
builder.append("text/plain"); builder.append("text/plain"sv);
builder.append(mime_type); builder.append(mime_type);
mime_type = builder.string_view(); mime_type = builder.string_view();
} }
// FIXME: Parse the MIME type's components according to https://mimesniff.spec.whatwg.org/#parse-a-mime-type // FIXME: Parse the MIME type's components according to https://mimesniff.spec.whatwg.org/#parse-a-mime-type
URL url { StringUtils::trim(mime_type, "\n\r\t ", TrimMode::Both), move(body), is_base64_encoded }; URL url { StringUtils::trim(mime_type, "\n\r\t "sv, TrimMode::Both), move(body), is_base64_encoded };
dbgln_if(URL_PARSER_DEBUG, "URLParser::parse_data_url: Parsed data URL to be '{}'.", url.serialize()); dbgln_if(URL_PARSER_DEBUG, "URLParser::parse_data_url: Parsed data URL to be '{}'.", url.serialize());
return url; return url;
} }
@ -202,7 +202,7 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> ur
if (raw_input.is_empty()) if (raw_input.is_empty())
return {}; return {};
if (raw_input.starts_with("data:")) { if (raw_input.starts_with("data:"sv)) {
auto maybe_url = parse_data_url(raw_input); auto maybe_url = parse_data_url(raw_input);
if (!maybe_url.has_value()) if (!maybe_url.has_value())
return {}; return {};
@ -243,9 +243,9 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> ur
String processed_input = raw_input.substring_view(start_index, end_index - start_index); String processed_input = raw_input.substring_view(start_index, end_index - start_index);
// NOTE: This replaces all tab and newline characters with nothing. // NOTE: This replaces all tab and newline characters with nothing.
if (processed_input.contains("\t") || processed_input.contains("\n")) { if (processed_input.contains("\t"sv) || processed_input.contains("\n"sv)) {
report_validation_error(); report_validation_error();
processed_input = processed_input.replace("\t", "", ReplaceMode::All).replace("\n", "", ReplaceMode::All); processed_input = processed_input.replace("\t"sv, ""sv, ReplaceMode::All).replace("\n"sv, ""sv, ReplaceMode::All);
} }
State state = state_override.value_or(State::SchemeStart); State state = state_override.value_or(State::SchemeStart);
@ -295,7 +295,7 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> ur
url->m_scheme = buffer.to_string(); url->m_scheme = buffer.to_string();
buffer.clear(); buffer.clear();
if (url->scheme() == "file") { if (url->scheme() == "file") {
if (!get_remaining().starts_with("//")) { if (!get_remaining().starts_with("//"sv)) {
report_validation_error(); report_validation_error();
} }
state = State::File; state = State::File;
@ -304,7 +304,7 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> ur
state = State::SpecialRelativeOrAuthority; state = State::SpecialRelativeOrAuthority;
else else
state = State::SpecialAuthoritySlashes; state = State::SpecialAuthoritySlashes;
} else if (get_remaining().starts_with("/")) { } else if (get_remaining().starts_with("/"sv)) {
state = State::PathOrAuthority; state = State::PathOrAuthority;
++iterator; ++iterator;
} else { } else {
@ -339,7 +339,7 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> ur
} }
break; break;
case State::SpecialRelativeOrAuthority: case State::SpecialRelativeOrAuthority:
if (code_point == '/' && get_remaining().starts_with("/")) { if (code_point == '/' && get_remaining().starts_with("/"sv)) {
state = State::SpecialAuthorityIgnoreSlashes; state = State::SpecialAuthorityIgnoreSlashes;
++iterator; ++iterator;
} else { } else {
@ -403,7 +403,7 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> ur
} }
break; break;
case State::SpecialAuthoritySlashes: case State::SpecialAuthoritySlashes:
if (code_point == '/' && get_remaining().starts_with("/")) { if (code_point == '/' && get_remaining().starts_with("/"sv)) {
state = State::SpecialAuthorityIgnoreSlashes; state = State::SpecialAuthorityIgnoreSlashes;
++iterator; ++iterator;
} else { } else {
@ -426,7 +426,7 @@ URL URLParser::parse(StringView raw_input, URL const* base_url, Optional<URL> ur
if (at_sign_seen) { if (at_sign_seen) {
auto content = buffer.to_string(); auto content = buffer.to_string();
buffer.clear(); buffer.clear();
buffer.append("%40"); buffer.append("%40"sv);
buffer.append(content); buffer.append(content);
} }
at_sign_seen = true; at_sign_seen = true;

View file

@ -148,6 +148,6 @@ template<>
struct AK::Formatter<IOAddress> : AK::Formatter<FormatString> { struct AK::Formatter<IOAddress> : AK::Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, IOAddress value) ErrorOr<void> format(FormatBuilder& builder, IOAddress value)
{ {
return Formatter<FormatString>::format(builder, "IO {:x}", value.get()); return Formatter<FormatString>::format(builder, "IO {:x}"sv, value.get());
} }
}; };

View file

@ -42,8 +42,8 @@ public:
void set_apic_id(u32 apic_id) { m_apic_id = apic_id; } void set_apic_id(u32 apic_id) { m_apic_id = apic_id; }
static constexpr StringView s_amd_vendor_id = "AuthenticAMD"; static constexpr StringView s_amd_vendor_id = "AuthenticAMD"sv;
static constexpr StringView s_intel_vendor_id = "GenuineIntel"; static constexpr StringView s_intel_vendor_id = "GenuineIntel"sv;
private: private:
static NonnullOwnPtr<KString> build_vendor_id_string(); static NonnullOwnPtr<KString> build_vendor_id_string();

View file

@ -126,7 +126,7 @@ UNMAP_AFTER_INIT PhysicalAddress InterruptManagement::search_for_madt()
auto rsdp = ACPI::StaticParsing::find_rsdp(); auto rsdp = ACPI::StaticParsing::find_rsdp();
if (!rsdp.has_value()) if (!rsdp.has_value())
return {}; return {};
auto apic = ACPI::StaticParsing::find_table(rsdp.value(), "APIC"); auto apic = ACPI::StaticParsing::find_table(rsdp.value(), "APIC"sv);
if (!apic.has_value()) if (!apic.has_value())
return {}; return {};
return apic.value(); return apic.value();

View file

@ -74,7 +74,7 @@ UNMAP_AFTER_INIT bool Access::find_and_register_pci_host_bridges_from_acpi_mcfg_
dbgln("Failed to round up length of {} to pages", length); dbgln("Failed to round up length of {} to pages", length);
return false; return false;
} }
auto mcfg_region_or_error = MM.allocate_kernel_region(mcfg_table.page_base(), region_size_or_error.value(), "PCI Parsing MCFG", Memory::Region::Access::ReadWrite); auto mcfg_region_or_error = MM.allocate_kernel_region(mcfg_table.page_base(), region_size_or_error.value(), "PCI Parsing MCFG"sv, Memory::Region::Access::ReadWrite);
if (mcfg_region_or_error.is_error()) if (mcfg_region_or_error.is_error())
return false; return false;
auto& mcfg = *(ACPI::Structures::MCFG*)mcfg_region_or_error.value()->vaddr().offset(mcfg_table.offset_in_page()).as_ptr(); auto& mcfg = *(ACPI::Structures::MCFG*)mcfg_region_or_error.value()->vaddr().offset(mcfg_table.offset_in_page()).as_ptr();

View file

@ -69,7 +69,7 @@ void MemoryBackedHostBridge::map_bus_region(BusNumber bus)
if (m_mapped_bus == bus && m_mapped_bus_region) if (m_mapped_bus == bus && m_mapped_bus_region)
return; return;
auto bus_base_address = determine_memory_mapped_bus_base_address(bus); auto bus_base_address = determine_memory_mapped_bus_base_address(bus);
auto region_or_error = MM.allocate_kernel_region(bus_base_address, memory_range_per_bus, "PCI ECAM", Memory::Region::Access::ReadWrite); auto region_or_error = MM.allocate_kernel_region(bus_base_address, memory_range_per_bus, "PCI ECAM"sv, Memory::Region::Access::ReadWrite);
// FIXME: Find a way to propagate error from here. // FIXME: Find a way to propagate error from here.
if (region_or_error.is_error()) if (region_or_error.is_error())
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();

View file

@ -300,7 +300,7 @@ struct AK::Formatter<Kernel::PCI::Address> : Formatter<FormatString> {
{ {
return Formatter<FormatString>::format( return Formatter<FormatString>::format(
builder, builder,
"PCI [{:04x}:{:02x}:{:02x}:{:02x}]", value.domain(), value.bus(), value.device(), value.function()); "PCI [{:04x}:{:02x}:{:02x}:{:02x}]"sv, value.domain(), value.bus(), value.device(), value.function());
} }
}; };
@ -310,6 +310,6 @@ struct AK::Formatter<Kernel::PCI::HardwareID> : Formatter<FormatString> {
{ {
return Formatter<FormatString>::format( return Formatter<FormatString>::format(
builder, builder,
"PCI::HardwareID [{:04x}:{:04x}]", value.vendor_id, value.device_id); "PCI::HardwareID [{:04x}:{:04x}]"sv, value.vendor_id, value.device_id);
} }
}; };

View file

@ -24,7 +24,7 @@ static bool test_pci_io();
UNMAP_AFTER_INIT static PCIAccessLevel detect_optimal_access_type() UNMAP_AFTER_INIT static PCIAccessLevel detect_optimal_access_type()
{ {
auto boot_determined = kernel_command_line().pci_access_level(); auto boot_determined = kernel_command_line().pci_access_level();
if (!ACPI::is_enabled() || !ACPI::Parser::the()->find_table("MCFG").has_value()) if (!ACPI::is_enabled() || !ACPI::Parser::the()->find_table("MCFG"sv).has_value())
return PCIAccessLevel::IOAddressing; return PCIAccessLevel::IOAddressing;
if (boot_determined != PCIAccessLevel::IOAddressing) if (boot_determined != PCIAccessLevel::IOAddressing)
@ -44,7 +44,7 @@ UNMAP_AFTER_INIT void initialize()
return; return;
switch (detect_optimal_access_type()) { switch (detect_optimal_access_type()) {
case PCIAccessLevel::MemoryAddressing: { case PCIAccessLevel::MemoryAddressing: {
auto mcfg = ACPI::Parser::the()->find_table("MCFG"); auto mcfg = ACPI::Parser::the()->find_table("MCFG"sv);
VERIFY(mcfg.has_value()); VERIFY(mcfg.has_value());
auto success = Access::initialize_for_multiple_pci_domains(mcfg.value()); auto success = Access::initialize_for_multiple_pci_domains(mcfg.value());
VERIFY(success); VERIFY(success);

View file

@ -105,7 +105,7 @@ ErrorOr<void> UHCIController::reset()
} }
// Let's allocate the physical page for the Frame List (which is 4KiB aligned) // Let's allocate the physical page for the Frame List (which is 4KiB aligned)
m_framelist = TRY(MM.allocate_dma_buffer_page("UHCI Framelist", Memory::Region::Access::Write)); m_framelist = TRY(MM.allocate_dma_buffer_page("UHCI Framelist"sv, Memory::Region::Access::Write));
dbgln("UHCI: Allocated framelist at physical address {}", m_framelist->physical_page(0)->paddr()); dbgln("UHCI: Allocated framelist at physical address {}", m_framelist->physical_page(0)->paddr());
dbgln("UHCI: Framelist is at virtual address {}", m_framelist->vaddr()); dbgln("UHCI: Framelist is at virtual address {}", m_framelist->vaddr());
write_sofmod(64); // 1mS frame time write_sofmod(64); // 1mS frame time
@ -139,7 +139,7 @@ UNMAP_AFTER_INIT ErrorOr<void> UHCIController::create_structures()
// Now the Transfer Descriptor pool // Now the Transfer Descriptor pool
m_transfer_descriptor_pool = TRY(UHCIDescriptorPool<TransferDescriptor>::try_create("Transfer Descriptor Pool"sv)); m_transfer_descriptor_pool = TRY(UHCIDescriptorPool<TransferDescriptor>::try_create("Transfer Descriptor Pool"sv));
m_isochronous_transfer_pool = TRY(MM.allocate_dma_buffer_page("UHCI Isochronous Descriptor Pool", Memory::Region::Access::ReadWrite)); m_isochronous_transfer_pool = TRY(MM.allocate_dma_buffer_page("UHCI Isochronous Descriptor Pool"sv, Memory::Region::Access::ReadWrite));
// Set up the Isochronous Transfer Descriptor list // Set up the Isochronous Transfer Descriptor list
m_iso_td_list.resize(UHCI_NUMBER_OF_ISOCHRONOUS_TDS); m_iso_td_list.resize(UHCI_NUMBER_OF_ISOCHRONOUS_TDS);
@ -509,7 +509,7 @@ size_t UHCIController::poll_transfer_queue(QueueHead& transfer_queue)
ErrorOr<void> UHCIController::spawn_port_process() ErrorOr<void> UHCIController::spawn_port_process()
{ {
RefPtr<Thread> usb_hotplug_thread; RefPtr<Thread> usb_hotplug_thread;
(void)Process::create_kernel_process(usb_hotplug_thread, TRY(KString::try_create("UHCI Hot Plug Task")), [&] { (void)Process::create_kernel_process(usb_hotplug_thread, TRY(KString::try_create("UHCI Hot Plug Task"sv)), [&] {
for (;;) { for (;;) {
if (m_root_hub) if (m_root_hub)
m_root_hub->check_for_port_updates(); m_root_hub->check_for_port_updates();

View file

@ -30,7 +30,7 @@ class UHCIDescriptorPool {
public: public:
static ErrorOr<NonnullOwnPtr<UHCIDescriptorPool<T>>> try_create(StringView name) static ErrorOr<NonnullOwnPtr<UHCIDescriptorPool<T>>> try_create(StringView name)
{ {
auto pool_memory_block = TRY(MM.allocate_kernel_region(PAGE_SIZE, "UHCI Descriptor Pool", Memory::Region::Access::ReadWrite)); auto pool_memory_block = TRY(MM.allocate_kernel_region(PAGE_SIZE, "UHCI Descriptor Pool"sv, Memory::Region::Access::ReadWrite));
return adopt_nonnull_own_or_enomem(new (nothrow) UHCIDescriptorPool(move(pool_memory_block), name)); return adopt_nonnull_own_or_enomem(new (nothrow) UHCIDescriptorPool(move(pool_memory_block), name));
} }

View file

@ -14,7 +14,7 @@ namespace Kernel::USB {
ErrorOr<NonnullOwnPtr<Pipe>> Pipe::try_create_pipe(USBController const& controller, Type type, Direction direction, u8 endpoint_address, u16 max_packet_size, i8 device_address, u8 poll_interval) ErrorOr<NonnullOwnPtr<Pipe>> Pipe::try_create_pipe(USBController const& controller, Type type, Direction direction, u8 endpoint_address, u16 max_packet_size, i8 device_address, u8 poll_interval)
{ {
auto dma_region = TRY(MM.allocate_kernel_region(PAGE_SIZE, "USB device DMA buffer", Memory::Region::Access::ReadWrite)); auto dma_region = TRY(MM.allocate_kernel_region(PAGE_SIZE, "USB device DMA buffer"sv, Memory::Region::Access::ReadWrite));
return adopt_nonnull_own_or_enomem(new (nothrow) Pipe(controller, type, direction, endpoint_address, max_packet_size, poll_interval, device_address, move(dma_region))); return adopt_nonnull_own_or_enomem(new (nothrow) Pipe(controller, type, direction, endpoint_address, max_packet_size, poll_interval, device_address, move(dma_region)));
} }

View file

@ -79,7 +79,7 @@ private:
u8 m_poll_interval { 0 }; // Polling interval (in frames) u8 m_poll_interval { 0 }; // Polling interval (in frames)
bool m_data_toggle { false }; // Data toggle for stuffing bit bool m_data_toggle { false }; // Data toggle for stuffing bit
Mutex m_dma_buffer_lock { "USB pipe mutex" }; Mutex m_dma_buffer_lock { "USB pipe mutex"sv };
NonnullOwnPtr<Memory::Region> m_dma_buffer; NonnullOwnPtr<Memory::Region> m_dma_buffer;
}; };

View file

@ -136,7 +136,7 @@ UNMAP_AFTER_INIT void Device::initialize()
dbgln_if(VIRTIO_DEBUG, "{}: Failed to round up size={} to pages", m_class_name, mapping.size); dbgln_if(VIRTIO_DEBUG, "{}: Failed to round up size={} to pages", m_class_name, mapping.size);
continue; continue;
} }
auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR(pci_address(), cfg.bar))), region_size_or_error.value(), "VirtIO MMIO", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No); auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR(pci_address(), cfg.bar))), region_size_or_error.value(), "VirtIO MMIO"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No);
if (region_or_error.is_error()) { if (region_or_error.is_error()) {
dbgln_if(VIRTIO_DEBUG, "{}: Failed to map bar {} - (size={}) {}", m_class_name, cfg.bar, mapping.size, region_or_error.error()); dbgln_if(VIRTIO_DEBUG, "{}: Failed to map bar {} - (size={}) {}", m_class_name, cfg.bar, mapping.size, region_or_error.error());
} else { } else {

View file

@ -25,7 +25,7 @@ UNMAP_AFTER_INIT void RNG::initialize()
} }
if (success) { if (success) {
finish_init(); finish_init();
m_entropy_buffer = MM.allocate_contiguous_kernel_region(PAGE_SIZE, "VirtIO::RNG", Memory::Region::Access::ReadWrite).release_value(); m_entropy_buffer = MM.allocate_contiguous_kernel_region(PAGE_SIZE, "VirtIO::RNG"sv, Memory::Region::Access::ReadWrite).release_value();
if (m_entropy_buffer) { if (m_entropy_buffer) {
memset(m_entropy_buffer->vaddr().as_ptr(), 0, m_entropy_buffer->size()); memset(m_entropy_buffer->vaddr().as_ptr(), 0, m_entropy_buffer->size());
request_entropy_from_host(); request_entropy_from_host();

View file

@ -13,7 +13,7 @@
namespace Kernel { namespace Kernel {
static char s_cmd_line[1024]; static char s_cmd_line[1024];
static constexpr StringView s_embedded_cmd_line = ""; static constexpr StringView s_embedded_cmd_line = ""sv;
static CommandLine* s_the; static CommandLine* s_the;
UNMAP_AFTER_INIT void CommandLine::early_initialize(char const* cmd_line) UNMAP_AFTER_INIT void CommandLine::early_initialize(char const* cmd_line)

View file

@ -67,7 +67,7 @@ ErrorOr<Memory::Region*> MemoryDevice::mmap(Process& process, OpenFileDescriptio
range, range,
move(vmobject), move(vmobject),
0, 0,
"Mapped Physical Memory", "Mapped Physical Memory"sv,
prot, prot,
shared); shared);
} }

View file

@ -31,10 +31,10 @@ private:
}; };
static constexpr BoardDefinition board_definitions[4] = { static constexpr BoardDefinition board_definitions[4] = {
{ { PCI::VendorID::WCH, 0x3253 }, "WCH CH382 2S", 2, 0, 0xC0, 8, SerialDevice::Baud::Baud115200 }, { { PCI::VendorID::WCH, 0x3253 }, "WCH CH382 2S"sv, 2, 0, 0xC0, 8, SerialDevice::Baud::Baud115200 },
{ { PCI::VendorID::RedHat, 0x0002 }, "QEMU PCI 16550A", 1, 0, 0, 8, SerialDevice::Baud::Baud115200 }, { { PCI::VendorID::RedHat, 0x0002 }, "QEMU PCI 16550A"sv, 1, 0, 0, 8, SerialDevice::Baud::Baud115200 },
{ { PCI::VendorID::RedHat, 0x0003 }, "QEMU PCI Dual-port 16550A", 2, 0, 0, 8, SerialDevice::Baud::Baud115200 }, { { PCI::VendorID::RedHat, 0x0003 }, "QEMU PCI Dual-port 16550A"sv, 2, 0, 0, 8, SerialDevice::Baud::Baud115200 },
{ { PCI::VendorID::RedHat, 0x0004 }, "QEMU PCI Quad-port 16550A", 4, 0, 0, 8, SerialDevice::Baud::Baud115200 } { { PCI::VendorID::RedHat, 0x0004 }, "QEMU PCI Quad-port 16550A"sv, 4, 0, 0, 8, SerialDevice::Baud::Baud115200 }
}; };
}; };

View file

@ -72,7 +72,7 @@ private:
size_t m_read_buffer_index { 0 }; size_t m_read_buffer_index { 0 };
size_t m_space_for_writing { 0 }; size_t m_space_for_writing { 0 };
bool m_empty { true }; bool m_empty { true };
mutable Mutex m_lock { "DoubleBuffer" }; mutable Mutex m_lock { "DoubleBuffer"sv };
}; };
} }

View file

@ -103,8 +103,8 @@ ErrorOr<void> DevPtsFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSy
if (identifier().index() > 1) if (identifier().index() > 1)
return ENOTDIR; return ENOTDIR;
TRY(callback({ ".", identifier(), 0 })); TRY(callback({ "."sv, identifier(), 0 }));
TRY(callback({ "..", identifier(), 0 })); TRY(callback({ ".."sv, identifier(), 0 }));
return SlavePTY::all_instances().with([&](auto& list) -> ErrorOr<void> { return SlavePTY::all_instances().with([&](auto& list) -> ErrorOr<void> {
StringBuilder builder; StringBuilder builder;

View file

@ -205,8 +205,8 @@ DevTmpFSDirectoryInode::~DevTmpFSDirectoryInode() = default;
ErrorOr<void> DevTmpFSDirectoryInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const ErrorOr<void> DevTmpFSDirectoryInode::traverse_as_directory(Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{ {
MutexLocker locker(m_inode_lock); MutexLocker locker(m_inode_lock);
TRY(callback({ ".", identifier(), 0 })); TRY(callback({ "."sv, identifier(), 0 }));
TRY(callback({ "..", identifier(), 0 })); TRY(callback({ ".."sv, identifier(), 0 }));
for (auto& node : m_nodes) { for (auto& node : m_nodes) {
InodeIdentifier identifier = { fsid(), node.index() }; InodeIdentifier identifier = { fsid(), node.index() };
TRY(callback({ node.name(), identifier, 0 })); TRY(callback({ node.name(), identifier, 0 }));

View file

@ -153,7 +153,7 @@ class DevTmpFSRootDirectoryInode final : public DevTmpFSDirectoryInode {
public: public:
virtual ~DevTmpFSRootDirectoryInode() override; virtual ~DevTmpFSRootDirectoryInode() override;
virtual StringView name() const override { return "."; } virtual StringView name() const override { return "."sv; }
private: private:
// ^DevTmpFSInode // ^DevTmpFSInode

View file

@ -41,7 +41,7 @@ ErrorOr<NonnullRefPtr<OpenFileDescription>> FIFO::open_direction_blocking(FIFO::
if (m_writers == 0) { if (m_writers == 0) {
locker.unlock(); locker.unlock();
m_write_open_queue.wait_forever("FIFO"); m_write_open_queue.wait_forever("FIFO"sv);
locker.lock(); locker.lock();
} }
} }
@ -51,7 +51,7 @@ ErrorOr<NonnullRefPtr<OpenFileDescription>> FIFO::open_direction_blocking(FIFO::
if (m_readers == 0) { if (m_readers == 0) {
locker.unlock(); locker.unlock();
m_read_open_queue.wait_forever("FIFO"); m_read_open_queue.wait_forever("FIFO"sv);
locker.lock(); locker.lock();
} }
} }

View file

@ -67,7 +67,7 @@ protected:
void set_block_size(u64 size) { m_block_size = size; } void set_block_size(u64 size) { m_block_size = size; }
void set_fragment_size(size_t size) { m_fragment_size = size; } void set_fragment_size(size_t size) { m_fragment_size = size; }
mutable Mutex m_lock { "FS" }; mutable Mutex m_lock { "FS"sv };
private: private:
FileSystemID m_fsid; FileSystemID m_fsid;

View file

@ -239,7 +239,7 @@ ErrorOr<void> ISO9660FS::parse_volume_set()
} }
auto const* header = reinterpret_cast<ISO::VolumeDescriptorHeader const*>(block->data()); auto const* header = reinterpret_cast<ISO::VolumeDescriptorHeader const*>(block->data());
if (StringView { header->identifier, 5 } != "CD001") { if (StringView { header->identifier, 5 } != "CD001"sv) {
dbgln_if(ISO9660_DEBUG, "Header magic at volume descriptor {} is not valid", current_block_index - first_data_area_block); dbgln_if(ISO9660_DEBUG, "Header magic at volume descriptor {} is not valid", current_block_index - first_data_area_block);
return EIO; return EIO;
} }

View file

@ -109,7 +109,7 @@ protected:
void did_modify_contents(); void did_modify_contents();
void did_delete_self(); void did_delete_self();
mutable Mutex m_inode_lock { "Inode" }; mutable Mutex m_inode_lock { "Inode"sv };
private: private:
FileSystem& m_file_system; FileSystem& m_file_system;

View file

@ -56,6 +56,6 @@ template<>
struct AK::Formatter<Kernel::InodeIdentifier> : AK::Formatter<FormatString> { struct AK::Formatter<Kernel::InodeIdentifier> : AK::Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, Kernel::InodeIdentifier value) ErrorOr<void> format(FormatBuilder& builder, Kernel::InodeIdentifier value)
{ {
return AK::Formatter<FormatString>::format(builder, "{}:{}", value.fsid(), value.index()); return AK::Formatter<FormatString>::format(builder, "{}:{}"sv, value.fsid(), value.index());
} }
}; };

View file

@ -201,7 +201,7 @@ ErrorOr<void> Plan9FS::initialize()
ensure_thread(); ensure_thread();
Message version_message { *this, Message::Type::Tversion }; Message version_message { *this, Message::Type::Tversion };
version_message << (u32)m_max_message_size << "9P2000.L"; version_message << (u32)m_max_message_size << "9P2000.L"sv;
TRY(post_message_and_wait_for_a_reply(version_message)); TRY(post_message_and_wait_for_a_reply(version_message));
@ -218,8 +218,8 @@ ErrorOr<void> Plan9FS::initialize()
Message attach_message { *this, Message::Type::Tattach }; Message attach_message { *this, Message::Type::Tattach };
// FIXME: This needs a user name and an "export" name; but how do we get them? // FIXME: This needs a user name and an "export" name; but how do we get them?
// Perhaps initialize() should accept a string of FS-specific options... // Perhaps initialize() should accept a string of FS-specific options...
attach_message << root_fid << (u32)-1 << "sergey" attach_message << root_fid << (u32)-1 << "sergey"sv
<< "/"; << "/"sv;
if (m_remote_protocol_version >= ProtocolVersion::v9P2000u) if (m_remote_protocol_version >= ProtocolVersion::v9P2000u)
attach_message << (u32)-1; attach_message << (u32)-1;
@ -653,7 +653,7 @@ void Plan9FS::ensure_thread()
{ {
SpinlockLocker lock(m_thread_lock); SpinlockLocker lock(m_thread_lock);
if (!m_thread_running.exchange(true, AK::MemoryOrder::memory_order_acq_rel)) { if (!m_thread_running.exchange(true, AK::MemoryOrder::memory_order_acq_rel)) {
auto process_name = KString::try_create("Plan9FS"); auto process_name = KString::try_create("Plan9FS"sv);
if (process_name.is_error()) if (process_name.is_error())
TODO(); TODO();
(void)Process::create_kernel_process(m_thread, process_name.release_value(), [&]() { (void)Process::create_kernel_process(m_thread, process_name.release_value(), [&]() {

View file

@ -135,7 +135,7 @@ private:
ProtocolVersion m_remote_protocol_version { ProtocolVersion::v9P2000 }; ProtocolVersion m_remote_protocol_version { ProtocolVersion::v9P2000 };
size_t m_max_message_size { 4 * KiB }; size_t m_max_message_size { 4 * KiB };
Mutex m_send_lock { "Plan9FS send" }; Mutex m_send_lock { "Plan9FS send"sv };
Plan9FSBlockerSet m_completion_blocker; Plan9FSBlockerSet m_completion_blocker;
HashMap<u16, NonnullRefPtr<ReceiveCompletion>> m_completions; HashMap<u16, NonnullRefPtr<ReceiveCompletion>> m_completions;

View file

@ -35,8 +35,8 @@ ErrorOr<void> SysFSDirectory::traverse_as_directory(FileSystemID fsid, Function<
{ {
MutexLocker locker(SysFSComponentRegistry::the().get_lock()); MutexLocker locker(SysFSComponentRegistry::the().get_lock());
VERIFY(m_parent_directory); VERIFY(m_parent_directory);
TRY(callback({ ".", { fsid, component_index() }, 0 })); TRY(callback({ "."sv, { fsid, component_index() }, 0 }));
TRY(callback({ "..", { fsid, m_parent_directory->component_index() }, 0 })); TRY(callback({ ".."sv, { fsid, m_parent_directory->component_index() }, 0 }));
for (auto& component : m_components) { for (auto& component : m_components) {
InodeIdentifier identifier = { fsid, component.component_index() }; InodeIdentifier identifier = { fsid, component.component_index() };

View file

@ -20,8 +20,8 @@ NonnullRefPtr<SysFSRootDirectory> SysFSRootDirectory::create()
ErrorOr<void> SysFSRootDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const ErrorOr<void> SysFSRootDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{ {
MutexLocker locker(SysFSComponentRegistry::the().get_lock()); MutexLocker locker(SysFSComponentRegistry::the().get_lock());
TRY(callback({ ".", { fsid, component_index() }, 0 })); TRY(callback({ "."sv, { fsid, component_index() }, 0 }));
TRY(callback({ "..", { fsid, 0 }, 0 })); TRY(callback({ ".."sv, { fsid, 0 }, 0 }));
for (auto const& component : m_components) { for (auto const& component : m_components) {
InodeIdentifier identifier = { fsid, component.component_index() }; InodeIdentifier identifier = { fsid, component.component_index() };

View file

@ -17,8 +17,8 @@ ErrorOr<void> SysFSUSBBusDirectory::traverse_as_directory(FileSystemID fsid, Fun
SpinlockLocker lock(m_lock); SpinlockLocker lock(m_lock);
// Note: if the parent directory is null, it means something bad happened as this should not happen for the USB directory. // Note: if the parent directory is null, it means something bad happened as this should not happen for the USB directory.
VERIFY(m_parent_directory); VERIFY(m_parent_directory);
TRY(callback({ ".", { fsid, component_index() }, 0 })); TRY(callback({ "."sv, { fsid, component_index() }, 0 }));
TRY(callback({ "..", { fsid, m_parent_directory->component_index() }, 0 })); TRY(callback({ ".."sv, { fsid, m_parent_directory->component_index() }, 0 }));
for (auto const& device_node : m_device_nodes) { for (auto const& device_node : m_device_nodes) {
InodeIdentifier identifier = { fsid, device_node.component_index() }; InodeIdentifier identifier = { fsid, device_node.component_index() };

View file

@ -26,56 +26,56 @@ ErrorOr<void> SysFSUSBDeviceInformation::try_generate(KBufferBuilder& builder)
auto array = TRY(JsonArraySerializer<>::try_create(builder)); auto array = TRY(JsonArraySerializer<>::try_create(builder));
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
TRY(obj.add("device_address", m_device->address())); TRY(obj.add("device_address"sv, m_device->address()));
TRY(obj.add("usb_spec_compliance_bcd", m_device->device_descriptor().usb_spec_compliance_bcd)); TRY(obj.add("usb_spec_compliance_bcd"sv, m_device->device_descriptor().usb_spec_compliance_bcd));
TRY(obj.add("device_class", m_device->device_descriptor().device_class)); TRY(obj.add("device_class"sv, m_device->device_descriptor().device_class));
TRY(obj.add("device_sub_class", m_device->device_descriptor().device_sub_class)); TRY(obj.add("device_sub_class"sv, m_device->device_descriptor().device_sub_class));
TRY(obj.add("device_protocol", m_device->device_descriptor().device_protocol)); TRY(obj.add("device_protocol"sv, m_device->device_descriptor().device_protocol));
TRY(obj.add("max_packet_size", m_device->device_descriptor().max_packet_size)); TRY(obj.add("max_packet_size"sv, m_device->device_descriptor().max_packet_size));
TRY(obj.add("vendor_id", m_device->device_descriptor().vendor_id)); TRY(obj.add("vendor_id"sv, m_device->device_descriptor().vendor_id));
TRY(obj.add("product_id", m_device->device_descriptor().product_id)); TRY(obj.add("product_id"sv, m_device->device_descriptor().product_id));
TRY(obj.add("device_release_bcd", m_device->device_descriptor().device_release_bcd)); TRY(obj.add("device_release_bcd"sv, m_device->device_descriptor().device_release_bcd));
TRY(obj.add("manufacturer_id_descriptor_index", m_device->device_descriptor().manufacturer_id_descriptor_index)); TRY(obj.add("manufacturer_id_descriptor_index"sv, m_device->device_descriptor().manufacturer_id_descriptor_index));
TRY(obj.add("product_string_descriptor_index", m_device->device_descriptor().product_string_descriptor_index)); TRY(obj.add("product_string_descriptor_index"sv, m_device->device_descriptor().product_string_descriptor_index));
TRY(obj.add("serial_number_descriptor_index", m_device->device_descriptor().serial_number_descriptor_index)); TRY(obj.add("serial_number_descriptor_index"sv, m_device->device_descriptor().serial_number_descriptor_index));
TRY(obj.add("num_configurations", m_device->device_descriptor().num_configurations)); TRY(obj.add("num_configurations"sv, m_device->device_descriptor().num_configurations));
TRY(obj.add("length", m_device->device_descriptor().descriptor_header.length)); TRY(obj.add("length"sv, m_device->device_descriptor().descriptor_header.length));
TRY(obj.add("descriptor_type", m_device->device_descriptor().descriptor_header.descriptor_type)); TRY(obj.add("descriptor_type"sv, m_device->device_descriptor().descriptor_header.descriptor_type));
auto configuration_array = TRY(obj.add_array("configurations")); auto configuration_array = TRY(obj.add_array("configurations"sv));
for (auto const& configuration : m_device->configurations()) { for (auto const& configuration : m_device->configurations()) {
auto configuration_object = TRY(configuration_array.add_object()); auto configuration_object = TRY(configuration_array.add_object());
auto const& configuration_descriptor = configuration.descriptor(); auto const& configuration_descriptor = configuration.descriptor();
TRY(configuration_object.add("length", configuration_descriptor.descriptor_header.length)); TRY(configuration_object.add("length"sv, configuration_descriptor.descriptor_header.length));
TRY(configuration_object.add("descriptor_type", configuration_descriptor.descriptor_header.descriptor_type)); TRY(configuration_object.add("descriptor_type"sv, configuration_descriptor.descriptor_header.descriptor_type));
TRY(configuration_object.add("total_length", configuration_descriptor.total_length)); TRY(configuration_object.add("total_length"sv, configuration_descriptor.total_length));
TRY(configuration_object.add("number_of_interfaces", configuration_descriptor.number_of_interfaces)); TRY(configuration_object.add("number_of_interfaces"sv, configuration_descriptor.number_of_interfaces));
TRY(configuration_object.add("attributes_bitmap", configuration_descriptor.attributes_bitmap)); TRY(configuration_object.add("attributes_bitmap"sv, configuration_descriptor.attributes_bitmap));
TRY(configuration_object.add("max_power", configuration_descriptor.max_power_in_ma)); TRY(configuration_object.add("max_power"sv, configuration_descriptor.max_power_in_ma));
auto interface_array = TRY(configuration_object.add_array("interfaces")); auto interface_array = TRY(configuration_object.add_array("interfaces"sv));
for (auto const& interface : configuration.interfaces()) { for (auto const& interface : configuration.interfaces()) {
auto interface_object = TRY(interface_array.add_object()); auto interface_object = TRY(interface_array.add_object());
auto const& interface_descriptor = interface.descriptor(); auto const& interface_descriptor = interface.descriptor();
TRY(interface_object.add("length", interface_descriptor.descriptor_header.length)); TRY(interface_object.add("length"sv, interface_descriptor.descriptor_header.length));
TRY(interface_object.add("descriptor_type", interface_descriptor.descriptor_header.descriptor_type)); TRY(interface_object.add("descriptor_type"sv, interface_descriptor.descriptor_header.descriptor_type));
TRY(interface_object.add("interface_number", interface_descriptor.interface_id)); TRY(interface_object.add("interface_number"sv, interface_descriptor.interface_id));
TRY(interface_object.add("alternate_setting", interface_descriptor.alternate_setting)); TRY(interface_object.add("alternate_setting"sv, interface_descriptor.alternate_setting));
TRY(interface_object.add("num_endpoints", interface_descriptor.number_of_endpoints)); TRY(interface_object.add("num_endpoints"sv, interface_descriptor.number_of_endpoints));
TRY(interface_object.add("interface_class_code", interface_descriptor.interface_class_code)); TRY(interface_object.add("interface_class_code"sv, interface_descriptor.interface_class_code));
TRY(interface_object.add("interface_sub_class_code", interface_descriptor.interface_sub_class_code)); TRY(interface_object.add("interface_sub_class_code"sv, interface_descriptor.interface_sub_class_code));
TRY(interface_object.add("interface_protocol", interface_descriptor.interface_protocol)); TRY(interface_object.add("interface_protocol"sv, interface_descriptor.interface_protocol));
TRY(interface_object.add("interface_string_desc_index", interface_descriptor.interface_string_descriptor_index)); TRY(interface_object.add("interface_string_desc_index"sv, interface_descriptor.interface_string_descriptor_index));
auto endpoint_array = TRY(interface_object.add_array("endpoints")); auto endpoint_array = TRY(interface_object.add_array("endpoints"sv));
for (auto const& endpoint : interface.endpoints()) { for (auto const& endpoint : interface.endpoints()) {
auto endpoint_object = TRY(endpoint_array.add_object()); auto endpoint_object = TRY(endpoint_array.add_object());
TRY(endpoint_object.add("length", endpoint.descriptor_header.length)); TRY(endpoint_object.add("length"sv, endpoint.descriptor_header.length));
TRY(endpoint_object.add("descriptor_length", endpoint.descriptor_header.descriptor_type)); TRY(endpoint_object.add("descriptor_length"sv, endpoint.descriptor_header.descriptor_type));
TRY(endpoint_object.add("endpoint_address", endpoint.endpoint_address)); TRY(endpoint_object.add("endpoint_address"sv, endpoint.endpoint_address));
TRY(endpoint_object.add("attribute_bitmap", endpoint.endpoint_attributes_bitmap)); TRY(endpoint_object.add("attribute_bitmap"sv, endpoint.endpoint_attributes_bitmap));
TRY(endpoint_object.add("max_packet_size", endpoint.max_packet_size)); TRY(endpoint_object.add("max_packet_size"sv, endpoint.max_packet_size));
TRY(endpoint_object.add("polling_interval", endpoint.poll_interval_in_frames)); TRY(endpoint_object.add("polling_interval"sv, endpoint.poll_interval_in_frames));
TRY(endpoint_object.finish()); TRY(endpoint_object.finish());
} }
TRY(endpoint_array.finish()); TRY(endpoint_array.finish());

View file

@ -37,7 +37,7 @@ protected:
private: private:
ErrorOr<void> try_generate(KBufferBuilder&); ErrorOr<void> try_generate(KBufferBuilder&);
virtual ErrorOr<void> refresh_data(OpenFileDescription& description) const override; virtual ErrorOr<void> refresh_data(OpenFileDescription& description) const override;
mutable Mutex m_lock { "SysFSUSBDeviceInformation" }; mutable Mutex m_lock { "SysFSUSBDeviceInformation"sv };
NonnullOwnPtr<KString> m_device_name; NonnullOwnPtr<KString> m_device_name;
}; };

View file

@ -22,8 +22,8 @@ SysFSBlockDevicesDirectory::SysFSBlockDevicesDirectory(SysFSDevicesDirectory con
ErrorOr<void> SysFSBlockDevicesDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const ErrorOr<void> SysFSBlockDevicesDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{ {
VERIFY(m_parent_directory); VERIFY(m_parent_directory);
TRY(callback({ ".", { fsid, component_index() }, 0 })); TRY(callback({ "."sv, { fsid, component_index() }, 0 }));
TRY(callback({ "..", { fsid, m_parent_directory->component_index() }, 0 })); TRY(callback({ ".."sv, { fsid, m_parent_directory->component_index() }, 0 }));
return SysFSComponentRegistry::the().devices_list().with_exclusive([&](auto& list) -> ErrorOr<void> { return SysFSComponentRegistry::the().devices_list().with_exclusive([&](auto& list) -> ErrorOr<void> {
for (auto& exposed_device : list) { for (auto& exposed_device : list) {

View file

@ -21,8 +21,8 @@ SysFSCharacterDevicesDirectory::SysFSCharacterDevicesDirectory(SysFSDevicesDirec
ErrorOr<void> SysFSCharacterDevicesDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const ErrorOr<void> SysFSCharacterDevicesDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{ {
VERIFY(m_parent_directory); VERIFY(m_parent_directory);
TRY(callback({ ".", { fsid, component_index() }, 0 })); TRY(callback({ "."sv, { fsid, component_index() }, 0 }));
TRY(callback({ "..", { fsid, m_parent_directory->component_index() }, 0 })); TRY(callback({ ".."sv, { fsid, m_parent_directory->component_index() }, 0 }));
return SysFSComponentRegistry::the().devices_list().with_exclusive([&](auto& list) -> ErrorOr<void> { return SysFSComponentRegistry::the().devices_list().with_exclusive([&](auto& list) -> ErrorOr<void> {
for (auto& exposed_device : list) { for (auto& exposed_device : list) {

View file

@ -96,7 +96,7 @@ UNMAP_AFTER_INIT Optional<PhysicalAddress> BIOSSysFSDirectory::find_dmi_entry64b
auto bios_or_error = map_bios(); auto bios_or_error = map_bios();
if (bios_or_error.is_error()) if (bios_or_error.is_error())
return {}; return {};
return bios_or_error.value().find_chunk_starting_with("_SM3_", 16); return bios_or_error.value().find_chunk_starting_with("_SM3_"sv, 16);
} }
UNMAP_AFTER_INIT Optional<PhysicalAddress> BIOSSysFSDirectory::find_dmi_entry32bit_point() UNMAP_AFTER_INIT Optional<PhysicalAddress> BIOSSysFSDirectory::find_dmi_entry32bit_point()
@ -104,7 +104,7 @@ UNMAP_AFTER_INIT Optional<PhysicalAddress> BIOSSysFSDirectory::find_dmi_entry32b
auto bios_or_error = map_bios(); auto bios_or_error = map_bios();
if (bios_or_error.is_error()) if (bios_or_error.is_error())
return {}; return {};
return bios_or_error.value().find_chunk_starting_with("_SM_", 16); return bios_or_error.value().find_chunk_starting_with("_SM_"sv, 16);
} }
} }

View file

@ -77,9 +77,9 @@ ErrorOr<void> TmpFSInode::traverse_as_directory(Function<ErrorOr<void>(FileSyste
if (!is_directory()) if (!is_directory())
return ENOTDIR; return ENOTDIR;
TRY(callback({ ".", identifier(), 0 })); TRY(callback({ "."sv, identifier(), 0 }));
if (auto parent = m_parent.strong_ref()) if (auto parent = m_parent.strong_ref())
TRY(callback({ "..", parent->identifier(), 0 })); TRY(callback({ ".."sv, parent->identifier(), 0 }));
for (auto& child : m_children) { for (auto& child : m_children) {
TRY(callback({ child.name->view(), child.inode->identifier(), 0 })); TRY(callback({ child.name->view(), child.inode->identifier(), 0 }));

View file

@ -128,7 +128,7 @@ ErrorOr<void> VirtualFileSystem::mount_root(FileSystem& fs)
mounts.append(move(mount)); mounts.append(move(mount));
}); });
m_root_custody = TRY(Custody::try_create(nullptr, "", *m_root_inode, root_mount_flags)); m_root_custody = TRY(Custody::try_create(nullptr, ""sv, *m_root_inode, root_mount_flags));
return {}; return {};
} }
@ -376,7 +376,7 @@ ErrorOr<void> VirtualFileSystem::mkdir(StringView path, mode_t mode, Custody& ba
path = path.trim("/"sv, TrimMode::Right); path = path.trim("/"sv, TrimMode::Right);
if (path.is_empty()) { if (path.is_empty()) {
// NOTE: This means the path was a series of slashes, which resolves to "/". // NOTE: This means the path was a series of slashes, which resolves to "/".
path = "/"; path = "/"sv;
} }
RefPtr<Custody> parent_custody; RefPtr<Custody> parent_custody;
@ -736,8 +736,8 @@ ErrorOr<void> VirtualFileSystem::rmdir(StringView path, Custody& base)
if (custody->is_readonly()) if (custody->is_readonly())
return EROFS; return EROFS;
TRY(inode.remove_child(".")); TRY(inode.remove_child("."sv));
TRY(inode.remove_child("..")); TRY(inode.remove_child(".."sv));
return parent_inode.remove_child(KLexicalPath::basename(path)); return parent_inode.remove_child(KLexicalPath::basename(path));
} }

View file

@ -22,7 +22,7 @@ UNMAP_AFTER_INIT void initialize()
if (!rsdp.has_value()) if (!rsdp.has_value())
return; return;
auto facp = StaticParsing::find_table(rsdp.value(), "FACP"); auto facp = StaticParsing::find_table(rsdp.value(), "FACP"sv);
if (!facp.has_value()) if (!facp.has_value())
return; return;
auto facp_table_or_error = Memory::map_typed<Structures::FADT>(facp.value()); auto facp_table_or_error = Memory::map_typed<Structures::FADT>(facp.value());

View file

@ -84,13 +84,13 @@ UNMAP_AFTER_INIT void ACPISysFSDirectory::find_tables_and_register_them_as_compo
m_components = components; m_components = components;
auto rsdp = Memory::map_typed<Structures::RSDPDescriptor20>(ACPI::Parser::the()->rsdp()).release_value_but_fixme_should_propagate_errors(); auto rsdp = Memory::map_typed<Structures::RSDPDescriptor20>(ACPI::Parser::the()->rsdp()).release_value_but_fixme_should_propagate_errors();
m_components.append(ACPISysFSComponent::create("RSDP", ACPI::Parser::the()->rsdp(), rsdp->base.revision == 0 ? sizeof(Structures::RSDPDescriptor) : rsdp->length)); m_components.append(ACPISysFSComponent::create("RSDP"sv, ACPI::Parser::the()->rsdp(), rsdp->base.revision == 0 ? sizeof(Structures::RSDPDescriptor) : rsdp->length));
auto main_system_description_table = Memory::map_typed<Structures::SDTHeader>(ACPI::Parser::the()->main_system_description_table()).release_value_but_fixme_should_propagate_errors(); auto main_system_description_table = Memory::map_typed<Structures::SDTHeader>(ACPI::Parser::the()->main_system_description_table()).release_value_but_fixme_should_propagate_errors();
if (ACPI::Parser::the()->is_xsdt_supported()) { if (ACPI::Parser::the()->is_xsdt_supported()) {
m_components.append(ACPISysFSComponent::create("XSDT", ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length)); m_components.append(ACPISysFSComponent::create("XSDT"sv, ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length));
} else { } else {
m_components.append(ACPISysFSComponent::create("RSDT", ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length)); m_components.append(ACPISysFSComponent::create("RSDT"sv, ACPI::Parser::the()->main_system_description_table(), main_system_description_table->length));
} }
} }

View file

@ -46,24 +46,24 @@ private:
auto array = TRY(JsonArraySerializer<>::try_create(builder)); auto array = TRY(JsonArraySerializer<>::try_create(builder));
TRY(NetworkingManagement::the().try_for_each([&array](auto& adapter) -> ErrorOr<void> { TRY(NetworkingManagement::the().try_for_each([&array](auto& adapter) -> ErrorOr<void> {
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
TRY(obj.add("name", adapter.name())); TRY(obj.add("name"sv, adapter.name()));
TRY(obj.add("class_name", adapter.class_name())); TRY(obj.add("class_name"sv, adapter.class_name()));
auto mac_address = TRY(adapter.mac_address().to_string()); auto mac_address = TRY(adapter.mac_address().to_string());
TRY(obj.add("mac_address", mac_address->view())); TRY(obj.add("mac_address"sv, mac_address->view()));
if (!adapter.ipv4_address().is_zero()) { if (!adapter.ipv4_address().is_zero()) {
auto ipv4_address = TRY(adapter.ipv4_address().to_string()); auto ipv4_address = TRY(adapter.ipv4_address().to_string());
TRY(obj.add("ipv4_address", ipv4_address->view())); TRY(obj.add("ipv4_address"sv, ipv4_address->view()));
auto ipv4_netmask = TRY(adapter.ipv4_netmask().to_string()); auto ipv4_netmask = TRY(adapter.ipv4_netmask().to_string());
TRY(obj.add("ipv4_netmask", ipv4_netmask->view())); TRY(obj.add("ipv4_netmask"sv, ipv4_netmask->view()));
} }
TRY(obj.add("packets_in", adapter.packets_in())); TRY(obj.add("packets_in"sv, adapter.packets_in()));
TRY(obj.add("bytes_in", adapter.bytes_in())); TRY(obj.add("bytes_in"sv, adapter.bytes_in()));
TRY(obj.add("packets_out", adapter.packets_out())); TRY(obj.add("packets_out"sv, adapter.packets_out()));
TRY(obj.add("bytes_out", adapter.bytes_out())); TRY(obj.add("bytes_out"sv, adapter.bytes_out()));
TRY(obj.add("link_up", adapter.link_up())); TRY(obj.add("link_up"sv, adapter.link_up()));
TRY(obj.add("link_speed", adapter.link_speed())); TRY(obj.add("link_speed"sv, adapter.link_speed()));
TRY(obj.add("link_full_duplex", adapter.link_full_duplex())); TRY(obj.add("link_full_duplex"sv, adapter.link_full_duplex()));
TRY(obj.add("mtu", adapter.mtu())); TRY(obj.add("mtu"sv, adapter.mtu()));
TRY(obj.finish()); TRY(obj.finish());
return {}; return {};
})); }));
@ -85,9 +85,9 @@ private:
for (auto& it : table) { for (auto& it : table) {
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
auto mac_address = TRY(it.value.to_string()); auto mac_address = TRY(it.value.to_string());
TRY(obj.add("mac_address", mac_address->view())); TRY(obj.add("mac_address"sv, mac_address->view()));
auto ip_address = TRY(it.key.to_string()); auto ip_address = TRY(it.key.to_string());
TRY(obj.add("ip_address", ip_address->view())); TRY(obj.add("ip_address"sv, ip_address->view()));
TRY(obj.finish()); TRY(obj.finish());
} }
return {}; return {};
@ -110,13 +110,13 @@ private:
for (auto& it : table) { for (auto& it : table) {
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
auto destination = TRY(it.destination.to_string()); auto destination = TRY(it.destination.to_string());
TRY(obj.add("destination", destination->view())); TRY(obj.add("destination"sv, destination->view()));
auto gateway = TRY(it.gateway.to_string()); auto gateway = TRY(it.gateway.to_string());
TRY(obj.add("gateway", gateway->view())); TRY(obj.add("gateway"sv, gateway->view()));
auto netmask = TRY(it.netmask.to_string()); auto netmask = TRY(it.netmask.to_string());
TRY(obj.add("genmask", netmask->view())); TRY(obj.add("genmask"sv, netmask->view()));
TRY(obj.add("flags", it.flags)); TRY(obj.add("flags"sv, it.flags));
TRY(obj.add("interface", it.adapter->name())); TRY(obj.add("interface"sv, it.adapter->name()));
TRY(obj.finish()); TRY(obj.finish());
} }
return {}; return {};
@ -138,22 +138,22 @@ private:
TRY(TCPSocket::try_for_each([&array](auto& socket) -> ErrorOr<void> { TRY(TCPSocket::try_for_each([&array](auto& socket) -> ErrorOr<void> {
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
auto local_address = TRY(socket.local_address().to_string()); auto local_address = TRY(socket.local_address().to_string());
TRY(obj.add("local_address", local_address->view())); TRY(obj.add("local_address"sv, local_address->view()));
TRY(obj.add("local_port", socket.local_port())); TRY(obj.add("local_port"sv, socket.local_port()));
auto peer_address = TRY(socket.peer_address().to_string()); auto peer_address = TRY(socket.peer_address().to_string());
TRY(obj.add("peer_address", peer_address->view())); TRY(obj.add("peer_address"sv, peer_address->view()));
TRY(obj.add("peer_port", socket.peer_port())); TRY(obj.add("peer_port"sv, socket.peer_port()));
TRY(obj.add("state", TCPSocket::to_string(socket.state()))); TRY(obj.add("state"sv, TCPSocket::to_string(socket.state())));
TRY(obj.add("ack_number", socket.ack_number())); TRY(obj.add("ack_number"sv, socket.ack_number()));
TRY(obj.add("sequence_number", socket.sequence_number())); TRY(obj.add("sequence_number"sv, socket.sequence_number()));
TRY(obj.add("packets_in", socket.packets_in())); TRY(obj.add("packets_in"sv, socket.packets_in()));
TRY(obj.add("bytes_in", socket.bytes_in())); TRY(obj.add("bytes_in"sv, socket.bytes_in()));
TRY(obj.add("packets_out", socket.packets_out())); TRY(obj.add("packets_out"sv, socket.packets_out()));
TRY(obj.add("bytes_out", socket.bytes_out())); TRY(obj.add("bytes_out"sv, socket.bytes_out()));
if (Process::current().is_superuser() || Process::current().uid() == socket.origin_uid()) { if (Process::current().is_superuser() || Process::current().uid() == socket.origin_uid()) {
TRY(obj.add("origin_pid", socket.origin_pid().value())); TRY(obj.add("origin_pid"sv, socket.origin_pid().value()));
TRY(obj.add("origin_uid", socket.origin_uid().value())); TRY(obj.add("origin_uid"sv, socket.origin_uid().value()));
TRY(obj.add("origin_gid", socket.origin_gid().value())); TRY(obj.add("origin_gid"sv, socket.origin_gid().value()));
} }
TRY(obj.finish()); TRY(obj.finish());
return {}; return {};
@ -174,13 +174,13 @@ private:
auto array = TRY(JsonArraySerializer<>::try_create(builder)); auto array = TRY(JsonArraySerializer<>::try_create(builder));
TRY(LocalSocket::try_for_each([&array](auto& socket) -> ErrorOr<void> { TRY(LocalSocket::try_for_each([&array](auto& socket) -> ErrorOr<void> {
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
TRY(obj.add("path", socket.socket_path())); TRY(obj.add("path"sv, socket.socket_path()));
TRY(obj.add("origin_pid", socket.origin_pid().value())); TRY(obj.add("origin_pid"sv, socket.origin_pid().value()));
TRY(obj.add("origin_uid", socket.origin_uid().value())); TRY(obj.add("origin_uid"sv, socket.origin_uid().value()));
TRY(obj.add("origin_gid", socket.origin_gid().value())); TRY(obj.add("origin_gid"sv, socket.origin_gid().value()));
TRY(obj.add("acceptor_pid", socket.acceptor_pid().value())); TRY(obj.add("acceptor_pid"sv, socket.acceptor_pid().value()));
TRY(obj.add("acceptor_uid", socket.acceptor_uid().value())); TRY(obj.add("acceptor_uid"sv, socket.acceptor_uid().value()));
TRY(obj.add("acceptor_gid", socket.acceptor_gid().value())); TRY(obj.add("acceptor_gid"sv, socket.acceptor_gid().value()));
TRY(obj.finish()); TRY(obj.finish());
return {}; return {};
})); }));
@ -201,15 +201,15 @@ private:
TRY(UDPSocket::try_for_each([&array](auto& socket) -> ErrorOr<void> { TRY(UDPSocket::try_for_each([&array](auto& socket) -> ErrorOr<void> {
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
auto local_address = TRY(socket.local_address().to_string()); auto local_address = TRY(socket.local_address().to_string());
TRY(obj.add("local_address", local_address->view())); TRY(obj.add("local_address"sv, local_address->view()));
TRY(obj.add("local_port", socket.local_port())); TRY(obj.add("local_port"sv, socket.local_port()));
auto peer_address = TRY(socket.peer_address().to_string()); auto peer_address = TRY(socket.peer_address().to_string());
TRY(obj.add("peer_address", peer_address->view())); TRY(obj.add("peer_address"sv, peer_address->view()));
TRY(obj.add("peer_port", socket.peer_port())); TRY(obj.add("peer_port"sv, socket.peer_port()));
if (Process::current().is_superuser() || Process::current().uid() == socket.origin_uid()) { if (Process::current().is_superuser() || Process::current().uid() == socket.origin_uid()) {
TRY(obj.add("origin_pid", socket.origin_pid().value())); TRY(obj.add("origin_pid"sv, socket.origin_pid().value()));
TRY(obj.add("origin_uid", socket.origin_uid().value())); TRY(obj.add("origin_uid"sv, socket.origin_uid().value()));
TRY(obj.add("origin_gid", socket.origin_gid().value())); TRY(obj.add("origin_gid"sv, socket.origin_gid().value()));
} }
TRY(obj.finish()); TRY(obj.finish());
return {}; return {};
@ -402,22 +402,22 @@ private:
TRY(VirtualFileSystem::the().for_each_mount([&array](auto& mount) -> ErrorOr<void> { TRY(VirtualFileSystem::the().for_each_mount([&array](auto& mount) -> ErrorOr<void> {
auto& fs = mount.guest_fs(); auto& fs = mount.guest_fs();
auto fs_object = TRY(array.add_object()); auto fs_object = TRY(array.add_object());
TRY(fs_object.add("class_name", fs.class_name())); TRY(fs_object.add("class_name"sv, fs.class_name()));
TRY(fs_object.add("total_block_count", fs.total_block_count())); TRY(fs_object.add("total_block_count"sv, fs.total_block_count()));
TRY(fs_object.add("free_block_count", fs.free_block_count())); TRY(fs_object.add("free_block_count"sv, fs.free_block_count()));
TRY(fs_object.add("total_inode_count", fs.total_inode_count())); TRY(fs_object.add("total_inode_count"sv, fs.total_inode_count()));
TRY(fs_object.add("free_inode_count", fs.free_inode_count())); TRY(fs_object.add("free_inode_count"sv, fs.free_inode_count()));
auto mount_point = TRY(mount.absolute_path()); auto mount_point = TRY(mount.absolute_path());
TRY(fs_object.add("mount_point", mount_point->view())); TRY(fs_object.add("mount_point"sv, mount_point->view()));
TRY(fs_object.add("block_size", static_cast<u64>(fs.block_size()))); TRY(fs_object.add("block_size"sv, static_cast<u64>(fs.block_size())));
TRY(fs_object.add("readonly", fs.is_readonly())); TRY(fs_object.add("readonly"sv, fs.is_readonly()));
TRY(fs_object.add("mount_flags", mount.flags())); TRY(fs_object.add("mount_flags"sv, mount.flags()));
if (fs.is_file_backed()) { if (fs.is_file_backed()) {
auto pseudo_path = TRY(static_cast<const FileBackedFileSystem&>(fs).file_description().pseudo_path()); auto pseudo_path = TRY(static_cast<const FileBackedFileSystem&>(fs).file_description().pseudo_path());
TRY(fs_object.add("source", pseudo_path->view())); TRY(fs_object.add("source"sv, pseudo_path->view()));
} else { } else {
TRY(fs_object.add("source", "none")); TRY(fs_object.add("source"sv, "none"));
} }
TRY(fs_object.finish()); TRY(fs_object.finish());
@ -444,16 +444,16 @@ private:
auto system_memory = MM.get_system_memory_info(); auto system_memory = MM.get_system_memory_info();
auto json = TRY(JsonObjectSerializer<>::try_create(builder)); auto json = TRY(JsonObjectSerializer<>::try_create(builder));
TRY(json.add("kmalloc_allocated", stats.bytes_allocated)); TRY(json.add("kmalloc_allocated"sv, stats.bytes_allocated));
TRY(json.add("kmalloc_available", stats.bytes_free)); TRY(json.add("kmalloc_available"sv, stats.bytes_free));
TRY(json.add("user_physical_allocated", system_memory.user_physical_pages_used)); TRY(json.add("user_physical_allocated"sv, system_memory.user_physical_pages_used));
TRY(json.add("user_physical_available", system_memory.user_physical_pages - system_memory.user_physical_pages_used)); TRY(json.add("user_physical_available"sv, system_memory.user_physical_pages - system_memory.user_physical_pages_used));
TRY(json.add("user_physical_committed", system_memory.user_physical_pages_committed)); TRY(json.add("user_physical_committed"sv, system_memory.user_physical_pages_committed));
TRY(json.add("user_physical_uncommitted", system_memory.user_physical_pages_uncommitted)); TRY(json.add("user_physical_uncommitted"sv, system_memory.user_physical_pages_uncommitted));
TRY(json.add("super_physical_allocated", system_memory.super_physical_pages_used)); TRY(json.add("super_physical_allocated"sv, system_memory.super_physical_pages_used));
TRY(json.add("super_physical_available", system_memory.super_physical_pages - system_memory.super_physical_pages_used)); TRY(json.add("super_physical_available"sv, system_memory.super_physical_pages - system_memory.super_physical_pages_used));
TRY(json.add("kmalloc_call_count", stats.kmalloc_call_count)); TRY(json.add("kmalloc_call_count"sv, stats.kmalloc_call_count));
TRY(json.add("kfree_call_count", stats.kfree_call_count)); TRY(json.add("kfree_call_count"sv, stats.kfree_call_count));
TRY(json.finish()); TRY(json.finish());
return {}; return {};
} }
@ -469,14 +469,14 @@ private:
{ {
auto json = TRY(JsonObjectSerializer<>::try_create(builder)); auto json = TRY(JsonObjectSerializer<>::try_create(builder));
auto total_time_scheduled = Scheduler::get_total_time_scheduled(); auto total_time_scheduled = Scheduler::get_total_time_scheduled();
TRY(json.add("total_time", total_time_scheduled.total)); TRY(json.add("total_time"sv, total_time_scheduled.total));
TRY(json.add("kernel_time", total_time_scheduled.total_kernel)); TRY(json.add("kernel_time"sv, total_time_scheduled.total_kernel));
TRY(json.add("user_time", total_time_scheduled.total - total_time_scheduled.total_kernel)); TRY(json.add("user_time"sv, total_time_scheduled.total - total_time_scheduled.total_kernel));
u64 idle_time = 0; u64 idle_time = 0;
Processor::for_each([&](Processor& processor) { Processor::for_each([&](Processor& processor) {
idle_time += processor.time_spent_idle(); idle_time += processor.time_spent_idle();
}); });
TRY(json.add("idle_time", idle_time)); TRY(json.add("idle_time"sv, idle_time));
TRY(json.finish()); TRY(json.finish());
return {}; return {};
} }
@ -501,78 +501,78 @@ private:
#define __ENUMERATE_PLEDGE_PROMISE(promise) \ #define __ENUMERATE_PLEDGE_PROMISE(promise) \
if (process.has_promised(Pledge::promise)) \ if (process.has_promised(Pledge::promise)) \
TRY(pledge_builder.try_append(#promise " ")); TRY(pledge_builder.try_append(#promise " "sv));
ENUMERATE_PLEDGE_PROMISES ENUMERATE_PLEDGE_PROMISES
#undef __ENUMERATE_PLEDGE_PROMISE #undef __ENUMERATE_PLEDGE_PROMISE
TRY(process_object.add("pledge", pledge_builder.string_view())); TRY(process_object.add("pledge"sv, pledge_builder.string_view()));
switch (process.veil_state()) { switch (process.veil_state()) {
case VeilState::None: case VeilState::None:
TRY(process_object.add("veil", "None")); TRY(process_object.add("veil"sv, "None"));
break; break;
case VeilState::Dropped: case VeilState::Dropped:
TRY(process_object.add("veil", "Dropped")); TRY(process_object.add("veil"sv, "Dropped"));
break; break;
case VeilState::Locked: case VeilState::Locked:
TRY(process_object.add("veil", "Locked")); TRY(process_object.add("veil"sv, "Locked"));
break; break;
} }
} else { } else {
TRY(process_object.add("pledge", ""sv)); TRY(process_object.add("pledge"sv, ""sv));
TRY(process_object.add("veil", ""sv)); TRY(process_object.add("veil"sv, ""sv));
} }
TRY(process_object.add("pid", process.pid().value())); TRY(process_object.add("pid"sv, process.pid().value()));
TRY(process_object.add("pgid", process.tty() ? process.tty()->pgid().value() : 0)); TRY(process_object.add("pgid"sv, process.tty() ? process.tty()->pgid().value() : 0));
TRY(process_object.add("pgp", process.pgid().value())); TRY(process_object.add("pgp"sv, process.pgid().value()));
TRY(process_object.add("sid", process.sid().value())); TRY(process_object.add("sid"sv, process.sid().value()));
TRY(process_object.add("uid", process.uid().value())); TRY(process_object.add("uid"sv, process.uid().value()));
TRY(process_object.add("gid", process.gid().value())); TRY(process_object.add("gid"sv, process.gid().value()));
TRY(process_object.add("ppid", process.ppid().value())); TRY(process_object.add("ppid"sv, process.ppid().value()));
if (process.tty()) { if (process.tty()) {
auto tty_pseudo_name = TRY(process.tty()->pseudo_name()); auto tty_pseudo_name = TRY(process.tty()->pseudo_name());
TRY(process_object.add("tty", tty_pseudo_name->view())); TRY(process_object.add("tty"sv, tty_pseudo_name->view()));
} else { } else {
TRY(process_object.add("tty", "")); TRY(process_object.add("tty"sv, ""));
} }
TRY(process_object.add("nfds", process.fds().with_shared([](auto& fds) { return fds.open_count(); }))); TRY(process_object.add("nfds"sv, process.fds().with_shared([](auto& fds) { return fds.open_count(); })));
TRY(process_object.add("name", process.name())); TRY(process_object.add("name"sv, process.name()));
TRY(process_object.add("executable", process.executable() ? TRY(process.executable()->try_serialize_absolute_path())->view() : ""sv)); TRY(process_object.add("executable"sv, process.executable() ? TRY(process.executable()->try_serialize_absolute_path())->view() : ""sv));
TRY(process_object.add("amount_virtual", process.address_space().amount_virtual())); TRY(process_object.add("amount_virtual"sv, process.address_space().amount_virtual()));
TRY(process_object.add("amount_resident", process.address_space().amount_resident())); TRY(process_object.add("amount_resident"sv, process.address_space().amount_resident()));
TRY(process_object.add("amount_dirty_private", process.address_space().amount_dirty_private())); TRY(process_object.add("amount_dirty_private"sv, process.address_space().amount_dirty_private()));
TRY(process_object.add("amount_clean_inode", TRY(process.address_space().amount_clean_inode()))); TRY(process_object.add("amount_clean_inode"sv, TRY(process.address_space().amount_clean_inode())));
TRY(process_object.add("amount_shared", process.address_space().amount_shared())); TRY(process_object.add("amount_shared"sv, process.address_space().amount_shared()));
TRY(process_object.add("amount_purgeable_volatile", process.address_space().amount_purgeable_volatile())); TRY(process_object.add("amount_purgeable_volatile"sv, process.address_space().amount_purgeable_volatile()));
TRY(process_object.add("amount_purgeable_nonvolatile", process.address_space().amount_purgeable_nonvolatile())); TRY(process_object.add("amount_purgeable_nonvolatile"sv, process.address_space().amount_purgeable_nonvolatile()));
TRY(process_object.add("dumpable", process.is_dumpable())); TRY(process_object.add("dumpable"sv, process.is_dumpable()));
TRY(process_object.add("kernel", process.is_kernel_process())); TRY(process_object.add("kernel"sv, process.is_kernel_process()));
auto thread_array = TRY(process_object.add_array("threads")); auto thread_array = TRY(process_object.add_array("threads"sv));
TRY(process.try_for_each_thread([&](const Thread& thread) -> ErrorOr<void> { TRY(process.try_for_each_thread([&](const Thread& thread) -> ErrorOr<void> {
SpinlockLocker locker(thread.get_lock()); SpinlockLocker locker(thread.get_lock());
auto thread_object = TRY(thread_array.add_object()); auto thread_object = TRY(thread_array.add_object());
#if LOCK_DEBUG #if LOCK_DEBUG
TRY(thread_object.add("lock_count", thread.lock_count())); TRY(thread_object.add("lock_count"sv, thread.lock_count()));
#endif #endif
TRY(thread_object.add("tid", thread.tid().value())); TRY(thread_object.add("tid"sv, thread.tid().value()));
TRY(thread_object.add("name", thread.name())); TRY(thread_object.add("name"sv, thread.name()));
TRY(thread_object.add("times_scheduled", thread.times_scheduled())); TRY(thread_object.add("times_scheduled"sv, thread.times_scheduled()));
TRY(thread_object.add("time_user", thread.time_in_user())); TRY(thread_object.add("time_user"sv, thread.time_in_user()));
TRY(thread_object.add("time_kernel", thread.time_in_kernel())); TRY(thread_object.add("time_kernel"sv, thread.time_in_kernel()));
TRY(thread_object.add("state", thread.state_string())); TRY(thread_object.add("state"sv, thread.state_string()));
TRY(thread_object.add("cpu", thread.cpu())); TRY(thread_object.add("cpu"sv, thread.cpu()));
TRY(thread_object.add("priority", thread.priority())); TRY(thread_object.add("priority"sv, thread.priority()));
TRY(thread_object.add("syscall_count", thread.syscall_count())); TRY(thread_object.add("syscall_count"sv, thread.syscall_count()));
TRY(thread_object.add("inode_faults", thread.inode_faults())); TRY(thread_object.add("inode_faults"sv, thread.inode_faults()));
TRY(thread_object.add("zero_faults", thread.zero_faults())); TRY(thread_object.add("zero_faults"sv, thread.zero_faults()));
TRY(thread_object.add("cow_faults", thread.cow_faults())); TRY(thread_object.add("cow_faults"sv, thread.cow_faults()));
TRY(thread_object.add("file_read_bytes", thread.file_read_bytes())); TRY(thread_object.add("file_read_bytes"sv, thread.file_read_bytes()));
TRY(thread_object.add("file_write_bytes", thread.file_write_bytes())); TRY(thread_object.add("file_write_bytes"sv, thread.file_write_bytes()));
TRY(thread_object.add("unix_socket_read_bytes", thread.unix_socket_read_bytes())); TRY(thread_object.add("unix_socket_read_bytes"sv, thread.unix_socket_read_bytes()));
TRY(thread_object.add("unix_socket_write_bytes", thread.unix_socket_write_bytes())); TRY(thread_object.add("unix_socket_write_bytes"sv, thread.unix_socket_write_bytes()));
TRY(thread_object.add("ipv4_socket_read_bytes", thread.ipv4_socket_read_bytes())); TRY(thread_object.add("ipv4_socket_read_bytes"sv, thread.ipv4_socket_read_bytes()));
TRY(thread_object.add("ipv4_socket_write_bytes", thread.ipv4_socket_write_bytes())); TRY(thread_object.add("ipv4_socket_write_bytes"sv, thread.ipv4_socket_write_bytes()));
TRY(thread_object.finish()); TRY(thread_object.finish());
return {}; return {};
@ -585,7 +585,7 @@ private:
SpinlockLocker lock(g_scheduler_lock); SpinlockLocker lock(g_scheduler_lock);
{ {
{ {
auto array = TRY(json.add_array("processes")); auto array = TRY(json.add_array("processes"sv));
TRY(build_process(array, *Scheduler::colonel())); TRY(build_process(array, *Scheduler::colonel()));
TRY(Process::all_instances().with([&](auto& processes) -> ErrorOr<void> { TRY(Process::all_instances().with([&](auto& processes) -> ErrorOr<void> {
for (auto& process : processes) for (auto& process : processes)
@ -596,8 +596,8 @@ private:
} }
auto total_time_scheduled = Scheduler::get_total_time_scheduled(); auto total_time_scheduled = Scheduler::get_total_time_scheduled();
TRY(json.add("total_time", total_time_scheduled.total)); TRY(json.add("total_time"sv, total_time_scheduled.total));
TRY(json.add("total_time_kernel", total_time_scheduled.total_kernel)); TRY(json.add("total_time_kernel"sv, total_time_scheduled.total_kernel));
} }
TRY(json.finish()); TRY(json.finish());
return {}; return {};
@ -616,13 +616,13 @@ private:
[&](Processor& proc) -> ErrorOr<void> { [&](Processor& proc) -> ErrorOr<void> {
auto& info = proc.info(); auto& info = proc.info();
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
TRY(obj.add("processor", proc.id())); TRY(obj.add("processor"sv, proc.id()));
TRY(obj.add("vendor_id", info.vendor_id_string())); TRY(obj.add("vendor_id"sv, info.vendor_id_string()));
TRY(obj.add("family", info.display_family())); TRY(obj.add("family"sv, info.display_family()));
if (!info.hypervisor_vendor_id_string().is_null()) if (!info.hypervisor_vendor_id_string().is_null())
TRY(obj.add("hypervisor_vendor_id", info.hypervisor_vendor_id_string())); TRY(obj.add("hypervisor_vendor_id"sv, info.hypervisor_vendor_id_string()));
auto features_array = TRY(obj.add_array("features")); auto features_array = TRY(obj.add_array("features"sv));
auto keep_empty = false; auto keep_empty = false;
ErrorOr<void> result; // FIXME: Make this nicer ErrorOr<void> result; // FIXME: Make this nicer
@ -635,29 +635,29 @@ private:
TRY(features_array.finish()); TRY(features_array.finish());
TRY(obj.add("model", info.display_model())); TRY(obj.add("model"sv, info.display_model()));
TRY(obj.add("stepping", info.stepping())); TRY(obj.add("stepping"sv, info.stepping()));
TRY(obj.add("type", info.type())); TRY(obj.add("type"sv, info.type()));
TRY(obj.add("brand", info.brand_string())); TRY(obj.add("brand"sv, info.brand_string()));
auto caches = TRY(obj.add_object("caches")); auto caches = TRY(obj.add_object("caches"sv));
auto add_cache_info = [&](StringView name, ProcessorInfo::Cache const& cache) -> ErrorOr<void> { auto add_cache_info = [&](StringView name, ProcessorInfo::Cache const& cache) -> ErrorOr<void> {
auto cache_object = TRY(caches.add_object(name)); auto cache_object = TRY(caches.add_object(name));
TRY(cache_object.add("size", cache.size)); TRY(cache_object.add("size"sv, cache.size));
TRY(cache_object.add("line_size", cache.line_size)); TRY(cache_object.add("line_size"sv, cache.line_size));
TRY(cache_object.finish()); TRY(cache_object.finish());
return {}; return {};
}; };
if (info.l1_data_cache().has_value()) if (info.l1_data_cache().has_value())
TRY(add_cache_info("l1_data", *info.l1_data_cache())); TRY(add_cache_info("l1_data"sv, *info.l1_data_cache()));
if (info.l1_data_cache().has_value()) if (info.l1_data_cache().has_value())
TRY(add_cache_info("l1_instruction", *info.l1_instruction_cache())); TRY(add_cache_info("l1_instruction"sv, *info.l1_instruction_cache()));
if (info.l1_data_cache().has_value()) if (info.l1_data_cache().has_value())
TRY(add_cache_info("l2", *info.l2_cache())); TRY(add_cache_info("l2"sv, *info.l2_cache()));
if (info.l1_data_cache().has_value()) if (info.l1_data_cache().has_value())
TRY(add_cache_info("l3", *info.l3_cache())); TRY(add_cache_info("l3"sv, *info.l3_cache()));
TRY(caches.finish()); TRY(caches.finish());
@ -701,12 +701,12 @@ private:
return; return;
result = ([&]() -> ErrorOr<void> { result = ([&]() -> ErrorOr<void> {
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
TRY(obj.add("purpose", handler.purpose())); TRY(obj.add("purpose"sv, handler.purpose()));
TRY(obj.add("interrupt_line", handler.interrupt_number())); TRY(obj.add("interrupt_line"sv, handler.interrupt_number()));
TRY(obj.add("controller", handler.controller())); TRY(obj.add("controller"sv, handler.controller()));
TRY(obj.add("cpu_handler", 0)); // FIXME: Determine the responsible CPU for each interrupt handler. TRY(obj.add("cpu_handler"sv, 0)); // FIXME: Determine the responsible CPU for each interrupt handler.
TRY(obj.add("device_sharing", (unsigned)handler.sharing_devices_count())); TRY(obj.add("device_sharing"sv, (unsigned)handler.sharing_devices_count()));
TRY(obj.add("call_count", (unsigned)handler.get_invoking_count())); TRY(obj.add("call_count"sv, (unsigned)handler.get_invoking_count()));
TRY(obj.finish()); TRY(obj.finish());
return {}; return {};
})(); })();
@ -726,7 +726,7 @@ private:
{ {
auto json = TRY(JsonObjectSerializer<>::try_create(builder)); auto json = TRY(JsonObjectSerializer<>::try_create(builder));
TRY(HIDManagement::the().keymap_data().with([&](auto const& keymap_data) { TRY(HIDManagement::the().keymap_data().with([&](auto const& keymap_data) {
return json.add("keymap", keymap_data.character_map_name->view()); return json.add("keymap"sv, keymap_data.character_map_name->view());
})); }));
TRY(json.finish()); TRY(json.finish());
return {}; return {};
@ -749,17 +749,17 @@ private:
return; return;
result = ([&]() -> ErrorOr<void> { result = ([&]() -> ErrorOr<void> {
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
TRY(obj.add("domain", device_identifier.address().domain())); TRY(obj.add("domain"sv, device_identifier.address().domain()));
TRY(obj.add("bus", device_identifier.address().bus())); TRY(obj.add("bus"sv, device_identifier.address().bus()));
TRY(obj.add("device", device_identifier.address().device())); TRY(obj.add("device"sv, device_identifier.address().device()));
TRY(obj.add("function", device_identifier.address().function())); TRY(obj.add("function"sv, device_identifier.address().function()));
TRY(obj.add("vendor_id", device_identifier.hardware_id().vendor_id)); TRY(obj.add("vendor_id"sv, device_identifier.hardware_id().vendor_id));
TRY(obj.add("device_id", device_identifier.hardware_id().device_id)); TRY(obj.add("device_id"sv, device_identifier.hardware_id().device_id));
TRY(obj.add("revision_id", device_identifier.revision_id().value())); TRY(obj.add("revision_id"sv, device_identifier.revision_id().value()));
TRY(obj.add("subclass", device_identifier.subclass_code().value())); TRY(obj.add("subclass"sv, device_identifier.subclass_code().value()));
TRY(obj.add("class", device_identifier.class_code().value())); TRY(obj.add("class"sv, device_identifier.class_code().value()));
TRY(obj.add("subsystem_id", device_identifier.subsystem_id().value())); TRY(obj.add("subsystem_id"sv, device_identifier.subsystem_id().value()));
TRY(obj.add("subsystem_vendor_id", device_identifier.subsystem_vendor_id().value())); TRY(obj.add("subsystem_vendor_id"sv, device_identifier.subsystem_vendor_id().value()));
TRY(obj.finish()); TRY(obj.finish());
return {}; return {};
})(); })();
@ -781,14 +781,14 @@ private:
auto array = TRY(JsonArraySerializer<>::try_create(builder)); auto array = TRY(JsonArraySerializer<>::try_create(builder));
TRY(DeviceManagement::the().try_for_each([&array](auto& device) -> ErrorOr<void> { TRY(DeviceManagement::the().try_for_each([&array](auto& device) -> ErrorOr<void> {
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
TRY(obj.add("major", device.major().value())); TRY(obj.add("major"sv, device.major().value()));
TRY(obj.add("minor", device.minor().value())); TRY(obj.add("minor"sv, device.minor().value()));
TRY(obj.add("class_name", device.class_name())); TRY(obj.add("class_name"sv, device.class_name()));
if (device.is_block_device()) if (device.is_block_device())
TRY(obj.add("type", "block")); TRY(obj.add("type"sv, "block"));
else if (device.is_character_device()) else if (device.is_character_device())
TRY(obj.add("type", "character")); TRY(obj.add("type"sv, "character"));
else else
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();
TRY(obj.finish()); TRY(obj.finish());
@ -1048,8 +1048,8 @@ UNMAP_AFTER_INIT NonnullRefPtr<ProcFSRootDirectory> ProcFSRootDirectory::must_cr
ErrorOr<void> ProcFSRootDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const ErrorOr<void> ProcFSRootDirectory::traverse_as_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{ {
MutexLocker locker(ProcFSComponentRegistry::the().get_lock()); MutexLocker locker(ProcFSComponentRegistry::the().get_lock());
TRY(callback({ ".", { fsid, component_index() }, 0 })); TRY(callback({ "."sv, { fsid, component_index() }, 0 }));
TRY(callback({ "..", { fsid, 0 }, 0 })); TRY(callback({ ".."sv, { fsid, 0 }, 0 }));
for (auto const& component : m_components) { for (auto const& component : m_components) {
InodeIdentifier identifier = { fsid, component.component_index() }; InodeIdentifier identifier = { fsid, component.component_index() };

View file

@ -29,7 +29,7 @@ void ContiguousFramebufferConsole::set_resolution(size_t width, size_t height, s
size_t size = Memory::page_round_up(pitch * height).release_value_but_fixme_should_propagate_errors(); size_t size = Memory::page_round_up(pitch * height).release_value_but_fixme_should_propagate_errors();
dbgln("Framebuffer Console: taking {} bytes", size); dbgln("Framebuffer Console: taking {} bytes", size);
auto region_or_error = MM.allocate_kernel_region(m_framebuffer_address, size, "Framebuffer Console", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::Yes); auto region_or_error = MM.allocate_kernel_region(m_framebuffer_address, size, "Framebuffer Console"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::Yes);
VERIFY(!region_or_error.is_error()); VERIFY(!region_or_error.is_error());
m_framebuffer_region = region_or_error.release_value(); m_framebuffer_region = region_or_error.release_value();

View file

@ -11,7 +11,7 @@ namespace Kernel::Graphics {
UNMAP_AFTER_INIT VGAConsole::VGAConsole(Mode mode, size_t width, size_t height) UNMAP_AFTER_INIT VGAConsole::VGAConsole(Mode mode, size_t width, size_t height)
: Console(width, height) : Console(width, height)
, m_vga_region(MM.allocate_kernel_region(PhysicalAddress(0xa0000), Memory::page_round_up(0xc0000 - 0xa0000).release_value_but_fixme_should_propagate_errors(), "VGA Display", Memory::Region::Access::ReadWrite).release_value()) , m_vga_region(MM.allocate_kernel_region(PhysicalAddress(0xa0000), Memory::page_round_up(0xc0000 - 0xa0000).release_value_but_fixme_should_propagate_errors(), "VGA Display"sv, Memory::Region::Access::ReadWrite).release_value())
, m_mode(mode) , m_mode(mode)
{ {
} }

View file

@ -39,7 +39,7 @@ ErrorOr<Memory::Region*> DisplayConnector::mmap(Process& process, OpenFileDescri
range, range,
*m_shared_framebuffer_vmobject, *m_shared_framebuffer_vmobject,
0, 0,
"Mapped Framebuffer", "Mapped Framebuffer"sv,
prot, prot,
shared); shared);
} }

View file

@ -177,7 +177,7 @@ Optional<IntelGraphics::PLLSettings> IntelNativeDisplayConnector::create_pll_set
NonnullRefPtr<IntelNativeDisplayConnector> IntelNativeDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, PhysicalAddress registers_region_address, size_t registers_region_length) NonnullRefPtr<IntelNativeDisplayConnector> IntelNativeDisplayConnector::must_create(PhysicalAddress framebuffer_address, size_t framebuffer_resource_size, PhysicalAddress registers_region_address, size_t registers_region_length)
{ {
auto registers_region = MUST(MM.allocate_kernel_region(PhysicalAddress(registers_region_address), registers_region_length, "Intel Native Graphics Registers", Memory::Region::Access::ReadWrite)); auto registers_region = MUST(MM.allocate_kernel_region(PhysicalAddress(registers_region_address), registers_region_length, "Intel Native Graphics Registers"sv, Memory::Region::Access::ReadWrite));
auto device_or_error = DeviceManagement::try_create_device<IntelNativeDisplayConnector>(framebuffer_address, framebuffer_resource_size, move(registers_region)); auto device_or_error = DeviceManagement::try_create_device<IntelNativeDisplayConnector>(framebuffer_address, framebuffer_resource_size, move(registers_region));
VERIFY(!device_or_error.is_error()); VERIFY(!device_or_error.is_error());
auto connector = device_or_error.release_value(); auto connector = device_or_error.release_value();

View file

@ -26,7 +26,7 @@ NonnullRefPtr<VirtIOGPU3DDevice> VirtIOGPU3DDevice::must_create(VirtIOGraphicsAd
// Setup memory transfer region // Setup memory transfer region
auto region_result = MM.allocate_kernel_region( auto region_result = MM.allocate_kernel_region(
NUM_TRANSFER_REGION_PAGES * PAGE_SIZE, NUM_TRANSFER_REGION_PAGES * PAGE_SIZE,
"VIRGL3D kernel upload buffer", "VIRGL3D kernel upload buffer"sv,
Memory::Region::Access::ReadWrite, Memory::Region::Access::ReadWrite,
AllocationStrategy::AllocateNow); AllocationStrategy::AllocateNow);
VERIFY(!region_result.is_error()); VERIFY(!region_result.is_error());

View file

@ -106,7 +106,7 @@ private:
{ {
auto region_result = TRY(MM.allocate_kernel_region( auto region_result = TRY(MM.allocate_kernel_region(
NUM_TRANSFER_REGION_PAGES * PAGE_SIZE, NUM_TRANSFER_REGION_PAGES * PAGE_SIZE,
"VIRGL3D userspace upload buffer", "VIRGL3D userspace upload buffer"sv,
Memory::Region::Access::ReadWrite, Memory::Region::Access::ReadWrite,
AllocationStrategy::AllocateNow)); AllocationStrategy::AllocateNow));
return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) PerContextState(context_id, move(region_result)))); return TRY(adopt_nonnull_ref_or_enomem(new (nothrow) PerContextState(context_id, move(region_result))));
@ -125,7 +125,7 @@ private:
virtual bool can_write(OpenFileDescription const&, u64) const override { return true; } virtual bool can_write(OpenFileDescription const&, u64) const override { return true; }
virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return ENOTSUP; } virtual ErrorOr<size_t> read(OpenFileDescription&, u64, UserOrKernelBuffer&, size_t) override { return ENOTSUP; }
virtual ErrorOr<size_t> write(OpenFileDescription&, u64, UserOrKernelBuffer const&, size_t) override { return ENOTSUP; } virtual ErrorOr<size_t> write(OpenFileDescription&, u64, UserOrKernelBuffer const&, size_t) override { return ENOTSUP; }
virtual StringView class_name() const override { return "virgl3d"; } virtual StringView class_name() const override { return "virgl3d"sv; }
virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override; virtual ErrorOr<void> ioctl(OpenFileDescription&, unsigned request, Userspace<void*> arg) override;
virtual void detach(OpenFileDescription&) override; virtual void detach(OpenFileDescription&) override;

View file

@ -27,7 +27,7 @@ NonnullRefPtr<VirtIOGraphicsAdapter> VirtIOGraphicsAdapter::initialize(PCI::Devi
// Setup memory transfer region // Setup memory transfer region
auto scratch_space_region = MUST(MM.allocate_contiguous_kernel_region( auto scratch_space_region = MUST(MM.allocate_contiguous_kernel_region(
32 * PAGE_SIZE, 32 * PAGE_SIZE,
"VirtGPU Scratch Space", "VirtGPU Scratch Space"sv,
Memory::Region::Access::ReadWrite)); Memory::Region::Access::ReadWrite));
auto adapter = adopt_ref(*new (nothrow) VirtIOGraphicsAdapter(device_identifier, move(scratch_space_region))); auto adapter = adopt_ref(*new (nothrow) VirtIOGraphicsAdapter(device_identifier, move(scratch_space_region)));

View file

@ -271,7 +271,7 @@ UNMAP_AFTER_INIT bool APIC::init_bsp()
dbgln("APIC: RSDP not found"); dbgln("APIC: RSDP not found");
return false; return false;
} }
auto madt_address = ACPI::StaticParsing::find_table(rsdp.value(), "APIC"); auto madt_address = ACPI::StaticParsing::find_table(rsdp.value(), "APIC"sv);
if (!madt_address.has_value()) { if (!madt_address.has_value()) {
dbgln("APIC: MADT table not found"); dbgln("APIC: MADT table not found");
return false; return false;

View file

@ -110,7 +110,7 @@ void SpuriousInterruptHandler::disable_interrupt_vector()
StringView SpuriousInterruptHandler::controller() const StringView SpuriousInterruptHandler::controller() const
{ {
if (m_responsible_irq_controller->type() == IRQControllerType::i82093AA) if (m_responsible_irq_controller->type() == IRQControllerType::i82093AA)
return ""; return ""sv;
return m_responsible_irq_controller->model(); return m_responsible_irq_controller->model();
} }
} }

View file

@ -105,19 +105,19 @@ ErrorOr<void> KBufferBuilder::append_escaped_for_json(StringView string)
for (auto ch : string) { for (auto ch : string) {
switch (ch) { switch (ch) {
case '\b': case '\b':
TRY(append("\\b")); TRY(append("\\b"sv));
break; break;
case '\n': case '\n':
TRY(append("\\n")); TRY(append("\\n"sv));
break; break;
case '\t': case '\t':
TRY(append("\\t")); TRY(append("\\t"sv));
break; break;
case '\"': case '\"':
TRY(append("\\\"")); TRY(append("\\\""sv));
break; break;
case '\\': case '\\':
TRY(append("\\\\")); TRY(append("\\\\"sv));
break; break;
default: default:
if (ch >= 0 && ch <= 0x1f) if (ch >= 0 && ch <= 0x1f)

View file

@ -25,7 +25,7 @@ bool is_canonical(StringView path)
return false; return false;
if (path.starts_with("./"sv) || path.contains("/./"sv) || path.ends_with("/."sv)) if (path.starts_with("./"sv) || path.contains("/./"sv) || path.ends_with("/."sv))
return false; return false;
if (path.starts_with("../"sv) || path.contains("/../"sv) || path.ends_with("/..")) if (path.starts_with("../"sv) || path.contains("/../"sv) || path.ends_with("/.."sv))
return false; return false;
if (path.contains("//"sv)) if (path.contains("//"sv))
return false; return false;

View file

@ -986,7 +986,7 @@ ErrorOr<NonnullRefPtrVector<PhysicalPage>> MemoryManager::allocate_contiguous_us
auto physical_pages = physical_region.take_contiguous_free_pages(page_count); auto physical_pages = physical_region.take_contiguous_free_pages(page_count);
if (!physical_pages.is_empty()) { if (!physical_pages.is_empty()) {
{ {
auto cleanup_region = TRY(MM.allocate_kernel_region(physical_pages[0].paddr(), PAGE_SIZE * page_count, "MemoryManager Allocation Sanitization", Region::Access::Read | Region::Access::Write)); auto cleanup_region = TRY(MM.allocate_kernel_region(physical_pages[0].paddr(), PAGE_SIZE * page_count, "MemoryManager Allocation Sanitization"sv, Region::Access::Read | Region::Access::Write));
memset(cleanup_region->vaddr().as_ptr(), 0, PAGE_SIZE * page_count); memset(cleanup_region->vaddr().as_ptr(), 0, PAGE_SIZE * page_count);
} }
m_system_memory_info.user_physical_pages_uncommitted -= page_count; m_system_memory_info.user_physical_pages_uncommitted -= page_count;
@ -1012,7 +1012,7 @@ ErrorOr<NonnullRefPtrVector<PhysicalPage>> MemoryManager::allocate_contiguous_su
} }
{ {
auto cleanup_region = TRY(MM.allocate_kernel_region(physical_pages[0].paddr(), PAGE_SIZE * count, "MemoryManager Allocation Sanitization", Region::Access::Read | Region::Access::Write)); auto cleanup_region = TRY(MM.allocate_kernel_region(physical_pages[0].paddr(), PAGE_SIZE * count, "MemoryManager Allocation Sanitization"sv, Region::Access::Read | Region::Access::Write));
memset(cleanup_region->vaddr().as_ptr(), 0, PAGE_SIZE * count); memset(cleanup_region->vaddr().as_ptr(), 0, PAGE_SIZE * count);
} }
m_system_memory_info.super_physical_pages_used += count; m_system_memory_info.super_physical_pages_used += count;

View file

@ -51,10 +51,10 @@ enum class UsedMemoryRangeType {
}; };
static constexpr StringView UserMemoryRangeTypeNames[] { static constexpr StringView UserMemoryRangeTypeNames[] {
"Low memory", "Low memory"sv,
"Kernel", "Kernel"sv,
"Boot module", "Boot module"sv,
"Physical Pages" "Physical Pages"sv
}; };
static_assert(array_size(UserMemoryRangeTypeNames) == to_underlying(UsedMemoryRangeType::__Count)); static_assert(array_size(UserMemoryRangeTypeNames) == to_underlying(UsedMemoryRangeType::__Count));

View file

@ -21,7 +21,7 @@ RefPtr<ScatterGatherList> ScatterGatherList::try_create(AsyncBlockDeviceRequest&
ScatterGatherList::ScatterGatherList(NonnullRefPtr<AnonymousVMObject> vm_object, AsyncBlockDeviceRequest& request, size_t device_block_size) ScatterGatherList::ScatterGatherList(NonnullRefPtr<AnonymousVMObject> vm_object, AsyncBlockDeviceRequest& request, size_t device_block_size)
: m_vm_object(move(vm_object)) : m_vm_object(move(vm_object))
{ {
auto region_or_error = MM.allocate_kernel_region_with_vmobject(m_vm_object, page_round_up((request.block_count() * device_block_size)).release_value_but_fixme_should_propagate_errors(), "AHCI Scattered DMA", Region::Access::Read | Region::Access::Write, Region::Cacheable::Yes); auto region_or_error = MM.allocate_kernel_region_with_vmobject(m_vm_object, page_round_up((request.block_count() * device_block_size)).release_value_but_fixme_should_propagate_errors(), "AHCI Scattered DMA"sv, Region::Access::Read | Region::Access::Write, Region::Cacheable::Yes);
if (region_or_error.is_error()) if (region_or_error.is_error())
TODO(); TODO();
m_dma_region = region_or_error.release_value(); m_dma_region = region_or_error.release_value();

View file

@ -64,6 +64,6 @@ template<>
struct AK::Formatter<Kernel::Memory::VirtualRange> : Formatter<FormatString> { struct AK::Formatter<Kernel::Memory::VirtualRange> : Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, Kernel::Memory::VirtualRange value) ErrorOr<void> format(FormatBuilder& builder, Kernel::Memory::VirtualRange value)
{ {
return Formatter<FormatString>::format(builder, "{} - {} (size {:p})", value.base().as_ptr(), value.base().offset(value.size() - 1).as_ptr(), value.size()); return Formatter<FormatString>::format(builder, "{} - {} (size {:p})"sv, value.base().as_ptr(), value.base().offset(value.size() - 1).as_ptr(), value.size());
} }
}; };

View file

@ -474,7 +474,7 @@ ErrorOr<NonnullOwnPtr<KString>> IPv4Socket::pseudo_path(OpenFileDescription cons
return KString::try_create("socket"sv); return KString::try_create("socket"sv);
StringBuilder builder; StringBuilder builder;
TRY(builder.try_append("socket:")); TRY(builder.try_append("socket:"sv));
TRY(builder.try_appendff("{}:{}", m_local_address.to_string(), m_local_port)); TRY(builder.try_appendff("{}:{}", m_local_address.to_string(), m_local_port));
if (m_role == Role::Accepted || m_role == Role::Connected) if (m_role == Role::Accepted || m_role == Role::Connected)
@ -482,16 +482,16 @@ ErrorOr<NonnullOwnPtr<KString>> IPv4Socket::pseudo_path(OpenFileDescription cons
switch (m_role) { switch (m_role) {
case Role::Listener: case Role::Listener:
TRY(builder.try_append(" (listening)")); TRY(builder.try_append(" (listening)"sv));
break; break;
case Role::Accepted: case Role::Accepted:
TRY(builder.try_append(" (accepted)")); TRY(builder.try_append(" (accepted)"sv));
break; break;
case Role::Connected: case Role::Connected:
TRY(builder.try_append(" (connected)")); TRY(builder.try_append(" (connected)"sv));
break; break;
case Role::Connecting: case Role::Connecting:
TRY(builder.try_append(" (connecting)")); TRY(builder.try_append(" (connecting)"sv));
break; break;
default: default:
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();

View file

@ -209,7 +209,7 @@ UNMAP_AFTER_INIT bool E1000ENetworkAdapter::initialize()
enable_bus_mastering(pci_address()); enable_bus_mastering(pci_address());
size_t mmio_base_size = PCI::get_BAR_space_size(pci_address(), 0); size_t mmio_base_size = PCI::get_BAR_space_size(pci_address(), 0);
auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR0(pci_address()))), Memory::page_round_up(mmio_base_size).release_value_but_fixme_should_propagate_errors(), "E1000e MMIO", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No); auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR0(pci_address()))), Memory::page_round_up(mmio_base_size).release_value_but_fixme_should_propagate_errors(), "E1000e MMIO"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No);
if (region_or_error.is_error()) if (region_or_error.is_error())
return false; return false;
m_mmio_region = region_or_error.release_value(); m_mmio_region = region_or_error.release_value();

View file

@ -200,7 +200,7 @@ UNMAP_AFTER_INIT bool E1000NetworkAdapter::initialize()
m_io_base = IOAddress(PCI::get_BAR1(pci_address()) & ~1); m_io_base = IOAddress(PCI::get_BAR1(pci_address()) & ~1);
size_t mmio_base_size = PCI::get_BAR_space_size(pci_address(), 0); size_t mmio_base_size = PCI::get_BAR_space_size(pci_address(), 0);
auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR0(pci_address()))), Memory::page_round_up(mmio_base_size).release_value_but_fixme_should_propagate_errors(), "E1000 MMIO", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No); auto region_or_error = MM.allocate_kernel_region(PhysicalAddress(page_base_of(PCI::get_BAR0(pci_address()))), Memory::page_round_up(mmio_base_size).release_value_but_fixme_should_propagate_errors(), "E1000 MMIO"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No);
if (region_or_error.is_error()) if (region_or_error.is_error())
return false; return false;
m_mmio_region = region_or_error.release_value(); m_mmio_region = region_or_error.release_value();
@ -231,8 +231,8 @@ UNMAP_AFTER_INIT E1000NetworkAdapter::E1000NetworkAdapter(PCI::Address address,
: NetworkAdapter(move(interface_name)) : NetworkAdapter(move(interface_name))
, PCI::Device(address) , PCI::Device(address)
, IRQHandler(irq) , IRQHandler(irq)
, m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_rx_desc) * number_of_rx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 RX Descriptors", Memory::Region::Access::ReadWrite).release_value()) , m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_rx_desc) * number_of_rx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 RX Descriptors"sv, Memory::Region::Access::ReadWrite).release_value())
, m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_tx_desc) * number_of_tx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 TX Descriptors", Memory::Region::Access::ReadWrite).release_value()) , m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_tx_desc) * number_of_tx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 TX Descriptors"sv, Memory::Region::Access::ReadWrite).release_value())
{ {
} }
@ -324,7 +324,7 @@ UNMAP_AFTER_INIT void E1000NetworkAdapter::initialize_rx_descriptors()
constexpr auto rx_buffer_size = 8192; constexpr auto rx_buffer_size = 8192;
constexpr auto rx_buffer_page_count = rx_buffer_size / PAGE_SIZE; constexpr auto rx_buffer_page_count = rx_buffer_size / PAGE_SIZE;
m_rx_buffer_region = MM.allocate_contiguous_kernel_region(rx_buffer_size * number_of_rx_descriptors, "E1000 RX buffers", Memory::Region::Access::ReadWrite).release_value(); m_rx_buffer_region = MM.allocate_contiguous_kernel_region(rx_buffer_size * number_of_rx_descriptors, "E1000 RX buffers"sv, Memory::Region::Access::ReadWrite).release_value();
for (size_t i = 0; i < number_of_rx_descriptors; ++i) { for (size_t i = 0; i < number_of_rx_descriptors; ++i) {
auto& descriptor = rx_descriptors[i]; auto& descriptor = rx_descriptors[i];
m_rx_buffers[i] = m_rx_buffer_region->vaddr().as_ptr() + rx_buffer_size * i; m_rx_buffers[i] = m_rx_buffer_region->vaddr().as_ptr() + rx_buffer_size * i;
@ -347,7 +347,7 @@ UNMAP_AFTER_INIT void E1000NetworkAdapter::initialize_tx_descriptors()
constexpr auto tx_buffer_size = 8192; constexpr auto tx_buffer_size = 8192;
constexpr auto tx_buffer_page_count = tx_buffer_size / PAGE_SIZE; constexpr auto tx_buffer_page_count = tx_buffer_size / PAGE_SIZE;
m_tx_buffer_region = MM.allocate_contiguous_kernel_region(tx_buffer_size * number_of_tx_descriptors, "E1000 TX buffers", Memory::Region::Access::ReadWrite).release_value(); m_tx_buffer_region = MM.allocate_contiguous_kernel_region(tx_buffer_size * number_of_tx_descriptors, "E1000 TX buffers"sv, Memory::Region::Access::ReadWrite).release_value();
for (size_t i = 0; i < number_of_tx_descriptors; ++i) { for (size_t i = 0; i < number_of_tx_descriptors; ++i) {
auto& descriptor = tx_descriptors[i]; auto& descriptor = tx_descriptors[i];
@ -446,7 +446,7 @@ void E1000NetworkAdapter::send_raw(ReadonlyBytes payload)
sti(); sti();
break; break;
} }
m_wait_queue.wait_forever("E1000NetworkAdapter"); m_wait_queue.wait_forever("E1000NetworkAdapter"sv);
} }
dbgln_if(E1000_DEBUG, "E1000: Sent packet, status is now {:#02x}!", (u8)descriptor.status); dbgln_if(E1000_DEBUG, "E1000: Sent packet, status is now {:#02x}!", (u8)descriptor.status);
} }

View file

@ -368,12 +368,12 @@ StringView LocalSocket::socket_path() const
ErrorOr<NonnullOwnPtr<KString>> LocalSocket::pseudo_path(OpenFileDescription const& description) const ErrorOr<NonnullOwnPtr<KString>> LocalSocket::pseudo_path(OpenFileDescription const& description) const
{ {
StringBuilder builder; StringBuilder builder;
TRY(builder.try_append("socket:")); TRY(builder.try_append("socket:"sv));
TRY(builder.try_append(socket_path())); TRY(builder.try_append(socket_path()));
switch (role(description)) { switch (role(description)) {
case Role::Listener: case Role::Listener:
TRY(builder.try_append(" (listening)")); TRY(builder.try_append(" (listening)"sv));
break; break;
case Role::Accepted: case Role::Accepted:
TRY(builder.try_appendff(" (accepted from pid {})", origin_pid())); TRY(builder.try_appendff(" (accepted from pid {})", origin_pid()));
@ -382,7 +382,7 @@ ErrorOr<NonnullOwnPtr<KString>> LocalSocket::pseudo_path(OpenFileDescription con
TRY(builder.try_appendff(" (connected to pid {})", acceptor_pid())); TRY(builder.try_appendff(" (connected to pid {})", acceptor_pid()));
break; break;
case Role::Connecting: case Role::Connecting:
TRY(builder.try_append(" (connecting)")); TRY(builder.try_append(" (connecting)"sv));
break; break;
default: default:
break; break;

View file

@ -379,7 +379,7 @@ void NE2000NetworkAdapter::send_raw(ReadonlyBytes payload)
} }
while (in8(REG_RW_COMMAND) & BIT_COMMAND_TXP) while (in8(REG_RW_COMMAND) & BIT_COMMAND_TXP)
m_wait_queue.wait_forever("NE2000NetworkAdapter"); m_wait_queue.wait_forever("NE2000NetworkAdapter"sv);
disable_irq(); disable_irq();
size_t packet_size = payload.size(); size_t packet_size = payload.size();

View file

@ -43,7 +43,7 @@ static HashTable<RefPtr<TCPSocket>>* delayed_ack_sockets;
void NetworkTask::spawn() void NetworkTask::spawn()
{ {
RefPtr<Thread> thread; RefPtr<Thread> thread;
auto name = KString::try_create("Network Task"); auto name = KString::try_create("Network Task"sv);
if (name.is_error()) if (name.is_error())
TODO(); TODO();
(void)Process::create_kernel_process(thread, name.release_value(), NetworkTask_main, nullptr); (void)Process::create_kernel_process(thread, name.release_value(), NetworkTask_main, nullptr);
@ -90,7 +90,7 @@ void NetworkTask_main(void*)
}; };
size_t buffer_size = 64 * KiB; size_t buffer_size = 64 * KiB;
auto region_or_error = MM.allocate_kernel_region(buffer_size, "Kernel Packet Buffer", Memory::Region::Access::ReadWrite); auto region_or_error = MM.allocate_kernel_region(buffer_size, "Kernel Packet Buffer"sv, Memory::Region::Access::ReadWrite);
if (region_or_error.is_error()) if (region_or_error.is_error())
TODO(); TODO();
auto buffer_region = region_or_error.release_value(); auto buffer_region = region_or_error.release_value();
@ -104,7 +104,7 @@ void NetworkTask_main(void*)
if (!packet_size) { if (!packet_size) {
auto timeout_time = Time::from_milliseconds(500); auto timeout_time = Time::from_milliseconds(500);
auto timeout = Thread::BlockTimeout { false, &timeout_time }; auto timeout = Thread::BlockTimeout { false, &timeout_time };
[[maybe_unused]] auto result = packet_wait_queue.wait_on(timeout, "NetworkTask"); [[maybe_unused]] auto result = packet_wait_queue.wait_on(timeout, "NetworkTask"sv);
continue; continue;
} }
if (packet_size < sizeof(EthernetFrameHeader)) { if (packet_size < sizeof(EthernetFrameHeader)) {

View file

@ -131,8 +131,8 @@ UNMAP_AFTER_INIT RTL8139NetworkAdapter::RTL8139NetworkAdapter(PCI::Address addre
, PCI::Device(address) , PCI::Device(address)
, IRQHandler(irq) , IRQHandler(irq)
, m_io_base(PCI::get_BAR0(pci_address()) & ~1) , m_io_base(PCI::get_BAR0(pci_address()) & ~1)
, m_rx_buffer(MM.allocate_contiguous_kernel_region(Memory::page_round_up(RX_BUFFER_SIZE + PACKET_SIZE_MAX).release_value_but_fixme_should_propagate_errors(), "RTL8139 RX", Memory::Region::Access::ReadWrite).release_value()) , m_rx_buffer(MM.allocate_contiguous_kernel_region(Memory::page_round_up(RX_BUFFER_SIZE + PACKET_SIZE_MAX).release_value_but_fixme_should_propagate_errors(), "RTL8139 RX"sv, Memory::Region::Access::ReadWrite).release_value())
, m_packet_buffer(MM.allocate_contiguous_kernel_region(Memory::page_round_up(PACKET_SIZE_MAX).release_value_but_fixme_should_propagate_errors(), "RTL8139 Packet buffer", Memory::Region::Access::ReadWrite).release_value()) , m_packet_buffer(MM.allocate_contiguous_kernel_region(Memory::page_round_up(PACKET_SIZE_MAX).release_value_but_fixme_should_propagate_errors(), "RTL8139 Packet buffer"sv, Memory::Region::Access::ReadWrite).release_value())
{ {
m_tx_buffers.ensure_capacity(RTL8139_TX_BUFFER_COUNT); m_tx_buffers.ensure_capacity(RTL8139_TX_BUFFER_COUNT);
@ -149,7 +149,7 @@ UNMAP_AFTER_INIT RTL8139NetworkAdapter::RTL8139NetworkAdapter(PCI::Address addre
dbgln("RTL8139: RX buffer: {}", m_rx_buffer->physical_page(0)->paddr()); dbgln("RTL8139: RX buffer: {}", m_rx_buffer->physical_page(0)->paddr());
for (int i = 0; i < RTL8139_TX_BUFFER_COUNT; i++) { for (int i = 0; i < RTL8139_TX_BUFFER_COUNT; i++) {
m_tx_buffers.append(MM.allocate_contiguous_kernel_region(Memory::page_round_up(TX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8139 TX", Memory::Region::Access::Write | Memory::Region::Access::Read).release_value()); m_tx_buffers.append(MM.allocate_contiguous_kernel_region(Memory::page_round_up(TX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8139 TX"sv, Memory::Region::Access::Write | Memory::Region::Access::Read).release_value());
dbgln("RTL8139: TX buffer {}: {}", i, m_tx_buffers[i]->physical_page(0)->paddr()); dbgln("RTL8139: TX buffer {}: {}", i, m_tx_buffers[i]->physical_page(0)->paddr());
} }

View file

@ -246,8 +246,8 @@ UNMAP_AFTER_INIT RTL8168NetworkAdapter::RTL8168NetworkAdapter(PCI::Address addre
, PCI::Device(address) , PCI::Device(address)
, IRQHandler(irq) , IRQHandler(irq)
, m_io_base(PCI::get_BAR0(pci_address()) & ~1) , m_io_base(PCI::get_BAR0(pci_address()) & ~1)
, m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(TXDescriptor) * (number_of_rx_descriptors + 1)).release_value_but_fixme_should_propagate_errors(), "RTL8168 RX", Memory::Region::Access::ReadWrite).release_value()) , m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(TXDescriptor) * (number_of_rx_descriptors + 1)).release_value_but_fixme_should_propagate_errors(), "RTL8168 RX"sv, Memory::Region::Access::ReadWrite).release_value())
, m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(RXDescriptor) * (number_of_tx_descriptors + 1)).release_value_but_fixme_should_propagate_errors(), "RTL8168 TX", Memory::Region::Access::ReadWrite).release_value()) , m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(RXDescriptor) * (number_of_tx_descriptors + 1)).release_value_but_fixme_should_propagate_errors(), "RTL8168 TX"sv, Memory::Region::Access::ReadWrite).release_value())
{ {
dmesgln("RTL8168: Found @ {}", pci_address()); dmesgln("RTL8168: Found @ {}", pci_address());
dmesgln("RTL8168: I/O port base: {}", m_io_base); dmesgln("RTL8168: I/O port base: {}", m_io_base);
@ -1095,7 +1095,7 @@ UNMAP_AFTER_INIT void RTL8168NetworkAdapter::initialize_rx_descriptors()
auto* rx_descriptors = (RXDescriptor*)m_rx_descriptors_region->vaddr().as_ptr(); auto* rx_descriptors = (RXDescriptor*)m_rx_descriptors_region->vaddr().as_ptr();
for (size_t i = 0; i < number_of_rx_descriptors; ++i) { for (size_t i = 0; i < number_of_rx_descriptors; ++i) {
auto& descriptor = rx_descriptors[i]; auto& descriptor = rx_descriptors[i];
auto region = MM.allocate_contiguous_kernel_region(Memory::page_round_up(RX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8168 RX buffer", Memory::Region::Access::ReadWrite).release_value(); auto region = MM.allocate_contiguous_kernel_region(Memory::page_round_up(RX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8168 RX buffer"sv, Memory::Region::Access::ReadWrite).release_value();
memset(region->vaddr().as_ptr(), 0, region->size()); // MM already zeros out newly allocated pages, but we do it again in case that ever changes memset(region->vaddr().as_ptr(), 0, region->size()); // MM already zeros out newly allocated pages, but we do it again in case that ever changes
m_rx_buffers_regions.append(move(region)); m_rx_buffers_regions.append(move(region));
@ -1113,7 +1113,7 @@ UNMAP_AFTER_INIT void RTL8168NetworkAdapter::initialize_tx_descriptors()
auto* tx_descriptors = (TXDescriptor*)m_tx_descriptors_region->vaddr().as_ptr(); auto* tx_descriptors = (TXDescriptor*)m_tx_descriptors_region->vaddr().as_ptr();
for (size_t i = 0; i < number_of_tx_descriptors; ++i) { for (size_t i = 0; i < number_of_tx_descriptors; ++i) {
auto& descriptor = tx_descriptors[i]; auto& descriptor = tx_descriptors[i];
auto region = MM.allocate_contiguous_kernel_region(Memory::page_round_up(TX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8168 TX buffer", Memory::Region::Access::ReadWrite).release_value(); auto region = MM.allocate_contiguous_kernel_region(Memory::page_round_up(TX_BUFFER_SIZE).release_value_but_fixme_should_propagate_errors(), "RTL8168 TX buffer"sv, Memory::Region::Access::ReadWrite).release_value();
memset(region->vaddr().as_ptr(), 0, region->size()); // MM already zeros out newly allocated pages, but we do it again in case that ever changes memset(region->vaddr().as_ptr(), 0, region->size()); // MM already zeros out newly allocated pages, but we do it again in case that ever changes
m_tx_buffers_regions.append(move(region)); m_tx_buffers_regions.append(move(region));
@ -1204,7 +1204,7 @@ void RTL8168NetworkAdapter::send_raw(ReadonlyBytes payload)
if ((free_descriptor.flags & TXDescriptor::Ownership) != 0) { if ((free_descriptor.flags & TXDescriptor::Ownership) != 0) {
dbgln_if(RTL8168_DEBUG, "RTL8168: No free TX buffers, sleeping until one is available"); dbgln_if(RTL8168_DEBUG, "RTL8168: No free TX buffers, sleeping until one is available");
m_wait_queue.wait_forever("RTL8168NetworkAdapter"); m_wait_queue.wait_forever("RTL8168NetworkAdapter"sv);
return send_raw(payload); return send_raw(payload);
// if we woke up a TX descriptor is guaranteed to be available, so this should never recurse more than once // if we woke up a TX descriptor is guaranteed to be available, so this should never recurse more than once
// but this can probably be done more cleanly // but this can probably be done more cleanly
@ -1664,7 +1664,7 @@ StringView RTL8168NetworkAdapter::possible_device_name()
case ChipVersion::Version19: case ChipVersion::Version19:
return "RTL8168F/8111F"sv; // 35, 36 return "RTL8168F/8111F"sv; // 35, 36
case ChipVersion::Version20: case ChipVersion::Version20:
return "RTL8411"; // 38 return "RTL8411"sv; // 38
case ChipVersion::Version21: case ChipVersion::Version21:
case ChipVersion::Version22: case ChipVersion::Version22:
return "RTL8168G/8111G"sv; // 40, 41, 42 return "RTL8168G/8111G"sv; // 40, 41, 42
@ -1676,7 +1676,7 @@ StringView RTL8168NetworkAdapter::possible_device_name()
case ChipVersion::Version25: case ChipVersion::Version25:
return "RTL8168GU/8111GU"sv; // ??? return "RTL8168GU/8111GU"sv; // ???
case ChipVersion::Version26: case ChipVersion::Version26:
return "RTL8411B"; // 44 return "RTL8411B"sv; // 44
case ChipVersion::Version29: case ChipVersion::Version29:
case ChipVersion::Version30: case ChipVersion::Version30:
return "RTL8168H/8111H"sv; // 45, 46 return "RTL8168H/8111H"sv; // 45, 46

View file

@ -88,7 +88,7 @@ public:
case State::TimeWait: case State::TimeWait:
return "TimeWait"sv; return "TimeWait"sv;
default: default:
return "None"; return "None"sv;
} }
} }

View file

@ -191,7 +191,7 @@ template<typename Serializer>
ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const
{ {
{ {
auto strings = TRY(object.add_array("strings")); auto strings = TRY(object.add_array("strings"sv));
Vector<KString*> strings_sorted_by_index; Vector<KString*> strings_sorted_by_index;
TRY(strings_sorted_by_index.try_resize(m_strings.size())); TRY(strings_sorted_by_index.try_resize(m_strings.size()));
@ -207,7 +207,7 @@ ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const
} }
bool show_kernel_addresses = Process::current().is_superuser(); bool show_kernel_addresses = Process::current().is_superuser();
auto array = TRY(object.add_array("events")); auto array = TRY(object.add_array("events"sv));
bool seen_first_sample = false; bool seen_first_sample = false;
for (size_t i = 0; i < m_count; ++i) { for (size_t i = 0; i < m_count; ++i) {
auto const& event = at(i); auto const& event = at(i);
@ -220,67 +220,67 @@ ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const
auto event_object = TRY(array.add_object()); auto event_object = TRY(array.add_object());
switch (event.type) { switch (event.type) {
case PERF_EVENT_SAMPLE: case PERF_EVENT_SAMPLE:
TRY(event_object.add("type", "sample")); TRY(event_object.add("type"sv, "sample"));
break; break;
case PERF_EVENT_MALLOC: case PERF_EVENT_MALLOC:
TRY(event_object.add("type", "malloc")); TRY(event_object.add("type"sv, "malloc"));
TRY(event_object.add("ptr", static_cast<u64>(event.data.malloc.ptr))); TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.malloc.ptr)));
TRY(event_object.add("size", static_cast<u64>(event.data.malloc.size))); TRY(event_object.add("size"sv, static_cast<u64>(event.data.malloc.size)));
break; break;
case PERF_EVENT_FREE: case PERF_EVENT_FREE:
TRY(event_object.add("type", "free")); TRY(event_object.add("type"sv, "free"));
TRY(event_object.add("ptr", static_cast<u64>(event.data.free.ptr))); TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.free.ptr)));
break; break;
case PERF_EVENT_MMAP: case PERF_EVENT_MMAP:
TRY(event_object.add("type", "mmap")); TRY(event_object.add("type"sv, "mmap"));
TRY(event_object.add("ptr", static_cast<u64>(event.data.mmap.ptr))); TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.mmap.ptr)));
TRY(event_object.add("size", static_cast<u64>(event.data.mmap.size))); TRY(event_object.add("size"sv, static_cast<u64>(event.data.mmap.size)));
TRY(event_object.add("name", event.data.mmap.name)); TRY(event_object.add("name"sv, event.data.mmap.name));
break; break;
case PERF_EVENT_MUNMAP: case PERF_EVENT_MUNMAP:
TRY(event_object.add("type", "munmap")); TRY(event_object.add("type"sv, "munmap"));
TRY(event_object.add("ptr", static_cast<u64>(event.data.munmap.ptr))); TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.munmap.ptr)));
TRY(event_object.add("size", static_cast<u64>(event.data.munmap.size))); TRY(event_object.add("size"sv, static_cast<u64>(event.data.munmap.size)));
break; break;
case PERF_EVENT_PROCESS_CREATE: case PERF_EVENT_PROCESS_CREATE:
TRY(event_object.add("type", "process_create")); TRY(event_object.add("type"sv, "process_create"));
TRY(event_object.add("parent_pid", static_cast<u64>(event.data.process_create.parent_pid))); TRY(event_object.add("parent_pid"sv, static_cast<u64>(event.data.process_create.parent_pid)));
TRY(event_object.add("executable", event.data.process_create.executable)); TRY(event_object.add("executable"sv, event.data.process_create.executable));
break; break;
case PERF_EVENT_PROCESS_EXEC: case PERF_EVENT_PROCESS_EXEC:
TRY(event_object.add("type", "process_exec")); TRY(event_object.add("type"sv, "process_exec"));
TRY(event_object.add("executable", event.data.process_exec.executable)); TRY(event_object.add("executable"sv, event.data.process_exec.executable));
break; break;
case PERF_EVENT_PROCESS_EXIT: case PERF_EVENT_PROCESS_EXIT:
TRY(event_object.add("type", "process_exit")); TRY(event_object.add("type"sv, "process_exit"));
break; break;
case PERF_EVENT_THREAD_CREATE: case PERF_EVENT_THREAD_CREATE:
TRY(event_object.add("type", "thread_create")); TRY(event_object.add("type"sv, "thread_create"));
TRY(event_object.add("parent_tid", static_cast<u64>(event.data.thread_create.parent_tid))); TRY(event_object.add("parent_tid"sv, static_cast<u64>(event.data.thread_create.parent_tid)));
break; break;
case PERF_EVENT_THREAD_EXIT: case PERF_EVENT_THREAD_EXIT:
TRY(event_object.add("type", "thread_exit")); TRY(event_object.add("type"sv, "thread_exit"));
break; break;
case PERF_EVENT_CONTEXT_SWITCH: case PERF_EVENT_CONTEXT_SWITCH:
TRY(event_object.add("type", "context_switch")); TRY(event_object.add("type"sv, "context_switch"));
TRY(event_object.add("next_pid", static_cast<u64>(event.data.context_switch.next_pid))); TRY(event_object.add("next_pid"sv, static_cast<u64>(event.data.context_switch.next_pid)));
TRY(event_object.add("next_tid", static_cast<u64>(event.data.context_switch.next_tid))); TRY(event_object.add("next_tid"sv, static_cast<u64>(event.data.context_switch.next_tid)));
break; break;
case PERF_EVENT_KMALLOC: case PERF_EVENT_KMALLOC:
TRY(event_object.add("type", "kmalloc")); TRY(event_object.add("type"sv, "kmalloc"));
TRY(event_object.add("ptr", static_cast<u64>(event.data.kmalloc.ptr))); TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.kmalloc.ptr)));
TRY(event_object.add("size", static_cast<u64>(event.data.kmalloc.size))); TRY(event_object.add("size"sv, static_cast<u64>(event.data.kmalloc.size)));
break; break;
case PERF_EVENT_KFREE: case PERF_EVENT_KFREE:
TRY(event_object.add("type", "kfree")); TRY(event_object.add("type"sv, "kfree"));
TRY(event_object.add("ptr", static_cast<u64>(event.data.kfree.ptr))); TRY(event_object.add("ptr"sv, static_cast<u64>(event.data.kfree.ptr)));
TRY(event_object.add("size", static_cast<u64>(event.data.kfree.size))); TRY(event_object.add("size"sv, static_cast<u64>(event.data.kfree.size)));
break; break;
case PERF_EVENT_PAGE_FAULT: case PERF_EVENT_PAGE_FAULT:
TRY(event_object.add("type", "page_fault")); TRY(event_object.add("type"sv, "page_fault"));
break; break;
case PERF_EVENT_SYSCALL: case PERF_EVENT_SYSCALL:
TRY(event_object.add("type", "syscall")); TRY(event_object.add("type"sv, "syscall"));
break; break;
case PERF_EVENT_SIGNPOST: case PERF_EVENT_SIGNPOST:
TRY(event_object.add("type"sv, "signpost"sv)); TRY(event_object.add("type"sv, "signpost"sv));
@ -288,21 +288,21 @@ ErrorOr<void> PerformanceEventBuffer::to_json_impl(Serializer& object) const
TRY(event_object.add("arg2"sv, event.data.signpost.arg2)); TRY(event_object.add("arg2"sv, event.data.signpost.arg2));
break; break;
case PERF_EVENT_READ: case PERF_EVENT_READ:
TRY(event_object.add("type", "read")); TRY(event_object.add("type"sv, "read"));
TRY(event_object.add("fd", event.data.read.fd)); TRY(event_object.add("fd"sv, event.data.read.fd));
TRY(event_object.add("size"sv, event.data.read.size)); TRY(event_object.add("size"sv, event.data.read.size));
TRY(event_object.add("filename_index"sv, event.data.read.filename_index)); TRY(event_object.add("filename_index"sv, event.data.read.filename_index));
TRY(event_object.add("start_timestamp"sv, event.data.read.start_timestamp)); TRY(event_object.add("start_timestamp"sv, event.data.read.start_timestamp));
TRY(event_object.add("success"sv, event.data.read.success)); TRY(event_object.add("success"sv, event.data.read.success));
break; break;
} }
TRY(event_object.add("pid", event.pid)); TRY(event_object.add("pid"sv, event.pid));
TRY(event_object.add("tid", event.tid)); TRY(event_object.add("tid"sv, event.tid));
TRY(event_object.add("timestamp", event.timestamp)); TRY(event_object.add("timestamp"sv, event.timestamp));
TRY(event_object.add("lost_samples", seen_first_sample ? event.lost_samples : 0)); TRY(event_object.add("lost_samples"sv, seen_first_sample ? event.lost_samples : 0));
if (event.type == PERF_EVENT_SAMPLE) if (event.type == PERF_EVENT_SAMPLE)
seen_first_sample = true; seen_first_sample = true;
auto stack_array = TRY(event_object.add_array("stack")); auto stack_array = TRY(event_object.add_array("stack"sv));
for (size_t j = 0; j < event.stack_size; ++j) { for (size_t j = 0; j < event.stack_size; ++j) {
auto address = event.stack[j]; auto address = event.stack[j];
if (!show_kernel_addresses && !Memory::is_user_address(VirtualAddress { address })) if (!show_kernel_addresses && !Memory::is_user_address(VirtualAddress { address }))

View file

@ -149,7 +149,7 @@ public:
return; return;
filepath_string_index = registered_result.value(); filepath_string_index = registered_result.value();
} else { } else {
auto invalid_path_string = KString::try_create("<INVALID_FILE_PATH>"); // TODO: Performance, unecessary allocations. auto invalid_path_string = KString::try_create("<INVALID_FILE_PATH>"sv); // TODO: Performance, unecessary allocations.
if (invalid_path_string.is_error()) if (invalid_path_string.is_error())
return; return;
auto registered_result = event_buffer->register_string(move(invalid_path_string.value())); auto registered_result = event_buffer->register_string(move(invalid_path_string.value()));

View file

@ -61,8 +61,8 @@ struct AK::Formatter<PhysicalAddress> : AK::Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, PhysicalAddress value) ErrorOr<void> format(FormatBuilder& builder, PhysicalAddress value)
{ {
if constexpr (sizeof(PhysicalPtr) == sizeof(u64)) if constexpr (sizeof(PhysicalPtr) == sizeof(u64))
return AK::Formatter<FormatString>::format(builder, "P{:016x}", value.get()); return AK::Formatter<FormatString>::format(builder, "P{:016x}"sv, value.get());
else else
return AK::Formatter<FormatString>::format(builder, "P{}", value.as_ptr()); return AK::Formatter<FormatString>::format(builder, "P{}"sv, value.as_ptr());
} }
}; };

View file

@ -374,7 +374,7 @@ extern "C" char const asm_signal_trampoline_end[];
void create_signal_trampoline() void create_signal_trampoline()
{ {
// NOTE: We leak this region. // NOTE: We leak this region.
g_signal_trampoline_region = MM.allocate_kernel_region(PAGE_SIZE, "Signal trampolines", Memory::Region::Access::ReadWrite).release_value().leak_ptr(); g_signal_trampoline_region = MM.allocate_kernel_region(PAGE_SIZE, "Signal trampolines"sv, Memory::Region::Access::ReadWrite).release_value().leak_ptr();
g_signal_trampoline_region->set_syscall_region(true); g_signal_trampoline_region->set_syscall_region(true);
size_t trampoline_size = asm_signal_trampoline_end - asm_signal_trampoline; size_t trampoline_size = asm_signal_trampoline_end - asm_signal_trampoline;
@ -905,7 +905,7 @@ static constexpr StringView to_string(Pledge promise)
{ {
#define __ENUMERATE_PLEDGE_PROMISE(x) \ #define __ENUMERATE_PLEDGE_PROMISE(x) \
case Pledge::x: \ case Pledge::x: \
return #x; return #x##sv;
switch (promise) { switch (promise) {
ENUMERATE_PLEDGE_PROMISES ENUMERATE_PLEDGE_PROMISES
} }

View file

@ -819,8 +819,8 @@ private:
size_t m_master_tls_size { 0 }; size_t m_master_tls_size { 0 };
size_t m_master_tls_alignment { 0 }; size_t m_master_tls_alignment { 0 };
Mutex m_big_lock { "Process", Mutex::MutexBehavior::BigLock }; Mutex m_big_lock { "Process"sv, Mutex::MutexBehavior::BigLock };
Mutex m_ptrace_lock { "ptrace" }; Mutex m_ptrace_lock { "ptrace"sv };
RefPtr<Timer> m_alarm_timer; RefPtr<Timer> m_alarm_timer;
@ -1036,6 +1036,6 @@ template<>
struct AK::Formatter<Kernel::Process> : AK::Formatter<FormatString> { struct AK::Formatter<Kernel::Process> : AK::Formatter<FormatString> {
ErrorOr<void> format(FormatBuilder& builder, Kernel::Process const& value) ErrorOr<void> format(FormatBuilder& builder, Kernel::Process const& value)
{ {
return AK::Formatter<FormatString>::format(builder, "{}({})", value.name(), value.pid().value()); return AK::Formatter<FormatString>::format(builder, "{}({})"sv, value.name(), value.pid().value());
} }
}; };

View file

@ -241,8 +241,8 @@ ErrorOr<void> ProcFSExposedDirectory::traverse_as_directory(FileSystemID fsid, F
auto parent_directory = m_parent_directory.strong_ref(); auto parent_directory = m_parent_directory.strong_ref();
if (parent_directory.is_null()) if (parent_directory.is_null())
return Error::from_errno(EINVAL); return Error::from_errno(EINVAL);
TRY(callback({ ".", { fsid, component_index() }, DT_DIR })); TRY(callback({ "."sv, { fsid, component_index() }, DT_DIR }));
TRY(callback({ "..", { fsid, parent_directory->component_index() }, DT_DIR })); TRY(callback({ ".."sv, { fsid, parent_directory->component_index() }, DT_DIR }));
for (auto const& component : m_components) { for (auto const& component : m_components) {
InodeIdentifier identifier = { fsid, component.component_index() }; InodeIdentifier identifier = { fsid, component.component_index() };

View file

@ -138,7 +138,7 @@ public:
protected: protected:
virtual bool acquire_link(KBufferBuilder& builder) = 0; virtual bool acquire_link(KBufferBuilder& builder) = 0;
explicit ProcFSExposedLink(StringView name); explicit ProcFSExposedLink(StringView name);
mutable Mutex m_lock { "ProcFSLink" }; mutable Mutex m_lock { "ProcFSLink"sv };
}; };
namespace PCI { namespace PCI {

View file

@ -51,19 +51,19 @@ ErrorOr<void> Process::ProcessProcFSTraits::traverse_as_directory(FileSystemID f
if (!process) if (!process)
return ESRCH; return ESRCH;
TRY(callback({ ".", { fsid, SegmentedProcFSIndex::build_segmented_index_for_pid_directory(process->pid()) }, DT_DIR })); TRY(callback({ "."sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_pid_directory(process->pid()) }, DT_DIR }));
TRY(callback({ "..", { fsid, ProcFSComponentRegistry::the().root_directory().component_index() }, DT_DIR })); TRY(callback({ ".."sv, { fsid, ProcFSComponentRegistry::the().root_directory().component_index() }, DT_DIR }));
TRY(callback({ "fd", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::OpenFileDescriptions) }, DT_DIR })); TRY(callback({ "fd"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::OpenFileDescriptions) }, DT_DIR }));
TRY(callback({ "stacks", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks) }, DT_DIR })); TRY(callback({ "stacks"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks) }, DT_DIR }));
TRY(callback({ "children", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, DT_DIR })); TRY(callback({ "children"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(process->pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, DT_DIR }));
TRY(callback({ "unveil", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Unveil) }, DT_REG })); TRY(callback({ "unveil"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Unveil) }, DT_REG }));
TRY(callback({ "pledge", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Pledge) }, DT_REG })); TRY(callback({ "pledge"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::Pledge) }, DT_REG }));
TRY(callback({ "fds", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::OpenFileDescriptions) }, DT_DIR })); TRY(callback({ "fds"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::OpenFileDescriptions) }, DT_DIR }));
TRY(callback({ "exe", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::BinaryLink) }, DT_LNK })); TRY(callback({ "exe"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::BinaryLink) }, DT_LNK }));
TRY(callback({ "cwd", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::CurrentWorkDirectoryLink) }, DT_LNK })); TRY(callback({ "cwd"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::CurrentWorkDirectoryLink) }, DT_LNK }));
TRY(callback({ "perf_events", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::PerformanceEvents) }, DT_REG })); TRY(callback({ "perf_events"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::PerformanceEvents) }, DT_REG }));
TRY(callback({ "vm", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::VirtualMemoryStats) }, DT_REG })); TRY(callback({ "vm"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::VirtualMemoryStats) }, DT_REG }));
TRY(callback({ "cmdline", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::CommandLine) }, DT_REG })); TRY(callback({ "cmdline"sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property_in_pid_directory(process->pid(), SegmentedProcFSIndex::MainProcessProperty::CommandLine) }, DT_REG }));
return {}; return {};
} }

View file

@ -43,8 +43,8 @@ ErrorOr<void> Process::procfs_get_thread_stack(ThreadID thread_id, KBufferBuilde
ErrorOr<void> Process::traverse_stacks_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const ErrorOr<void> Process::traverse_stacks_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{ {
TRY(callback({ ".", { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks, SegmentedProcFSIndex::MainProcessProperty::Reserved) }, 0 })); TRY(callback({ "."sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_main_property(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Stacks, SegmentedProcFSIndex::MainProcessProperty::Reserved) }, 0 }));
TRY(callback({ "..", { fsid, m_procfs_traits->component_index() }, 0 })); TRY(callback({ ".."sv, { fsid, m_procfs_traits->component_index() }, 0 }));
return thread_list().with([&](auto& list) -> ErrorOr<void> { return thread_list().with([&](auto& list) -> ErrorOr<void> {
for (auto const& thread : list) { for (auto const& thread : list) {
@ -82,8 +82,8 @@ ErrorOr<NonnullRefPtr<Inode>> Process::lookup_stacks_directory(ProcFS const& pro
ErrorOr<void> Process::traverse_children_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const ErrorOr<void> Process::traverse_children_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{ {
TRY(callback({ ".", { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, 0 })); TRY(callback({ "."sv, { fsid, SegmentedProcFSIndex::build_segmented_index_for_sub_directory(pid(), SegmentedProcFSIndex::ProcessSubDirectory::Children) }, 0 }));
TRY(callback({ "..", { fsid, m_procfs_traits->component_index() }, 0 })); TRY(callback({ ".."sv, { fsid, m_procfs_traits->component_index() }, 0 }));
return Process::all_instances().with([&](auto& processes) -> ErrorOr<void> { return Process::all_instances().with([&](auto& processes) -> ErrorOr<void> {
for (auto& process : processes) { for (auto& process : processes) {
if (process.ppid() == pid()) { if (process.ppid() == pid()) {
@ -126,8 +126,8 @@ ErrorOr<size_t> Process::procfs_get_file_description_link(unsigned fd, KBufferBu
ErrorOr<void> Process::traverse_file_descriptions_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const ErrorOr<void> Process::traverse_file_descriptions_directory(FileSystemID fsid, Function<ErrorOr<void>(FileSystem::DirectoryEntryView const&)> callback) const
{ {
TRY(callback({ ".", { fsid, m_procfs_traits->component_index() }, 0 })); TRY(callback({ "."sv, { fsid, m_procfs_traits->component_index() }, 0 }));
TRY(callback({ "..", { fsid, m_procfs_traits->component_index() }, 0 })); TRY(callback({ ".."sv, { fsid, m_procfs_traits->component_index() }, 0 }));
size_t count = 0; size_t count = 0;
fds().with_shared([&](auto& fds) { fds().with_shared([&](auto& fds) {
fds.enumerate([&](auto& file_description_metadata) { fds.enumerate([&](auto& file_description_metadata) {
@ -164,12 +164,12 @@ ErrorOr<void> Process::procfs_get_pledge_stats(KBufferBuilder& builder) const
if (has_promised(Pledge::x)) { \ if (has_promised(Pledge::x)) { \
if (!promises_builder.is_empty()) \ if (!promises_builder.is_empty()) \
TRY(promises_builder.try_append(' ')); \ TRY(promises_builder.try_append(' ')); \
TRY(promises_builder.try_append(#x)); \ TRY(promises_builder.try_append(#x##sv)); \
} }
if (has_promises()) { if (has_promises()) {
StringBuilder promises_builder; StringBuilder promises_builder;
ENUMERATE_PLEDGE_PROMISES ENUMERATE_PLEDGE_PROMISES
TRY(obj.add("promises", promises_builder.string_view())); TRY(obj.add("promises"sv, promises_builder.string_view()));
} }
#undef __ENUMERATE_PLEDGE_PROMISE #undef __ENUMERATE_PLEDGE_PROMISE
TRY(obj.finish()); TRY(obj.finish());
@ -184,7 +184,7 @@ ErrorOr<void> Process::procfs_get_unveil_stats(KBufferBuilder& builder) const
if (!unveiled_path.was_explicitly_unveiled()) if (!unveiled_path.was_explicitly_unveiled())
return IterationDecision::Continue; return IterationDecision::Continue;
auto obj = TRY(array.add_object()); auto obj = TRY(array.add_object());
TRY(obj.add("path", unveiled_path.path())); TRY(obj.add("path"sv, unveiled_path.path()));
StringBuilder permissions_builder; StringBuilder permissions_builder;
if (unveiled_path.permissions() & UnveilAccess::Read) if (unveiled_path.permissions() & UnveilAccess::Read)
permissions_builder.append('r'); permissions_builder.append('r');
@ -196,7 +196,7 @@ ErrorOr<void> Process::procfs_get_unveil_stats(KBufferBuilder& builder) const
permissions_builder.append('c'); permissions_builder.append('c');
if (unveiled_path.permissions() & UnveilAccess::Browse) if (unveiled_path.permissions() & UnveilAccess::Browse)
permissions_builder.append('b'); permissions_builder.append('b');
TRY(obj.add("permissions", permissions_builder.string_view())); TRY(obj.add("permissions"sv, permissions_builder.string_view()));
TRY(obj.finish()); TRY(obj.finish());
return IterationDecision::Continue; return IterationDecision::Continue;
})); }));
@ -235,22 +235,22 @@ ErrorOr<void> Process::procfs_get_fds_stats(KBufferBuilder& builder) const
bool cloexec = file_description_metadata.flags() & FD_CLOEXEC; bool cloexec = file_description_metadata.flags() & FD_CLOEXEC;
RefPtr<OpenFileDescription> description = file_description_metadata.description(); RefPtr<OpenFileDescription> description = file_description_metadata.description();
auto description_object = TRY(array.add_object()); auto description_object = TRY(array.add_object());
TRY(description_object.add("fd", count)); TRY(description_object.add("fd"sv, count));
// TODO: Better OOM handling. // TODO: Better OOM handling.
auto pseudo_path_or_error = description->pseudo_path(); auto pseudo_path_or_error = description->pseudo_path();
TRY(description_object.add("absolute_path", pseudo_path_or_error.is_error() ? "???"sv : pseudo_path_or_error.value()->view())); TRY(description_object.add("absolute_path"sv, pseudo_path_or_error.is_error() ? "???"sv : pseudo_path_or_error.value()->view()));
TRY(description_object.add("seekable", description->file().is_seekable())); TRY(description_object.add("seekable"sv, description->file().is_seekable()));
TRY(description_object.add("class", description->file().class_name())); TRY(description_object.add("class"sv, description->file().class_name()));
TRY(description_object.add("offset", description->offset())); TRY(description_object.add("offset"sv, description->offset()));
TRY(description_object.add("cloexec", cloexec)); TRY(description_object.add("cloexec"sv, cloexec));
TRY(description_object.add("blocking", description->is_blocking())); TRY(description_object.add("blocking"sv, description->is_blocking()));
TRY(description_object.add("can_read", description->can_read())); TRY(description_object.add("can_read"sv, description->can_read()));
TRY(description_object.add("can_write", description->can_write())); TRY(description_object.add("can_write"sv, description->can_write()));
Inode* inode = description->inode(); Inode* inode = description->inode();
if (inode != nullptr) { if (inode != nullptr) {
auto inode_object = TRY(description_object.add_object("inode")); auto inode_object = TRY(description_object.add_object("inode"sv));
TRY(inode_object.add("fsid", inode->fsid().value())); TRY(inode_object.add("fsid"sv, inode->fsid().value()));
TRY(inode_object.add("index", inode->index().value())); TRY(inode_object.add("index"sv, inode->index().value()));
TRY(inode_object.finish()); TRY(inode_object.finish());
} }
TRY(description_object.finish()); TRY(description_object.finish());
@ -272,24 +272,24 @@ ErrorOr<void> Process::procfs_get_virtual_memory_stats(KBufferBuilder& builder)
if (!region.is_user() && !Process::current().is_superuser()) if (!region.is_user() && !Process::current().is_superuser())
continue; continue;
auto region_object = TRY(array.add_object()); auto region_object = TRY(array.add_object());
TRY(region_object.add("readable", region.is_readable())); TRY(region_object.add("readable"sv, region.is_readable()));
TRY(region_object.add("writable", region.is_writable())); TRY(region_object.add("writable"sv, region.is_writable()));
TRY(region_object.add("executable", region.is_executable())); TRY(region_object.add("executable"sv, region.is_executable()));
TRY(region_object.add("stack", region.is_stack())); TRY(region_object.add("stack"sv, region.is_stack()));
TRY(region_object.add("shared", region.is_shared())); TRY(region_object.add("shared"sv, region.is_shared()));
TRY(region_object.add("syscall", region.is_syscall_region())); TRY(region_object.add("syscall"sv, region.is_syscall_region()));
TRY(region_object.add("purgeable", region.vmobject().is_anonymous())); TRY(region_object.add("purgeable"sv, region.vmobject().is_anonymous()));
if (region.vmobject().is_anonymous()) { if (region.vmobject().is_anonymous()) {
TRY(region_object.add("volatile", static_cast<Memory::AnonymousVMObject const&>(region.vmobject()).is_volatile())); TRY(region_object.add("volatile"sv, static_cast<Memory::AnonymousVMObject const&>(region.vmobject()).is_volatile()));
} }
TRY(region_object.add("cacheable", region.is_cacheable())); TRY(region_object.add("cacheable"sv, region.is_cacheable()));
TRY(region_object.add("address", region.vaddr().get())); TRY(region_object.add("address"sv, region.vaddr().get()));
TRY(region_object.add("size", region.size())); TRY(region_object.add("size"sv, region.size()));
TRY(region_object.add("amount_resident", region.amount_resident())); TRY(region_object.add("amount_resident"sv, region.amount_resident()));
TRY(region_object.add("amount_dirty", region.amount_dirty())); TRY(region_object.add("amount_dirty"sv, region.amount_dirty()));
TRY(region_object.add("cow_pages", region.cow_pages())); TRY(region_object.add("cow_pages"sv, region.cow_pages()));
TRY(region_object.add("name", region.name())); TRY(region_object.add("name"sv, region.name()));
TRY(region_object.add("vmobject", region.vmobject().class_name())); TRY(region_object.add("vmobject"sv, region.vmobject().class_name()));
StringBuilder pagemap_builder; StringBuilder pagemap_builder;
for (size_t i = 0; i < region.page_count(); ++i) { for (size_t i = 0; i < region.page_count(); ++i) {
@ -301,7 +301,7 @@ ErrorOr<void> Process::procfs_get_virtual_memory_stats(KBufferBuilder& builder)
else else
pagemap_builder.append('P'); pagemap_builder.append('P');
} }
TRY(region_object.add("pagemap", pagemap_builder.string_view())); TRY(region_object.add("pagemap"sv, pagemap_builder.string_view()));
TRY(region_object.finish()); TRY(region_object.finish());
} }
} }

View file

@ -73,7 +73,7 @@ void KernelRng::wait_for_entropy()
SpinlockLocker lock(get_lock()); SpinlockLocker lock(get_lock());
if (!is_ready()) { if (!is_ready()) {
dbgln("Entropy starvation..."); dbgln("Entropy starvation...");
m_seed_queue.wait_forever("KernelRng"); m_seed_queue.wait_forever("KernelRng"sv);
} }
} }

View file

@ -401,11 +401,11 @@ UNMAP_AFTER_INIT void Scheduler::initialize()
g_finalizer_wait_queue = new WaitQueue; g_finalizer_wait_queue = new WaitQueue;
g_finalizer_has_work.store(false, AK::MemoryOrder::memory_order_release); g_finalizer_has_work.store(false, AK::MemoryOrder::memory_order_release);
s_colonel_process = Process::create_kernel_process(idle_thread, KString::must_create("colonel"), idle_loop, nullptr, 1, Process::RegisterProcess::No).leak_ref(); s_colonel_process = Process::create_kernel_process(idle_thread, KString::must_create("colonel"sv), idle_loop, nullptr, 1, Process::RegisterProcess::No).leak_ref();
VERIFY(s_colonel_process); VERIFY(s_colonel_process);
VERIFY(idle_thread); VERIFY(idle_thread);
idle_thread->set_priority(THREAD_PRIORITY_MIN); idle_thread->set_priority(THREAD_PRIORITY_MIN);
idle_thread->set_name(KString::must_create("Idle Task #0")); idle_thread->set_name(KString::must_create("Idle Task #0"sv));
set_idle_thread(idle_thread); set_idle_thread(idle_thread);
} }

View file

@ -155,7 +155,7 @@ AHCI::HBADefinedCapabilities AHCIController::capabilities() const
UNMAP_AFTER_INIT NonnullOwnPtr<Memory::Region> AHCIController::default_hba_region() const UNMAP_AFTER_INIT NonnullOwnPtr<Memory::Region> AHCIController::default_hba_region() const
{ {
return MM.allocate_kernel_region(PhysicalAddress(PCI::get_BAR5(pci_address())).page_base(), Memory::page_round_up(sizeof(AHCI::HBA)).release_value_but_fixme_should_propagate_errors(), "AHCI HBA", Memory::Region::Access::ReadWrite).release_value(); return MM.allocate_kernel_region(PhysicalAddress(PCI::get_BAR5(pci_address())).page_base(), Memory::page_round_up(sizeof(AHCI::HBA)).release_value_but_fixme_should_propagate_errors(), "AHCI HBA"sv, Memory::Region::Access::ReadWrite).release_value();
} }
AHCIController::~AHCIController() = default; AHCIController::~AHCIController() = default;

View file

@ -46,7 +46,7 @@ ErrorOr<void> AHCIPort::allocate_resources_and_initialize_ports()
m_command_table_pages.append(move(command_table_page)); m_command_table_pages.append(move(command_table_page));
} }
m_command_list_region = TRY(MM.allocate_dma_buffer_page("AHCI Port Command List", Memory::Region::Access::ReadWrite, m_command_list_page)); m_command_list_region = TRY(MM.allocate_dma_buffer_page("AHCI Port Command List"sv, Memory::Region::Access::ReadWrite, m_command_list_page));
dbgln_if(AHCI_DEBUG, "AHCI Port {}: Command list page at {}", representative_port_index(), m_command_list_page->paddr()); dbgln_if(AHCI_DEBUG, "AHCI Port {}: Command list page at {}", representative_port_index(), m_command_list_page->paddr());
dbgln_if(AHCI_DEBUG, "AHCI Port {}: FIS receive page at {}", representative_port_index(), m_fis_receive_page->paddr()); dbgln_if(AHCI_DEBUG, "AHCI Port {}: FIS receive page at {}", representative_port_index(), m_fis_receive_page->paddr());
@ -220,7 +220,7 @@ void AHCIPort::eject()
// handshake error bit in PxSERR register if CFL is incorrect. // handshake error bit in PxSERR register if CFL is incorrect.
command_list_entries[unused_command_header.value()].attributes = (size_t)FIS::DwordCount::RegisterHostToDevice | AHCI::CommandHeaderAttributes::P | AHCI::CommandHeaderAttributes::C | AHCI::CommandHeaderAttributes::A; command_list_entries[unused_command_header.value()].attributes = (size_t)FIS::DwordCount::RegisterHostToDevice | AHCI::CommandHeaderAttributes::P | AHCI::CommandHeaderAttributes::C | AHCI::CommandHeaderAttributes::A;
auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No).release_value(); auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No).release_value();
auto& command_table = *(volatile AHCI::CommandTable*)command_table_region->vaddr().as_ptr(); auto& command_table = *(volatile AHCI::CommandTable*)command_table_region->vaddr().as_ptr();
memset(const_cast<u8*>(command_table.command_fis), 0, 64); memset(const_cast<u8*>(command_table.command_fis), 0, 64);
auto& fis = *(volatile FIS::HostToDevice::Register*)command_table.command_fis; auto& fis = *(volatile FIS::HostToDevice::Register*)command_table.command_fis;
@ -590,7 +590,7 @@ bool AHCIPort::access_device(AsyncBlockDeviceRequest::RequestType direction, u64
dbgln_if(AHCI_DEBUG, "AHCI Port {}: CLE: ctba={:#08x}, ctbau={:#08x}, prdbc={:#08x}, prdtl={:#04x}, attributes={:#04x}", representative_port_index(), (u32)command_list_entries[unused_command_header.value()].ctba, (u32)command_list_entries[unused_command_header.value()].ctbau, (u32)command_list_entries[unused_command_header.value()].prdbc, (u16)command_list_entries[unused_command_header.value()].prdtl, (u16)command_list_entries[unused_command_header.value()].attributes); dbgln_if(AHCI_DEBUG, "AHCI Port {}: CLE: ctba={:#08x}, ctbau={:#08x}, prdbc={:#08x}, prdtl={:#04x}, attributes={:#04x}", representative_port_index(), (u32)command_list_entries[unused_command_header.value()].ctba, (u32)command_list_entries[unused_command_header.value()].ctbau, (u32)command_list_entries[unused_command_header.value()].prdbc, (u16)command_list_entries[unused_command_header.value()].prdtl, (u16)command_list_entries[unused_command_header.value()].attributes);
auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table", Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No).release_value(); auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table"sv, Memory::Region::Access::ReadWrite, Memory::Region::Cacheable::No).release_value();
auto& command_table = *(volatile AHCI::CommandTable*)command_table_region->vaddr().as_ptr(); auto& command_table = *(volatile AHCI::CommandTable*)command_table_region->vaddr().as_ptr();
dbgln_if(AHCI_DEBUG, "AHCI Port {}: Allocated command table at {}", representative_port_index(), command_table_region->vaddr()); dbgln_if(AHCI_DEBUG, "AHCI Port {}: Allocated command table at {}", representative_port_index(), command_table_region->vaddr());
@ -678,7 +678,7 @@ bool AHCIPort::identify_device()
// QEMU doesn't care if we don't set the correct CFL field in this register, real hardware will set an handshake error bit in PxSERR register. // QEMU doesn't care if we don't set the correct CFL field in this register, real hardware will set an handshake error bit in PxSERR register.
command_list_entries[unused_command_header.value()].attributes = (size_t)FIS::DwordCount::RegisterHostToDevice | AHCI::CommandHeaderAttributes::P; command_list_entries[unused_command_header.value()].attributes = (size_t)FIS::DwordCount::RegisterHostToDevice | AHCI::CommandHeaderAttributes::P;
auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table", Memory::Region::Access::ReadWrite).release_value(); auto command_table_region = MM.allocate_kernel_region(m_command_table_pages[unused_command_header.value()].paddr().page_base(), Memory::page_round_up(sizeof(AHCI::CommandTable)).value(), "AHCI Command Table"sv, Memory::Region::Access::ReadWrite).release_value();
auto& command_table = *(volatile AHCI::CommandTable*)command_table_region->vaddr().as_ptr(); auto& command_table = *(volatile AHCI::CommandTable*)command_table_region->vaddr().as_ptr();
memset(const_cast<u8*>(command_table.command_fis), 0, 64); memset(const_cast<u8*>(command_table.command_fis), 0, 64);
command_table.descriptors[0].base_high = 0; command_table.descriptors[0].base_high = 0;

View file

@ -106,7 +106,7 @@ private:
EntropySource m_entropy_source; EntropySource m_entropy_source;
RefPtr<AsyncBlockDeviceRequest> m_current_request; RefPtr<AsyncBlockDeviceRequest> m_current_request;
Spinlock m_hard_lock; Spinlock m_hard_lock;
Mutex m_lock { "AHCIPort" }; Mutex m_lock { "AHCIPort"sv };
mutable bool m_wait_for_completion { false }; mutable bool m_wait_for_completion { false };

View file

@ -35,7 +35,7 @@ ATADiskDevice::~ATADiskDevice() = default;
StringView ATADiskDevice::class_name() const StringView ATADiskDevice::class_name() const
{ {
return "ATADiskDevice"; return "ATADiskDevice"sv;
} }
} }

View file

@ -35,7 +35,7 @@ ATAPIDiscDevice::~ATAPIDiscDevice() = default;
StringView ATAPIDiscDevice::class_name() const StringView ATAPIDiscDevice::class_name() const
{ {
return "ATAPIDiscDevice"; return "ATAPIDiscDevice"sv;
} }
} }

View file

@ -40,13 +40,13 @@ UNMAP_AFTER_INIT void BMIDEChannel::initialize()
VERIFY(m_io_group.bus_master_base().has_value()); VERIFY(m_io_group.bus_master_base().has_value());
// Let's try to set up DMA transfers. // Let's try to set up DMA transfers.
{ {
auto region_or_error = MM.allocate_dma_buffer_page("IDE PRDT", Memory::Region::Access::ReadWrite, m_prdt_page); auto region_or_error = MM.allocate_dma_buffer_page("IDE PRDT"sv, Memory::Region::Access::ReadWrite, m_prdt_page);
if (region_or_error.is_error()) if (region_or_error.is_error())
TODO(); TODO();
m_prdt_region = region_or_error.release_value(); m_prdt_region = region_or_error.release_value();
} }
{ {
auto region_or_error = MM.allocate_dma_buffer_page("IDE DMA region", Memory::Region::Access::ReadWrite, m_dma_buffer_page); auto region_or_error = MM.allocate_dma_buffer_page("IDE DMA region"sv, Memory::Region::Access::ReadWrite, m_dma_buffer_page);
if (region_or_error.is_error()) if (region_or_error.is_error())
TODO(); TODO();
m_dma_buffer_region = region_or_error.release_value(); m_dma_buffer_region = region_or_error.release_value();

View file

@ -158,7 +158,7 @@ protected:
u64 m_current_request_block_index { 0 }; u64 m_current_request_block_index { 0 };
bool m_current_request_flushing_cache { false }; bool m_current_request_flushing_cache { false };
Spinlock m_request_lock; Spinlock m_request_lock;
Mutex m_lock { "IDEChannel" }; Mutex m_lock { "IDEChannel"sv };
IOAddressGroup m_io_group; IOAddressGroup m_io_group;
NonnullRefPtr<IDEController> m_parent_controller; NonnullRefPtr<IDEController> m_parent_controller;

View file

@ -158,7 +158,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::identify_and_init_namespaces()
u32 active_namespace_list[NVMe_IDENTIFY_SIZE / sizeof(u32)]; u32 active_namespace_list[NVMe_IDENTIFY_SIZE / sizeof(u32)];
{ {
auto buffer = TRY(MM.allocate_dma_buffer_page("Identify PRP", Memory::Region::Access::ReadWrite, prp_dma_buffer)); auto buffer = TRY(MM.allocate_dma_buffer_page("Identify PRP"sv, Memory::Region::Access::ReadWrite, prp_dma_buffer));
prp_dma_region = move(buffer); prp_dma_region = move(buffer);
} }
@ -269,7 +269,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_admin_queue(Optional<u8> i
return EFAULT; return EFAULT;
} }
{ {
auto buffer = TRY(MM.allocate_dma_buffer_pages(cq_size, "Admin CQ queue", Memory::Region::Access::ReadWrite, cq_dma_pages)); auto buffer = TRY(MM.allocate_dma_buffer_pages(cq_size, "Admin CQ queue"sv, Memory::Region::Access::ReadWrite, cq_dma_pages));
cq_dma_region = move(buffer); cq_dma_region = move(buffer);
} }
@ -278,7 +278,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_admin_queue(Optional<u8> i
memset(cq_dma_region->vaddr().as_ptr(), 0, cq_size); memset(cq_dma_region->vaddr().as_ptr(), 0, cq_size);
{ {
auto buffer = TRY(MM.allocate_dma_buffer_pages(sq_size, "Admin SQ queue", Memory::Region::Access::ReadWrite, sq_dma_pages)); auto buffer = TRY(MM.allocate_dma_buffer_pages(sq_size, "Admin SQ queue"sv, Memory::Region::Access::ReadWrite, sq_dma_pages));
sq_dma_region = move(buffer); sq_dma_region = move(buffer);
} }
auto doorbell_regs = TRY(Memory::map_typed_writable<volatile DoorbellRegister>(PhysicalAddress(m_bar + REG_SQ0TDBL_START))); auto doorbell_regs = TRY(Memory::map_typed_writable<volatile DoorbellRegister>(PhysicalAddress(m_bar + REG_SQ0TDBL_START)));
@ -307,7 +307,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_io_queue(u8 qid, Optional<
auto sq_size = round_up_to_power_of_two(SQ_SIZE(IO_QUEUE_SIZE), 4096); auto sq_size = round_up_to_power_of_two(SQ_SIZE(IO_QUEUE_SIZE), 4096);
{ {
auto buffer = TRY(MM.allocate_dma_buffer_pages(cq_size, "IO CQ queue", Memory::Region::Access::ReadWrite, cq_dma_pages)); auto buffer = TRY(MM.allocate_dma_buffer_pages(cq_size, "IO CQ queue"sv, Memory::Region::Access::ReadWrite, cq_dma_pages));
cq_dma_region = move(buffer); cq_dma_region = move(buffer);
} }
@ -316,7 +316,7 @@ UNMAP_AFTER_INIT ErrorOr<void> NVMeController::create_io_queue(u8 qid, Optional<
memset(cq_dma_region->vaddr().as_ptr(), 0, cq_size); memset(cq_dma_region->vaddr().as_ptr(), 0, cq_size);
{ {
auto buffer = TRY(MM.allocate_dma_buffer_pages(sq_size, "IO SQ queue", Memory::Region::Access::ReadWrite, sq_dma_pages)); auto buffer = TRY(MM.allocate_dma_buffer_pages(sq_size, "IO SQ queue"sv, Memory::Region::Access::ReadWrite, sq_dma_pages));
sq_dma_region = move(buffer); sq_dma_region = move(buffer);
} }

View file

@ -44,7 +44,7 @@ RamdiskController::RamdiskController()
for (auto& used_memory_range : MM.used_memory_ranges()) { for (auto& used_memory_range : MM.used_memory_ranges()) {
if (used_memory_range.type == Memory::UsedMemoryRangeType::BootModule) { if (used_memory_range.type == Memory::UsedMemoryRangeType::BootModule) {
size_t length = Memory::page_round_up(used_memory_range.end.get()).release_value_but_fixme_should_propagate_errors() - used_memory_range.start.get(); size_t length = Memory::page_round_up(used_memory_range.end.get()).release_value_but_fixme_should_propagate_errors() - used_memory_range.start.get();
auto region_or_error = MM.allocate_kernel_region(used_memory_range.start, length, "Ramdisk", Memory::Region::Access::ReadWrite); auto region_or_error = MM.allocate_kernel_region(used_memory_range.start, length, "Ramdisk"sv, Memory::Region::Access::ReadWrite);
if (region_or_error.is_error()) { if (region_or_error.is_error()) {
dmesgln("RamdiskController: Failed to allocate kernel region of size {}", length); dmesgln("RamdiskController: Failed to allocate kernel region of size {}", length);
} else { } else {

View file

@ -33,7 +33,7 @@ private:
// ^StorageDevice // ^StorageDevice
virtual CommandSet command_set() const override { return CommandSet::PlainMemory; } virtual CommandSet command_set() const override { return CommandSet::PlainMemory; }
Mutex m_lock { "RamdiskDevice" }; Mutex m_lock { "RamdiskDevice"sv };
NonnullOwnPtr<Memory::Region> m_region; NonnullOwnPtr<Memory::Region> m_region;
}; };

View file

@ -173,7 +173,7 @@ static ErrorOr<RequiredLoadRange> get_required_load_range(OpenFileDescription& p
size_t executable_size = inode.size(); size_t executable_size = inode.size();
size_t rounded_executable_size = TRY(Memory::page_round_up(executable_size)); size_t rounded_executable_size = TRY(Memory::page_round_up(executable_size));
auto region = TRY(MM.allocate_kernel_region_with_vmobject(*vmobject, rounded_executable_size, "ELF memory range calculation", Memory::Region::Access::Read)); auto region = TRY(MM.allocate_kernel_region_with_vmobject(*vmobject, rounded_executable_size, "ELF memory range calculation"sv, Memory::Region::Access::Read));
auto elf_image = ELF::Image(region->vaddr().as_ptr(), executable_size); auto elf_image = ELF::Image(region->vaddr().as_ptr(), executable_size);
if (!elf_image.is_valid()) { if (!elf_image.is_valid()) {
return EINVAL; return EINVAL;
@ -269,7 +269,7 @@ static ErrorOr<LoadResult> load_elf_object(NonnullOwnPtr<Memory::AddressSpace> n
size_t executable_size = inode.size(); size_t executable_size = inode.size();
size_t rounded_executable_size = TRY(Memory::page_round_up(executable_size)); size_t rounded_executable_size = TRY(Memory::page_round_up(executable_size));
auto executable_region = TRY(MM.allocate_kernel_region_with_vmobject(*vmobject, rounded_executable_size, "ELF loading", Memory::Region::Access::Read)); auto executable_region = TRY(MM.allocate_kernel_region_with_vmobject(*vmobject, rounded_executable_size, "ELF loading"sv, Memory::Region::Access::Read));
auto elf_image = ELF::Image(executable_region->vaddr().as_ptr(), executable_size); auto elf_image = ELF::Image(executable_region->vaddr().as_ptr(), executable_size);
if (!elf_image.is_valid()) if (!elf_image.is_valid())
@ -392,7 +392,7 @@ static ErrorOr<LoadResult> load_elf_object(NonnullOwnPtr<Memory::AddressSpace> n
return ENOEXEC; return ENOEXEC;
} }
auto* stack_region = TRY(new_space->allocate_region(Memory::RandomizeVirtualAddress::Yes, {}, Thread::default_userspace_stack_size, PAGE_SIZE, "Stack (Main thread)", PROT_READ | PROT_WRITE, AllocationStrategy::Reserve)); auto* stack_region = TRY(new_space->allocate_region(Memory::RandomizeVirtualAddress::Yes, {}, Thread::default_userspace_stack_size, PAGE_SIZE, "Stack (Main thread)"sv, PROT_READ | PROT_WRITE, AllocationStrategy::Reserve));
stack_region->set_stack(true); stack_region->set_stack(true);
return LoadResult { return LoadResult {
@ -488,7 +488,7 @@ ErrorOr<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> main_program_d
bool has_interpreter = interpreter_description; bool has_interpreter = interpreter_description;
interpreter_description = nullptr; interpreter_description = nullptr;
auto* signal_trampoline_region = TRY(load_result.space->allocate_region_with_vmobject(Memory::RandomizeVirtualAddress::Yes, {}, PAGE_SIZE, PAGE_SIZE, g_signal_trampoline_region->vmobject(), 0, "Signal trampoline", PROT_READ | PROT_EXEC, true)); auto* signal_trampoline_region = TRY(load_result.space->allocate_region_with_vmobject(Memory::RandomizeVirtualAddress::Yes, {}, PAGE_SIZE, PAGE_SIZE, g_signal_trampoline_region->vmobject(), 0, "Signal trampoline"sv, PROT_READ | PROT_EXEC, true));
signal_trampoline_region->set_syscall_region(true); signal_trampoline_region->set_syscall_region(true);
// (For dynamically linked executable) Allocate an FD for passing the main executable to the dynamic loader. // (For dynamically linked executable) Allocate an FD for passing the main executable to the dynamic loader.

Some files were not shown because too many files have changed in this diff Show more