Conversation
e929b30 to
23519af
Compare
|
A lot of warnings when |
|
try to change commit message to |
|
|
you need to fix clippy before go next step |
| false => return rand_lcg32() as c_int, | ||
| } | ||
| } | ||
| rand_lcg32() as c_int |
There was a problem hiding this comment.
warning: unreachable expression
--> api/ruxos_posix_api/src/imp/getrandom.rs:133:5
|
128 | / match has_rdrand() {
129 | | true => return (random_hw() >> 33) as c_int,
130 | | false => return rand_lcg32() as c_int,
131 | | }
| |_________- any code following this `match` expression is unreachable, as all arms diverge
132 | }
133 | rand_lcg32() as c_int
| ^^^^^^^^^^^^^^^^^^^^^ unreachable expression
|
= note: `#[warn(unreachable_code)]` on by default
warning: unreachable expression
--> api/ruxos_posix_api/src/imp/getrandom.rs:152:5
|
146 | / match has_rdrand() {
147 | | true => return (random_hw() >> 1) as c_long,
148 | | false => return random_lcg64() as c_long,
149 | | }
| |_________- any code following this `match` expression is unreachable, as all arms diverge
...
152 | random_lcg64() as c_long
| ^^^^^^^^^^^^^^^^^^^^^^^^ unreachable expression
modules/ruxdriver/src/dummy.rs
Outdated
| fn info(&self) -> driver_rng::RngInfo { | ||
| unreachable!() | ||
| } | ||
| fn request_entropy(&mut self, dst: &mut [u8]) -> DevResult<usize> { |
There was a problem hiding this comment.
warning: unused variable: `dst`
--> modules/ruxdriver/src/dummy.rs:135:43
|
135 | fn request_entropy(&mut self, dst: &mut [u8]) -> DevResult<usize> {
| ^^^ help: if this is intentional, prefix it with an underscore: `_dst`
|
= note: `#[warn(unused_variables)]` on by default
modules/ruxruntime/src/lib.rs
Outdated
| let all_devices = ruxdriver::init_drivers(); | ||
|
|
||
| #[cfg(feature = "rng")] | ||
| ruxrand::init(all_devices.rng, cpu_id); |
There was a problem hiding this comment.
as you move ruxrand::init(cpu_id); there, it won't be initiazed when feature=rand is enabled, are you sure is it right. What will happen if rng is enabled without a virtio-rng?
There was a problem hiding this comment.
If run with RNG=y but without FEATURE virtio-rng It will raise an error that there is no rng.
crates/driver_rng/src/xoshiro.rs
Outdated
| type PercpuRngType = Xoshiro256StarStar; | ||
|
|
||
| #[def_percpu] | ||
| pub(crate) static PERCPU_RNG: LazyInit<PercpuRngType> = LazyInit::new(); |
There was a problem hiding this comment.
The code structure here is too similar to ruxrand, and it seems to involve almost no virtio hardware, so there's no hardware abstraction. It's also hard to see the necessity of this...
There was a problem hiding this comment.
To be precise, I believe this crate should only retain a lib.rs file. The other two pseudo-random number generators should be placed together within ruxrand; otherwise, it could easily cause confusion.
e736934 to
716af40
Compare
b957f0e to
dbca725
Compare
add rng device and virtio rng