Add clippy lints, action some clippy items
This commit is contained in:
335
Cargo.lock
generated
335
Cargo.lock
generated
@@ -1,3 +1,11 @@
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloc_kernel"
|
||||
version = "0.1.0"
|
||||
@@ -11,16 +19,76 @@ name = "bitflags"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "0.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cargo_metadata"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clippy"
|
||||
version = "0.0.177"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy_lints 0.0.177 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clippy_lints"
|
||||
version = "0.0.177"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pulldown-cmark 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "gcc"
|
||||
version = "0.3.54"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "getopts"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "goblin"
|
||||
version = "0.0.10"
|
||||
@@ -30,12 +98,41 @@ dependencies = [
|
||||
"scroll 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "if_chain"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "kernel"
|
||||
version = "0.1.32"
|
||||
dependencies = [
|
||||
"alloc_kernel 0.1.0",
|
||||
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clippy 0.0.177 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"goblin 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"raw-cpuid 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.32",
|
||||
@@ -43,6 +140,16 @@ dependencies = [
|
||||
"x86 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.34"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "linked_list_allocator"
|
||||
version = "0.4.1"
|
||||
@@ -51,11 +158,53 @@ dependencies = [
|
||||
"spin 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "matches"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.1.41"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "percent-encoding"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "plain"
|
||||
version = "0.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "pulldown-cmark"
|
||||
version = "0.0.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quine-mc_cluskey"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "0.3.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "raw-cpuid"
|
||||
version = "2.0.2"
|
||||
@@ -77,16 +226,162 @@ dependencies = [
|
||||
name = "redox_syscall"
|
||||
version = "0.1.32"
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "scroll"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.25"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive_internals 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive_internals"
|
||||
version = "0.18.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "spin"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.11.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "synom"
|
||||
version = "0.11.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-bidi"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-normalization"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unreachable"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "url"
|
||||
version = "1.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "x86"
|
||||
version = "0.7.2"
|
||||
@@ -96,14 +391,54 @@ dependencies = [
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4"
|
||||
"checksum bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aad18937a628ec6abcd26d1489012cc0e18c21798210f491af69ded9b881106d"
|
||||
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
|
||||
"checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
|
||||
"checksum cargo_metadata 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "be1057b8462184f634c3a208ee35b0f935cfd94b694b26deadccd98732088d7b"
|
||||
"checksum clippy 0.0.177 (registry+https://github.com/rust-lang/crates.io-index)" = "131acb21874af5ec9a2ed5b3945edd9961b260735ba0d6879357a924a77be66b"
|
||||
"checksum clippy_lints 0.0.177 (registry+https://github.com/rust-lang/crates.io-index)" = "e5ad86d7ff55bf5461ed84388c445ecba69badb2805a5e4750bd57ee12a0f8a2"
|
||||
"checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
|
||||
"checksum either 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740178ddf48b1a9e878e6d6509a1442a2d42fd2928aae8e7a6f8a36fb01981b3"
|
||||
"checksum gcc 0.3.54 (registry+https://github.com/rust-lang/crates.io-index)" = "5e33ec290da0d127825013597dbdfc28bee4964690c7ce1166cbc2a7bd08b1bb"
|
||||
"checksum getopts 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)" = "65922871abd2f101a2eb0eaebadc66668e54a87ad9c3dd82520b5f86ede5eff9"
|
||||
"checksum goblin 0.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "81af14056c25d33759862c5ae2035452acb1255bfb1b16db57819f183921e259"
|
||||
"checksum idna 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "014b298351066f1512874135335d62a789ffe78a9974f94b43ed5621951eaf7d"
|
||||
"checksum if_chain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "61bb90bdd39e3af69b0172dfc6130f6cd6332bf040fbb9bdd4401d37adbd48b8"
|
||||
"checksum itertools 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d3f2be4da1690a039e9ae5fd575f706a63ad5a2120f161b1d653c9da3930dd21"
|
||||
"checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
|
||||
"checksum lazy_static 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c8f31047daa365f19be14b47c29df4f7c3b581832407daabe6ae77397619237d"
|
||||
"checksum libc 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)" = "36fbc8a8929c632868295d0178dd8f63fc423fd7537ad0738372bd010b3ac9b0"
|
||||
"checksum linked_list_allocator 0.4.1 (git+https://github.com/redox-os/linked-list-allocator.git)" = "<none>"
|
||||
"checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376"
|
||||
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
|
||||
"checksum num-traits 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "cacfcab5eb48250ee7d0c7896b51a2c5eec99c1feea5f32025635f5ae4b00070"
|
||||
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
|
||||
"checksum plain 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "595830506990cbd6a1a08ed73bd9b40beb4692f38334885bf25a5daa654c6fae"
|
||||
"checksum pulldown-cmark 0.0.15 (registry+https://github.com/rust-lang/crates.io-index)" = "378e941dbd392c101f2cb88097fa4d7167bc421d4b88de3ff7dbee503bc3233b"
|
||||
"checksum quine-mc_cluskey 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "07589615d719a60c8dd8a4622e7946465dfef20d1a428f969e3443e7386d5f45"
|
||||
"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
|
||||
"checksum raw-cpuid 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13b844e4049605ff38fed943f5c7b2c691fad68d9d5bf074d2720554c4e48246"
|
||||
"checksum raw-cpuid 3.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "779585861d55e586db9d6abe4352cd9466e09a3319342c417baf34b2740af74e"
|
||||
"checksum regex 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ac6ab4e9218ade5b423358bbd2567d1617418403c7a512603630181813316322"
|
||||
"checksum regex-syntax 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad890a5eef7953f55427c50575c680c42841653abd2b028b68cd223d157f62db"
|
||||
"checksum scroll 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d916a75d18d4c559fa7312afe6f522fe5b63176e6591d02ed81017c22f8ea27"
|
||||
"checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum serde 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "386122ba68c214599c44587e0c0b411e8d90894503a95425b4f9508e4317901f"
|
||||
"checksum serde_derive 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "ec0bfa6c5784e7d110514448da0e1dbad41ea5514c3e68be755b23858b83a399"
|
||||
"checksum serde_derive_internals 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "730fe9f29fe8db69a601837f416e46cba07792031ed6b27557a43e49d62d89ae"
|
||||
"checksum serde_json 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7cf5b0b5b4bd22eeecb7e01ac2e1225c7ef5e4272b79ee28a8392a8c8489c839"
|
||||
"checksum spin 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7e4deb3c2455c73779e6d3eebceae9599fc70957e54c69fe88f93aa48e62f432"
|
||||
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||
"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
|
||||
"checksum thread_local 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "279ef31c19ededf577bfd12dfae728040a21f635b06a24cd670ff510edd38963"
|
||||
"checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e"
|
||||
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
||||
"checksum unicode-normalization 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "51ccda9ef9efa3f7ef5d91e8f9b83bbe6955f9bf86aec89d5cce2c874625920f"
|
||||
"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
|
||||
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
|
||||
"checksum url 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa35e768d4daf1d85733418a49fb42e10d7f633e394fccab4ab7aba897053fe2"
|
||||
"checksum utf8-ranges 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "662fab6525a98beff2921d7f61a39e7d59e0b425ebc7d0d9e66d316e55124122"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum x86 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "127728f29f7cfb243a9264c80fc7e57bd1abb3ab015850b05736efda2abe5859"
|
||||
|
||||
@@ -11,6 +11,7 @@ crate-type = ["staticlib"]
|
||||
[dependencies]
|
||||
alloc_kernel = { path = "alloc_kernel" }
|
||||
bitflags = "1"
|
||||
clippy = { version = "*", optional = true }
|
||||
spin = "0.4"
|
||||
raw-cpuid = "3.0"
|
||||
redox_syscall = { path = "syscall" }
|
||||
|
||||
17
clippy.sh
Executable file
17
clippy.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
export RUST_TARGET_PATH="${PWD}/targets"
|
||||
xargo rustc --lib --release \
|
||||
--target x86_64-unknown-none \
|
||||
--features clippy \
|
||||
-- \
|
||||
-C soft-float -C debuginfo=2 \
|
||||
-W anonymous-parameters \
|
||||
-W trivial-numeric-casts \
|
||||
-W unused-extern-crates \
|
||||
-W unused-import-braces \
|
||||
-W unused-qualifications \
|
||||
-W variant-size-differences \
|
||||
-Z no-trans -Z extra-plugins=clippy
|
||||
@@ -15,7 +15,7 @@ pub fn parse_data_obj(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ pub fn parse_data_ref_obj(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ pub fn parse_arg_obj(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ pub fn parse_local_obj(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ fn parse_computational_data(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -172,14 +172,14 @@ fn parse_computational_data(data: &[u8],
|
||||
}),
|
||||
0x5B => if data[1] == 0x30 {
|
||||
Ok(AmlParseType {
|
||||
val: AmlValue::IntegerConstant(20170630 as u64),
|
||||
val: AmlValue::IntegerConstant(2017_0630 as u64),
|
||||
len: 2 as usize
|
||||
})
|
||||
} else {
|
||||
Err(AmlError::AmlInvalidOpCode)
|
||||
},
|
||||
0xFF => Ok(AmlParseType {
|
||||
val: AmlValue::IntegerConstant(0xFFFFFFFFFFFFFFFF),
|
||||
val: AmlValue::IntegerConstant(0xFFFF_FFFF_FFFF_FFFF),
|
||||
len: 1 as usize
|
||||
}),
|
||||
_ => parse_def_buffer(data, ctx)
|
||||
|
||||
@@ -83,7 +83,7 @@ pub fn parse_named_obj(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ fn parse_def_bank_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ fn parse_def_create_bit_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ fn parse_def_create_byte_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ fn parse_def_create_word_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ fn parse_def_create_dword_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ fn parse_def_create_qword_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ fn parse_def_create_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ fn parse_def_data_region(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -392,7 +392,7 @@ fn parse_def_event(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -415,7 +415,7 @@ fn parse_def_device(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ fn parse_def_op_region(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ fn parse_def_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -541,7 +541,7 @@ fn parse_def_index_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -593,7 +593,7 @@ fn parse_field_list(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -608,7 +608,7 @@ fn parse_field_list(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -631,7 +631,7 @@ fn parse_field_element(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -747,7 +747,7 @@ fn parse_connect_field(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -773,7 +773,7 @@ fn parse_def_method(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -809,7 +809,7 @@ fn parse_def_mutex(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -834,7 +834,7 @@ fn parse_def_power_res(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -871,7 +871,7 @@ fn parse_def_processor(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -911,7 +911,7 @@ fn parse_def_thermal_zone(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -942,7 +942,7 @@ fn parse_def_external(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ pub fn parse_namespace_modifier(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ fn parse_alias_op(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ fn parse_name_op(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ fn parse_scope_op(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ pub fn parse_name_string(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ pub fn parse_name_string(data: &[u8],
|
||||
|
||||
fn parse_null_name(data: &[u8]) -> Result<(Vec<u8>, usize), AmlError> {
|
||||
parser_opcode!(data, 0x00);
|
||||
Ok((vec!(), 1 as usize))
|
||||
Ok((vec!(), 1 ))
|
||||
}
|
||||
|
||||
pub fn parse_name_seg(data: &[u8]) -> Result<(Vec<u8>, usize), AmlError> {
|
||||
@@ -86,7 +86,7 @@ pub fn parse_name_seg(data: &[u8]) -> Result<(Vec<u8>, usize), AmlError> {
|
||||
name_seg.pop();
|
||||
}
|
||||
|
||||
Ok((name_seg, 4 as usize))
|
||||
Ok((name_seg, 4))
|
||||
}
|
||||
|
||||
fn parse_dual_name_path(data: &[u8]) -> Result<(Vec<u8>, usize), AmlError> {
|
||||
@@ -153,7 +153,7 @@ pub fn parse_super_name(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ fn parse_debug_obj(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ fn parse_debug_obj(data: &[u8],
|
||||
|
||||
Ok(AmlParseType {
|
||||
val: AmlValue::DebugObject,
|
||||
len: 2 as usize
|
||||
len: 2
|
||||
})
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ pub fn parse_simple_name(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -211,14 +211,14 @@ pub fn parse_target(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
if data[0] == 0x00 {
|
||||
Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 1 as usize
|
||||
len: 1
|
||||
})
|
||||
} else {
|
||||
parse_super_name(data, ctx)
|
||||
|
||||
@@ -383,7 +383,7 @@ impl AmlExecutionContext {
|
||||
|
||||
Ok(AmlValue::Package(p))
|
||||
},
|
||||
_ => return Err(AmlError::AmlValueError)
|
||||
_ => Err(AmlError::AmlValueError)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,5 +21,5 @@ pub fn parse_pkg_length(data: &[u8]) -> Result<(usize, usize), AmlError> {
|
||||
current_byte += 1;
|
||||
}
|
||||
|
||||
return Ok((pkg_len, count_bytes + 1));
|
||||
Ok((pkg_len, count_bytes + 1))
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ pub fn parse_term_list(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ pub fn parse_term_arg(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ pub fn parse_object_list(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ fn parse_object(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ pub fn parse_method_invocation(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ fn parse_term_obj(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ pub fn parse_type1_opcode(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ fn parse_def_break(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ fn parse_def_breakpoint(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ fn parse_def_continue(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ fn parse_def_noop(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ fn parse_def_fatal(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ fn parse_def_load(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ fn parse_def_notify(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ fn parse_def_release(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ fn parse_def_reset(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ fn parse_def_signal(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ fn parse_def_sleep(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -296,13 +296,13 @@ fn parse_def_sleep(data: &[u8],
|
||||
let timeout = time.val.get_as_integer()?;
|
||||
|
||||
let (seconds, nanoseconds) = monotonic();
|
||||
let starting_time_ns = nanoseconds + (seconds * 1000000000);
|
||||
let starting_time_ns = nanoseconds + (seconds * 1_000_000_000);
|
||||
|
||||
loop {
|
||||
let (seconds, nanoseconds) = monotonic();
|
||||
let current_time_ns = nanoseconds + (seconds * 1000000000);
|
||||
let current_time_ns = nanoseconds + (seconds * 1_000_000_000);
|
||||
|
||||
if current_time_ns - starting_time_ns > timeout as u64 * 1000000 {
|
||||
if current_time_ns - starting_time_ns > timeout as u64 * 1_000_000 {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -319,7 +319,7 @@ fn parse_def_stall(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -329,11 +329,11 @@ fn parse_def_stall(data: &[u8],
|
||||
let timeout = time.val.get_as_integer()?;
|
||||
|
||||
let (seconds, nanoseconds) = monotonic();
|
||||
let starting_time_ns = nanoseconds + (seconds * 1000000000);
|
||||
let starting_time_ns = nanoseconds + (seconds * 1_000_000_000);
|
||||
|
||||
loop {
|
||||
let (seconds, nanoseconds) = monotonic();
|
||||
let current_time_ns = nanoseconds + (seconds * 1000000000);
|
||||
let current_time_ns = nanoseconds + (seconds * 1_000_000_000);
|
||||
|
||||
if current_time_ns - starting_time_ns > timeout as u64 * 1000 {
|
||||
break;
|
||||
@@ -352,7 +352,7 @@ fn parse_def_unload(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ fn parse_def_if_else(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ fn parse_def_while(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ fn parse_def_while(data: &[u8],
|
||||
ExecutionState::CONTINUE => ctx.state = ExecutionState::EXECUTING,
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -456,7 +456,7 @@ fn parse_def_return(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ pub fn parse_type2_opcode(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ pub fn parse_type6_opcode(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ pub fn parse_def_object_type(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ pub fn parse_def_package(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ pub fn parse_def_var_package(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ fn parse_package_elements_list(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ pub fn parse_def_buffer(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ fn parse_def_ref_of(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ fn parse_def_deref_of(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ fn parse_def_acquire(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ fn parse_def_acquire(data: &[u8],
|
||||
let timeout = (data[2 + obj.len] as u16) + ((data[3 + obj.len] as u16) << 8);
|
||||
|
||||
let (seconds, nanoseconds) = monotonic();
|
||||
let starting_time_ns = nanoseconds + (seconds * 1000000000);
|
||||
let starting_time_ns = nanoseconds + (seconds * 1_000_000_000);
|
||||
|
||||
loop {
|
||||
match ctx.acquire_mutex(obj.val.clone()) {
|
||||
@@ -340,9 +340,9 @@ fn parse_def_acquire(data: &[u8],
|
||||
// TODO: Brief sleep here
|
||||
} else {
|
||||
let (seconds, nanoseconds) = monotonic();
|
||||
let current_time_ns = nanoseconds + (seconds * 1000000000);
|
||||
let current_time_ns = nanoseconds + (seconds * 1_000_000_000);
|
||||
|
||||
if current_time_ns - starting_time_ns > timeout as u64 * 1000000 {
|
||||
if current_time_ns - starting_time_ns > timeout as u64 * 1_000_000 {
|
||||
return Ok(AmlParseType {
|
||||
val: AmlValue::Integer(1),
|
||||
len: 4 + obj.len
|
||||
@@ -359,7 +359,7 @@ fn parse_def_increment(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ fn parse_def_index(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ fn parse_def_land(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ fn parse_def_lequal(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -454,7 +454,7 @@ fn parse_def_lgreater(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ fn parse_def_lless(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -500,7 +500,7 @@ fn parse_def_lnot(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ fn parse_def_lor(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ fn parse_def_to_hex_string(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ fn parse_def_to_buffer(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -609,7 +609,7 @@ fn parse_def_to_bcd(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -642,7 +642,7 @@ fn parse_def_to_decimal_string(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -682,7 +682,7 @@ fn parse_def_to_integer(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -707,7 +707,7 @@ fn parse_def_to_string(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -740,7 +740,7 @@ fn parse_def_subtract(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -766,7 +766,7 @@ fn parse_def_size_of(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -794,7 +794,7 @@ fn parse_def_store(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -817,7 +817,7 @@ fn parse_def_or(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@ fn parse_def_shift_left(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -869,7 +869,7 @@ fn parse_def_shift_right(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -895,7 +895,7 @@ fn parse_def_add(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -921,7 +921,7 @@ fn parse_def_and(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -947,7 +947,7 @@ fn parse_def_xor(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -973,7 +973,7 @@ fn parse_def_concat_res(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1025,7 +1025,7 @@ fn parse_def_wait(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1037,7 +1037,7 @@ fn parse_def_wait(data: &[u8],
|
||||
let timeout = timeout_obj.val.get_as_integer()?;
|
||||
|
||||
let (seconds, nanoseconds) = monotonic();
|
||||
let starting_time_ns = nanoseconds + (seconds * 1000000000);
|
||||
let starting_time_ns = nanoseconds + (seconds * 1_000_000_000);
|
||||
|
||||
loop {
|
||||
match ctx.wait_for_event(obj.val.clone()) {
|
||||
@@ -1051,9 +1051,9 @@ fn parse_def_wait(data: &[u8],
|
||||
// TODO: Brief sleep here
|
||||
} else {
|
||||
let (seconds, nanoseconds) = monotonic();
|
||||
let current_time_ns = nanoseconds + (seconds * 1000000000);
|
||||
let current_time_ns = nanoseconds + (seconds * 1_000_000_000);
|
||||
|
||||
if current_time_ns - starting_time_ns > timeout as u64 * 1000000 {
|
||||
if current_time_ns - starting_time_ns > timeout as u64 * 1_000_000 {
|
||||
return Ok(AmlParseType {
|
||||
val: AmlValue::Integer(1),
|
||||
len: 2 + obj.len + timeout_obj.len
|
||||
@@ -1070,7 +1070,7 @@ fn parse_def_cond_ref_of(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1107,7 +1107,7 @@ fn parse_def_copy_object(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1132,7 +1132,7 @@ fn parse_def_concat(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1200,7 +1200,7 @@ fn parse_def_decrement(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1224,7 +1224,7 @@ fn parse_def_divide(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1256,7 +1256,7 @@ fn parse_def_find_set_left_bit(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1269,7 +1269,7 @@ fn parse_def_find_set_left_bit(data: &[u8],
|
||||
let mut test = operand.val.get_as_integer()?;
|
||||
|
||||
while first_bit > 0{
|
||||
if test & 0x8000000000000000 > 0 {
|
||||
if test & 0x8000_0000_0000_0000 > 0 {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1292,7 +1292,7 @@ fn parse_def_find_set_right_bit(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1332,7 +1332,7 @@ fn parse_def_load_table(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1385,7 +1385,7 @@ fn parse_def_match(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1518,7 +1518,7 @@ fn parse_def_match(data: &[u8],
|
||||
}
|
||||
|
||||
Ok(AmlParseType {
|
||||
val: AmlValue::IntegerConstant(0xFFFFFFFFFFFFFFFF),
|
||||
val: AmlValue::IntegerConstant(0xFFFF_FFFF_FFFF_FFFF),
|
||||
len: 3 + search_pkg.len + first_operand.len + second_operand.len + start_index.len
|
||||
})
|
||||
}
|
||||
@@ -1529,7 +1529,7 @@ fn parse_def_from_bcd(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1567,7 +1567,7 @@ fn parse_def_mid(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1629,7 +1629,7 @@ fn parse_def_mod(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1659,7 +1659,7 @@ fn parse_def_multiply(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1686,7 +1686,7 @@ fn parse_def_nand(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1712,7 +1712,7 @@ fn parse_def_nor(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1738,7 +1738,7 @@ fn parse_def_not(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1763,14 +1763,14 @@ fn parse_def_timer(data: &[u8],
|
||||
ExecutionState::EXECUTING => (),
|
||||
_ => return Ok(AmlParseType {
|
||||
val: AmlValue::None,
|
||||
len: 0 as usize
|
||||
len: 0
|
||||
})
|
||||
}
|
||||
|
||||
parser_opcode_extended!(data, 0x33);
|
||||
|
||||
let (seconds, nanoseconds) = monotonic();
|
||||
let monotonic_ns = nanoseconds + (seconds * 1000000000);
|
||||
let monotonic_ns = nanoseconds + (seconds * 1_000_000_000);
|
||||
|
||||
Ok(AmlParseType {
|
||||
val: AmlValue::Integer(monotonic_ns),
|
||||
|
||||
@@ -20,8 +20,8 @@ pub struct RSDP {
|
||||
impl RSDP {
|
||||
/// Search for the RSDP
|
||||
pub fn get_rsdp(active_table: &mut ActivePageTable) -> Option<RSDP> {
|
||||
let start_addr = 0xE0000;
|
||||
let end_addr = 0xFFFFF;
|
||||
let start_addr = 0xE_0000;
|
||||
let end_addr = 0xF_FFFF;
|
||||
|
||||
// Map all of the ACPI RSDP space
|
||||
{
|
||||
|
||||
@@ -23,6 +23,6 @@ pub trait Rxsdt {
|
||||
}
|
||||
}
|
||||
|
||||
return None;
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ static T0_COMPARATOR_OFFSET: usize = 0x108;
|
||||
|
||||
pub unsafe fn init(hpet: &mut Hpet) {
|
||||
let counter_clk_period_fs = hpet.base_address.read_u64(CAPABILITY_OFFSET) >> 32;
|
||||
let desired_fs_period: u64 = 2250286 * 1000000;
|
||||
let desired_fs_period: u64 = 2_250_286 * 1_000_000;
|
||||
|
||||
let clk_periods_per_kernel_tick: u64 = desired_fs_period / counter_clk_period_fs;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ pub struct LocalApic {
|
||||
|
||||
impl LocalApic {
|
||||
unsafe fn init(&mut self, active_table: &mut ActivePageTable) {
|
||||
self.address = (rdmsr(IA32_APIC_BASE) as usize & 0xFFFF0000) + ::KERNEL_OFFSET;
|
||||
self.address = (rdmsr(IA32_APIC_BASE) as usize & 0xFFFF_0000) + ::KERNEL_OFFSET;
|
||||
self.x2 = CpuId::new().get_feature_info().unwrap().has_x2apic();
|
||||
|
||||
if ! self.x2 {
|
||||
|
||||
@@ -19,16 +19,16 @@ pub struct Rtc {
|
||||
impl Rtc {
|
||||
/// Create new empty RTC
|
||||
pub fn new() -> Self {
|
||||
return Rtc {
|
||||
Rtc {
|
||||
addr: Pio::<u8>::new(0x70),
|
||||
data: Pio::<u8>::new(0x71),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// Read
|
||||
unsafe fn read(&mut self, reg: u8) -> u8 {
|
||||
self.addr.write(reg);
|
||||
return self.data.read();
|
||||
self.data.read()
|
||||
}
|
||||
|
||||
/// Wait
|
||||
@@ -66,7 +66,7 @@ impl Rtc {
|
||||
if let Some(century_reg) = century_register {
|
||||
self.read(century_reg) as usize
|
||||
} else */ {
|
||||
20 as usize
|
||||
20
|
||||
};
|
||||
register_b = self.read(0xB);
|
||||
}
|
||||
@@ -93,32 +93,30 @@ impl Rtc {
|
||||
year += century * 100;
|
||||
|
||||
// Unix time from clock
|
||||
let mut secs: u64 = (year as u64 - 1970) * 31536000;
|
||||
let mut secs: u64 = (year as u64 - 1970) * 31_536_000;
|
||||
|
||||
let mut leap_days = (year as u64 - 1972) / 4 + 1;
|
||||
if year % 4 == 0 {
|
||||
if month <= 2 {
|
||||
leap_days -= 1;
|
||||
}
|
||||
if year % 4 == 0 && month <= 2 {
|
||||
leap_days -= 1;
|
||||
}
|
||||
secs += leap_days * 86400;
|
||||
secs += leap_days * 86_400;
|
||||
|
||||
match month {
|
||||
2 => secs += 2678400,
|
||||
3 => secs += 5097600,
|
||||
4 => secs += 7776000,
|
||||
5 => secs += 10368000,
|
||||
6 => secs += 13046400,
|
||||
7 => secs += 15638400,
|
||||
8 => secs += 18316800,
|
||||
9 => secs += 20995200,
|
||||
10 => secs += 23587200,
|
||||
11 => secs += 26265600,
|
||||
12 => secs += 28857600,
|
||||
2 => secs += 2_678_400,
|
||||
3 => secs += 5_097_600,
|
||||
4 => secs += 7_776_000,
|
||||
5 => secs += 10_368_000,
|
||||
6 => secs += 13_046_400,
|
||||
7 => secs += 15_638_400,
|
||||
8 => secs += 18_316_800,
|
||||
9 => secs += 20_995_200,
|
||||
10 => secs += 23_587_200,
|
||||
11 => secs += 26_265_600,
|
||||
12 => secs += 28_857_600,
|
||||
_ => (),
|
||||
}
|
||||
|
||||
secs += (day as u64 - 1) * 86400;
|
||||
secs += (day as u64 - 1) * 86_400;
|
||||
secs += hour as u64 * 3600;
|
||||
secs += minute as u64 * 60;
|
||||
secs += second as u64;
|
||||
|
||||
@@ -46,13 +46,13 @@ interrupt!(pit, {
|
||||
|
||||
// Saves CPU time by not sending IRQ event irq_trigger(0);
|
||||
|
||||
const PIT_RATE: u64 = 2250286;
|
||||
const PIT_RATE: u64 = 2_250_286;
|
||||
|
||||
{
|
||||
let mut offset = time::OFFSET.lock();
|
||||
let sum = offset.1 + PIT_RATE;
|
||||
offset.1 = sum % 1000000000;
|
||||
offset.0 += sum / 1000000000;
|
||||
offset.1 = sum % 1_000_000_000;
|
||||
offset.0 += sum / 1_000_000_000;
|
||||
}
|
||||
|
||||
pic::MASTER.ack();
|
||||
|
||||
@@ -10,7 +10,7 @@ pub struct Entry(u64);
|
||||
|
||||
bitflags! {
|
||||
pub struct EntryFlags: u64 {
|
||||
const PRESENT = 1 << 0;
|
||||
const PRESENT = 1;
|
||||
const WRITABLE = 1 << 1;
|
||||
const USER_ACCESSIBLE = 1 << 2;
|
||||
const WRITE_THROUGH = 1 << 3;
|
||||
@@ -39,7 +39,7 @@ impl Entry {
|
||||
|
||||
/// Make the entry unused
|
||||
pub fn set_unused(&mut self) {
|
||||
self.0 = self.0 & COUNTER_MASK;
|
||||
self.0 &= COUNTER_MASK;
|
||||
}
|
||||
|
||||
/// Get the address this page references
|
||||
@@ -71,7 +71,7 @@ impl Entry {
|
||||
(self.0 & COUNTER_MASK) >> 52
|
||||
}
|
||||
|
||||
/// Set bits 52-61 in entry, used as counter for page table
|
||||
/// Set bits 52-61 in entry, used as counter for page table
|
||||
pub fn set_counter_bits(&mut self, count: u64) {
|
||||
self.0 = (self.0 & !COUNTER_MASK) | (count << 52);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ impl Drop for MapperFlush {
|
||||
}
|
||||
|
||||
/// To allow for combining multiple flushes into one, we have a way of flushing
|
||||
/// the active table, which can consume MapperFlush structs
|
||||
/// the active table, which can consume `MapperFlush` structs
|
||||
#[must_use = "The page table must be flushed, or the changes unsafely ignored"]
|
||||
pub struct MapperFlushAll(bool);
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ impl ActivePageTable {
|
||||
unsafe { tlb::flush_all(); }
|
||||
}
|
||||
|
||||
pub fn with<F>(&mut self, table: &mut InactivePageTable, temporary_page: &mut temporary_page::TemporaryPage, f: F)
|
||||
pub fn with<F>(&mut self, table: &mut InactivePageTable, temporary_page: &mut TemporaryPage, f: F)
|
||||
where F: FnOnce(&mut Mapper)
|
||||
{
|
||||
use x86::controlregs;
|
||||
@@ -415,7 +415,7 @@ impl Page {
|
||||
}
|
||||
|
||||
pub fn p1_index(&self) -> usize {
|
||||
(self.number >> 0) & 0o777
|
||||
self.number & 0o777
|
||||
}
|
||||
|
||||
pub fn containing_address(address: VirtualAddress) -> Page {
|
||||
|
||||
@@ -20,13 +20,13 @@ use paging::mapper::MapperFlushAll;
|
||||
/// Test of zero values in BSS.
|
||||
static BSS_TEST_ZERO: usize = 0;
|
||||
/// Test of non-zero values in data.
|
||||
static DATA_TEST_NONZERO: usize = 0xFFFFFFFFFFFFFFFF;
|
||||
static DATA_TEST_NONZERO: usize = 0xFFFF_FFFF_FFFF_FFFF;
|
||||
/// Test of zero values in thread BSS
|
||||
#[thread_local]
|
||||
static mut TBSS_TEST_ZERO: usize = 0;
|
||||
/// Test of non-zero values in thread data.
|
||||
#[thread_local]
|
||||
static mut TDATA_TEST_NONZERO: usize = 0xFFFFFFFFFFFFFFFF;
|
||||
static mut TDATA_TEST_NONZERO: usize = 0xFFFF_FFFF_FFFF_FFFF;
|
||||
|
||||
pub static KERNEL_BASE: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
pub static KERNEL_SIZE: AtomicUsize = ATOMIC_USIZE_INIT;
|
||||
@@ -60,7 +60,7 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
|
||||
// BSS should already be zero
|
||||
{
|
||||
assert_eq!(BSS_TEST_ZERO, 0);
|
||||
assert_eq!(DATA_TEST_NONZERO, 0xFFFFFFFFFFFFFFFF);
|
||||
assert_eq!(DATA_TEST_NONZERO, 0xFFFF_FFFF_FFFF_FFFF);
|
||||
}
|
||||
|
||||
KERNEL_BASE.store(kernel_base, Ordering::SeqCst);
|
||||
@@ -87,9 +87,9 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
|
||||
assert_eq!(TBSS_TEST_ZERO, 0);
|
||||
TBSS_TEST_ZERO += 1;
|
||||
assert_eq!(TBSS_TEST_ZERO, 1);
|
||||
assert_eq!(TDATA_TEST_NONZERO, 0xFFFFFFFFFFFFFFFF);
|
||||
assert_eq!(TDATA_TEST_NONZERO, 0xFFFF_FFFF_FFFF_FFFF);
|
||||
TDATA_TEST_NONZERO -= 1;
|
||||
assert_eq!(TDATA_TEST_NONZERO, 0xFFFFFFFFFFFFFFFE);
|
||||
assert_eq!(TDATA_TEST_NONZERO, 0xFFFF_FFFF_FFFF_FFFE);
|
||||
}
|
||||
|
||||
// Reset AP variables
|
||||
@@ -153,7 +153,7 @@ pub unsafe extern fn kstart_ap(args_ptr: *const KernelArgsAp) -> ! {
|
||||
let stack_end = args.stack_end as usize;
|
||||
|
||||
assert_eq!(BSS_TEST_ZERO, 0);
|
||||
assert_eq!(DATA_TEST_NONZERO, 0xFFFFFFFFFFFFFFFF);
|
||||
assert_eq!(DATA_TEST_NONZERO, 0xFFFF_FFFF_FFFF_FFFF);
|
||||
|
||||
// Initialize paging
|
||||
let tcb_offset = paging::init_ap(cpu_id, bsp_table, stack_start, stack_end);
|
||||
@@ -169,9 +169,9 @@ pub unsafe extern fn kstart_ap(args_ptr: *const KernelArgsAp) -> ! {
|
||||
assert_eq!(TBSS_TEST_ZERO, 0);
|
||||
TBSS_TEST_ZERO += 1;
|
||||
assert_eq!(TBSS_TEST_ZERO, 1);
|
||||
assert_eq!(TDATA_TEST_NONZERO, 0xFFFFFFFFFFFFFFFF);
|
||||
assert_eq!(TDATA_TEST_NONZERO, 0xFFFF_FFFF_FFFF_FFFF);
|
||||
TDATA_TEST_NONZERO -= 1;
|
||||
assert_eq!(TDATA_TEST_NONZERO, 0xFFFFFFFFFFFFFFFE);
|
||||
assert_eq!(TDATA_TEST_NONZERO, 0xFFFF_FFFF_FFFF_FFFE);
|
||||
}
|
||||
|
||||
// Initialize devices (for AP)
|
||||
@@ -205,7 +205,7 @@ pub unsafe fn usermode(ip: usize, sp: usize, arg: usize) -> ! {
|
||||
: "{r10}"(gdt::GDT_USER_DATA << 3 | 3), // Data segment
|
||||
"{r11}"(gdt::GDT_USER_TLS << 3 | 3), // TLS segment
|
||||
"{r12}"(sp), // Stack pointer
|
||||
"{r13}"(0 << 12 | 1 << 9), // Flags - Set IOPL and interrupt enable flag
|
||||
"{r13}"(1 << 9), // Flags - Set interrupt enable flag
|
||||
"{r14}"(gdt::GDT_USER_CODE << 3 | 3), // Code segment
|
||||
"{r15}"(ip) // IP
|
||||
"{rdi}"(arg) // Argument
|
||||
|
||||
@@ -3,7 +3,7 @@ use core::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT};
|
||||
|
||||
/// This must be used by the kernel to ensure that context switches are done atomically
|
||||
/// Compare and exchange this to true when beginning a context switch on any CPU
|
||||
/// The Context::switch_to function will set it back to false, allowing other CPU's to switch
|
||||
/// The `Context::switch_to` function will set it back to false, allowing other CPU's to switch
|
||||
/// This must be done, as no locks can be held on the stack during switch
|
||||
pub static CONTEXT_SWITCH_LOCK: AtomicBool = ATOMIC_BOOL_INIT;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ use ::core::sync::atomic::AtomicUsize;
|
||||
int_like!(ContextId, AtomicContextId, usize, AtomicUsize);
|
||||
|
||||
/// The status of a context - used for scheduling
|
||||
/// See syscall::process::waitpid and the sync module for examples of usage
|
||||
/// See `syscall::process::waitpid` and the `sync` module for examples of usage
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub enum Status {
|
||||
Runnable,
|
||||
@@ -182,13 +182,11 @@ impl Context {
|
||||
} else if part == b".." {
|
||||
*nskip += 1;
|
||||
Some(None)
|
||||
} else {
|
||||
if *nskip > 0 {
|
||||
} else if *nskip > 0 {
|
||||
*nskip -= 1;
|
||||
Some(None)
|
||||
} else {
|
||||
Some(Some(part))
|
||||
}
|
||||
} else {
|
||||
Some(Some(part))
|
||||
}
|
||||
})
|
||||
.filter_map(|x| x)
|
||||
@@ -206,7 +204,7 @@ impl Context {
|
||||
result.pop(); // remove extra '/'
|
||||
|
||||
// replace with the root of the scheme if it's empty
|
||||
if result.len() == 0 {
|
||||
if result.is_empty() {
|
||||
let pos = canon.iter()
|
||||
.position(|&b| b == b':')
|
||||
.map_or(canon.len(), |p| p + 1);
|
||||
|
||||
@@ -71,7 +71,7 @@ impl ContextList {
|
||||
for b in fx.iter_mut() {
|
||||
*b = 0;
|
||||
}
|
||||
let mut stack = vec![0; 65536].into_boxed_slice();
|
||||
let mut stack = vec![0; 65_536].into_boxed_slice();
|
||||
let offset = stack.len() - mem::size_of::<usize>();
|
||||
unsafe {
|
||||
let offset = stack.len() - mem::size_of::<usize>();
|
||||
|
||||
@@ -37,7 +37,7 @@ pub mod timeout;
|
||||
pub const CONTEXT_MAX_CONTEXTS: usize = (isize::max_value() as usize) - 1;
|
||||
|
||||
/// Maximum context files
|
||||
pub const CONTEXT_MAX_FILES: usize = 65536;
|
||||
pub const CONTEXT_MAX_FILES: usize = 65_536;
|
||||
|
||||
/// Contexts list
|
||||
static CONTEXTS: Once<RwLock<ContextList>> = Once::new();
|
||||
@@ -77,6 +77,6 @@ pub fn contexts_mut() -> RwLockWriteGuard<'static, ContextList> {
|
||||
CONTEXTS.call_once(init_contexts).write()
|
||||
}
|
||||
|
||||
pub fn context_id() -> context::ContextId {
|
||||
pub fn context_id() -> ContextId {
|
||||
CONTEXT_ID.load(Ordering::SeqCst)
|
||||
}
|
||||
|
||||
10
src/lib.rs
10
src/lib.rs
@@ -1,9 +1,17 @@
|
||||
//! # The Redox OS Kernel, version 2
|
||||
//!
|
||||
//! The Redox OS Kernel is a microkernel that supports X86_64 systems and
|
||||
//! The Redox OS Kernel is a microkernel that supports `x86_64` systems and
|
||||
//! provides Unix-like syscalls for primarily Rust applications
|
||||
|
||||
//#![deny(warnings)]
|
||||
#![cfg_attr(feature = "clippy", allow(if_same_then_else))]
|
||||
#![cfg_attr(feature = "clippy", allow(inline_always))]
|
||||
#![cfg_attr(feature = "clippy", allow(many_single_char_names))]
|
||||
#![cfg_attr(feature = "clippy", allow(module_inception))]
|
||||
#![cfg_attr(feature = "clippy", allow(new_without_default))]
|
||||
#![cfg_attr(feature = "clippy", allow(not_unsafe_ptr_arg_deref))]
|
||||
#![cfg_attr(feature = "clippy", allow(or_fun_call))]
|
||||
#![cfg_attr(feature = "clippy", allow(too_many_arguments))]
|
||||
#![feature(alloc)]
|
||||
#![feature(allocator_api)]
|
||||
#![feature(asm)]
|
||||
|
||||
@@ -64,7 +64,7 @@ pub mod time;
|
||||
pub mod user;
|
||||
|
||||
/// Limit on number of schemes
|
||||
pub const SCHEME_MAX_SCHEMES: usize = 65536;
|
||||
pub const SCHEME_MAX_SCHEMES: usize = 65_536;
|
||||
|
||||
/// Unique identifier for a scheme namespace.
|
||||
int_like!(SchemeNamespace, AtomicSchemeNamespace, usize, AtomicUsize);
|
||||
@@ -197,7 +197,7 @@ impl SchemeList {
|
||||
return self.get(id).map(|scheme| (id, scheme));
|
||||
}
|
||||
}
|
||||
return None;
|
||||
None
|
||||
}
|
||||
|
||||
/// Create a new scheme.
|
||||
|
||||
@@ -205,7 +205,7 @@ impl UserInner {
|
||||
}
|
||||
}
|
||||
|
||||
/// UserInner has to be wrapped
|
||||
/// `UserInner` has to be wrapped
|
||||
pub struct UserScheme {
|
||||
inner: Weak<UserInner>
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ impl WaitCondition {
|
||||
let context_lock = {
|
||||
let contexts = context::contexts();
|
||||
let context_lock = contexts.current().expect("WaitCondition::wait: no context");
|
||||
context_lock.clone()
|
||||
Arc::clone(&context_lock)
|
||||
};
|
||||
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ impl<K, V> WaitMap<K, V> where K: Clone + Ord {
|
||||
|
||||
pub fn receive_any_nonblock(&self) -> Option<(K, V)> {
|
||||
let mut inner = self.inner.lock();
|
||||
if let Some(key) = inner.keys().next().map(|key| key.clone()) {
|
||||
if let Some(key) = inner.keys().next().cloned() {
|
||||
inner.remove(&key).map(|value| (key, value))
|
||||
} else {
|
||||
None
|
||||
|
||||
@@ -223,7 +223,7 @@ pub fn format_call(a: usize, b: usize, c: usize, d: usize, e: usize, f: usize) -
|
||||
b,
|
||||
c
|
||||
),
|
||||
SYS_GETEGID => format!("getgid()"),
|
||||
SYS_GETEGID => format!("getegid()"),
|
||||
SYS_GETENS => format!("getens()"),
|
||||
SYS_GETEUID => format!("geteuid()"),
|
||||
SYS_GETGID => format!("getgid()"),
|
||||
|
||||
@@ -8,7 +8,7 @@ use scheme::{self, FileHandle};
|
||||
use syscall;
|
||||
use syscall::data::{Packet, Stat};
|
||||
use syscall::error::*;
|
||||
use syscall::flag::{F_GETFD, F_SETFD, F_GETFL, F_SETFL, F_DUPFD, O_ACCMODE, O_RDONLY, O_WRONLY, MODE_DIR, MODE_FILE, O_CLOEXEC};
|
||||
use syscall::flag::{F_GETFD, F_SETFD, F_GETFL, F_SETFL, F_DUPFD, O_ACCMODE, O_DIRECTORY, O_RDONLY, O_WRONLY, MODE_DIR, MODE_FILE, O_CLOEXEC};
|
||||
use context::file::{FileDescriptor, FileDescription};
|
||||
|
||||
pub fn file_op(a: usize, fd: FileHandle, c: usize, d: usize) -> Result<usize> {
|
||||
@@ -23,7 +23,7 @@ pub fn file_op(a: usize, fd: FileHandle, c: usize, d: usize) -> Result<usize> {
|
||||
let scheme = {
|
||||
let schemes = scheme::schemes();
|
||||
let scheme = schemes.get(file.description.read().scheme).ok_or(Error::new(EBADF))?;
|
||||
scheme.clone()
|
||||
Arc::clone(&scheme)
|
||||
};
|
||||
|
||||
let mut packet = Packet {
|
||||
@@ -52,7 +52,7 @@ pub fn file_op_mut_slice(a: usize, fd: FileHandle, slice: &mut [u8]) -> Result<u
|
||||
|
||||
/// Change the current working directory
|
||||
pub fn chdir(path: &[u8]) -> Result<usize> {
|
||||
let fd = open(path, syscall::flag::O_RDONLY | syscall::flag::O_DIRECTORY)?;
|
||||
let fd = open(path, O_RDONLY | O_DIRECTORY)?;
|
||||
let mut stat = Stat::default();
|
||||
let stat_res = file_op_mut_slice(syscall::number::SYS_FSTAT, fd, &mut stat);
|
||||
let _ = close(fd);
|
||||
@@ -103,7 +103,7 @@ pub fn open(path: &[u8], flags: usize) -> Result<FileHandle> {
|
||||
let (scheme_id, scheme) = {
|
||||
let schemes = scheme::schemes();
|
||||
let (scheme_id, scheme) = schemes.get_name(scheme_ns, scheme_name).ok_or(Error::new(ENODEV))?;
|
||||
(scheme_id, scheme.clone())
|
||||
(scheme_id, Arc::clone(&scheme))
|
||||
};
|
||||
let file_id = scheme.open(reference_opt.unwrap_or(b""), flags, uid, gid)?;
|
||||
(scheme_id, file_id)
|
||||
@@ -178,7 +178,7 @@ pub fn chmod(path: &[u8], mode: u16) -> Result<usize> {
|
||||
let scheme = {
|
||||
let schemes = scheme::schemes();
|
||||
let (_scheme_id, scheme) = schemes.get_name(scheme_ns, scheme_name).ok_or(Error::new(ENODEV))?;
|
||||
scheme.clone()
|
||||
Arc::clone(&scheme)
|
||||
};
|
||||
scheme.chmod(reference_opt.unwrap_or(b""), mode, uid, gid)
|
||||
}
|
||||
@@ -200,7 +200,7 @@ pub fn rmdir(path: &[u8]) -> Result<usize> {
|
||||
let scheme = {
|
||||
let schemes = scheme::schemes();
|
||||
let (_scheme_id, scheme) = schemes.get_name(scheme_ns, scheme_name).ok_or(Error::new(ENODEV))?;
|
||||
scheme.clone()
|
||||
Arc::clone(&scheme)
|
||||
};
|
||||
scheme.rmdir(reference_opt.unwrap_or(b""), uid, gid)
|
||||
}
|
||||
@@ -222,7 +222,7 @@ pub fn unlink(path: &[u8]) -> Result<usize> {
|
||||
let scheme = {
|
||||
let schemes = scheme::schemes();
|
||||
let (_scheme_id, scheme) = schemes.get_name(scheme_ns, scheme_name).ok_or(Error::new(ENODEV))?;
|
||||
scheme.clone()
|
||||
Arc::clone(&scheme)
|
||||
};
|
||||
scheme.unlink(reference_opt.unwrap_or(b""), uid, gid)
|
||||
}
|
||||
@@ -233,8 +233,7 @@ pub fn close(fd: FileHandle) -> Result<usize> {
|
||||
let contexts = context::contexts();
|
||||
let context_lock = contexts.current().ok_or(Error::new(ESRCH))?;
|
||||
let context = context_lock.read();
|
||||
let file = context.remove_file(fd).ok_or(Error::new(EBADF))?;
|
||||
file
|
||||
context.remove_file(fd).ok_or(Error::new(EBADF))?
|
||||
};
|
||||
|
||||
file.close(fd)
|
||||
@@ -245,8 +244,7 @@ fn duplicate_file(fd: FileHandle, buf: &[u8]) -> Result<FileDescriptor> {
|
||||
let contexts = context::contexts();
|
||||
let context_lock = contexts.current().ok_or(Error::new(ESRCH))?;
|
||||
let context = context_lock.read();
|
||||
let file = context.get_file(fd).ok_or(Error::new(EBADF))?;
|
||||
file
|
||||
context.get_file(fd).ok_or(Error::new(EBADF))?
|
||||
};
|
||||
|
||||
if buf.is_empty() {
|
||||
@@ -262,8 +260,7 @@ fn duplicate_file(fd: FileHandle, buf: &[u8]) -> Result<FileDescriptor> {
|
||||
let scheme = {
|
||||
let schemes = scheme::schemes();
|
||||
let scheme = schemes.get(description.scheme).ok_or(Error::new(EBADF))?;
|
||||
|
||||
scheme.clone()
|
||||
Arc::clone(&scheme)
|
||||
};
|
||||
scheme.dup(description.number, buf)?
|
||||
};
|
||||
@@ -313,8 +310,7 @@ pub fn fcntl(fd: FileHandle, cmd: usize, arg: usize) -> Result<usize> {
|
||||
let contexts = context::contexts();
|
||||
let context_lock = contexts.current().ok_or(Error::new(ESRCH))?;
|
||||
let context = context_lock.read();
|
||||
let file = context.get_file(fd).ok_or(Error::new(EBADF))?;
|
||||
file
|
||||
context.get_file(fd).ok_or(Error::new(EBADF))?
|
||||
};
|
||||
|
||||
let description = file.description.read();
|
||||
@@ -324,7 +320,7 @@ pub fn fcntl(fd: FileHandle, cmd: usize, arg: usize) -> Result<usize> {
|
||||
let scheme = {
|
||||
let schemes = scheme::schemes();
|
||||
let scheme = schemes.get(description.scheme).ok_or(Error::new(EBADF))?;
|
||||
scheme.clone()
|
||||
Arc::clone(&scheme)
|
||||
};
|
||||
scheme.fcntl(description.number, cmd, arg)?;
|
||||
};
|
||||
@@ -405,7 +401,7 @@ pub fn fevent(fd: FileHandle, flags: usize) -> Result<usize> {
|
||||
let scheme = {
|
||||
let schemes = scheme::schemes();
|
||||
let scheme = schemes.get(description.scheme).ok_or(Error::new(EBADF))?;
|
||||
scheme.clone()
|
||||
Arc::clone(&scheme)
|
||||
};
|
||||
let event_id = scheme.fevent(description.number, flags)?;
|
||||
{
|
||||
|
||||
@@ -45,7 +45,7 @@ pub fn futex(addr: &mut i32, op: usize, val: i32, val2: usize, addr2: *mut i32)
|
||||
let context_lock = {
|
||||
let contexts = context::contexts();
|
||||
let context_lock = contexts.current().ok_or(Error::new(ESRCH))?;
|
||||
context_lock.clone()
|
||||
Arc::clone(&context_lock)
|
||||
};
|
||||
|
||||
if unsafe { intrinsics::atomic_load(addr) != val } {
|
||||
@@ -58,7 +58,7 @@ pub fn futex(addr: &mut i32, op: usize, val: i32, val2: usize, addr2: *mut i32)
|
||||
if let Some(timeout) = timeout_opt {
|
||||
let start = time::monotonic();
|
||||
let sum = start.1 + timeout.tv_nsec as u64;
|
||||
let end = (start.0 + timeout.tv_sec as u64 + sum / 1000000000, sum % 1000000000);
|
||||
let end = (start.0 + timeout.tv_sec as u64 + sum / 1_000_000_000, sum % 1_000_000_000);
|
||||
context.wake = Some(end);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ pub fn futex(addr: &mut i32, op: usize, val: i32, val2: usize, addr2: *mut i32)
|
||||
let context_lock = {
|
||||
let contexts = context::contexts();
|
||||
let context_lock = contexts.current().ok_or(Error::new(ESRCH))?;
|
||||
context_lock.clone()
|
||||
Arc::clone(&context_lock)
|
||||
};
|
||||
|
||||
{
|
||||
|
||||
@@ -240,25 +240,25 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<ContextId> {
|
||||
}
|
||||
|
||||
if flags & CLONE_VM == CLONE_VM {
|
||||
grants = context.grants.clone();
|
||||
grants = Arc::clone(&context.grants);
|
||||
} else {
|
||||
grants = Arc::new(Mutex::new(Vec::new()));
|
||||
}
|
||||
|
||||
if flags & CLONE_VM == CLONE_VM {
|
||||
name = context.name.clone();
|
||||
name = Arc::clone(&context.name);
|
||||
} else {
|
||||
name = Arc::new(Mutex::new(context.name.lock().clone()));
|
||||
}
|
||||
|
||||
if flags & CLONE_FS == CLONE_FS {
|
||||
cwd = context.cwd.clone();
|
||||
cwd = Arc::clone(&context.cwd);
|
||||
} else {
|
||||
cwd = Arc::new(Mutex::new(context.cwd.lock().clone()));
|
||||
}
|
||||
|
||||
if flags & CLONE_VM == CLONE_VM {
|
||||
env = context.env.clone();
|
||||
env = Arc::clone(&context.env);
|
||||
} else {
|
||||
let mut new_env = BTreeMap::new();
|
||||
for item in context.env.lock().iter() {
|
||||
@@ -268,13 +268,13 @@ pub fn clone(flags: usize, stack_base: usize) -> Result<ContextId> {
|
||||
}
|
||||
|
||||
if flags & CLONE_FILES == CLONE_FILES {
|
||||
files = context.files.clone();
|
||||
files = Arc::clone(&context.files);
|
||||
} else {
|
||||
files = Arc::new(Mutex::new(context.files.lock().clone()));
|
||||
}
|
||||
|
||||
if flags & CLONE_SIGHAND == CLONE_SIGHAND {
|
||||
actions = context.actions.clone();
|
||||
actions = Arc::clone(&context.actions);
|
||||
} else {
|
||||
actions = Arc::new(Mutex::new(context.actions.lock().clone()));
|
||||
}
|
||||
@@ -826,7 +826,7 @@ pub fn exit(status: usize) -> ! {
|
||||
let context_lock = {
|
||||
let contexts = context::contexts();
|
||||
let context_lock = contexts.current().ok_or(Error::new(ESRCH)).expect("exit failed to find context");
|
||||
context_lock.clone()
|
||||
Arc::clone(&context_lock)
|
||||
};
|
||||
|
||||
let mut close_files = Vec::new();
|
||||
@@ -892,7 +892,7 @@ pub fn exit(status: usize) -> ! {
|
||||
println!("{}: {} not blocked for exit vfork unblock", pid.into(), ppid.into());
|
||||
}
|
||||
}
|
||||
parent.waitpid.clone()
|
||||
Arc::clone(&parent.waitpid)
|
||||
};
|
||||
|
||||
for (c_pid, c_status) in children {
|
||||
@@ -1134,7 +1134,7 @@ pub fn waitpid(pid: ContextId, status_ptr: usize, flags: usize) -> Result<Contex
|
||||
let contexts = context::contexts();
|
||||
let context_lock = contexts.current().ok_or(Error::new(ESRCH))?;
|
||||
let context = context_lock.read();
|
||||
(context.id, context.waitpid.clone())
|
||||
(context.id, Arc::clone(&context.waitpid))
|
||||
};
|
||||
|
||||
let mut tmp = [0];
|
||||
@@ -1167,7 +1167,7 @@ pub fn waitpid(pid: ContextId, status_ptr: usize, flags: usize) -> Result<Contex
|
||||
context.ppid = ppid;
|
||||
//return Err(Error::new(ECHILD));
|
||||
}
|
||||
context.status.clone()
|
||||
context.status
|
||||
};
|
||||
|
||||
if let context::Status::Exited(status) = status {
|
||||
|
||||
@@ -19,7 +19,7 @@ pub fn clock_gettime(clock: usize, time: &mut TimeSpec) -> Result<usize> {
|
||||
pub fn nanosleep(req: &TimeSpec, rem_opt: Option<&mut TimeSpec>) -> Result<usize> {
|
||||
let start = time::monotonic();
|
||||
let sum = start.1 + req.tv_nsec as u64;
|
||||
let end = (start.0 + req.tv_sec as u64 + sum / 1000000000, sum % 1000000000);
|
||||
let end = (start.0 + req.tv_sec as u64 + sum / 1_000_000_000, sum % 1_000_000_000);
|
||||
|
||||
{
|
||||
let contexts = context::contexts();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use spin::Mutex;
|
||||
|
||||
/// Kernel start time, measured in (seconds, nanoseconds) since Unix epoch
|
||||
pub static START: Mutex<(u64, u64)> = Mutex::new((0, 0));
|
||||
/// Kernel up time, measured in (seconds, nanoseconds) since `START_TIME`
|
||||
pub static OFFSET: Mutex<(u64, u64)> = Mutex::new((0, 0));
|
||||
|
||||
pub fn monotonic() -> (u64, u64) {
|
||||
@@ -11,5 +13,5 @@ pub fn realtime() -> (u64, u64) {
|
||||
let offset = monotonic();
|
||||
let start = *START.lock();
|
||||
let sum = start.1 + offset.1;
|
||||
(start.0 + offset.0 + sum / 1000000000, sum % 1000000000)
|
||||
(start.0 + offset.0 + sum / 1_000_000_000, sum % 1_000_000_000)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user