Skip to content

Commit cb85851

Browse files
committed
Restructure module
1 parent 3a1cdf4 commit cb85851

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/main.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
use std::io::Result;
22

33
mod cli;
4-
5-
mod dgpu;
6-
mod perf;
7-
mod latch;
4+
mod sys;
85

96

107
fn main() {
@@ -25,8 +22,8 @@ fn main() {
2522

2623

2724
fn cmd_status(_: &clap::ArgMatches) -> Result<()> {
28-
let dgpu_power = dgpu::Device::open()?.get_power()?;
29-
let perf_mode = perf::Device::open()?.get_mode()?;
25+
let dgpu_power = sys::dgpu::Device::open()?.get_power()?;
26+
let perf_mode = sys::perf::Device::open()?.get_mode()?;
3027

3128
println!("System Status:");
3229
println!(" Performance-Mode: {}", perf_mode);
@@ -46,13 +43,13 @@ fn cmd_dgpu(m: &clap::ArgMatches) -> Result<()> {
4643

4744
fn cmd_dgpu_set(m: &clap::ArgMatches) -> Result<()> {
4845
use clap::value_t_or_exit;
49-
let state = value_t_or_exit!(m, "state", dgpu::PowerState);
46+
let state = value_t_or_exit!(m, "state", sys::dgpu::PowerState);
5047

51-
dgpu::Device::open()?.set_power(state)
48+
sys::dgpu::Device::open()?.set_power(state)
5249
}
5350

5451
fn cmd_dgpu_get(_: &clap::ArgMatches) -> Result<()> {
55-
println!("{}", dgpu::Device::open()?.get_power()?);
52+
println!("{}", sys::dgpu::Device::open()?.get_power()?);
5653
Ok(())
5754
}
5855

@@ -67,13 +64,13 @@ fn cmd_perf(m: &clap::ArgMatches) -> Result<()> {
6764

6865
fn cmd_perf_set(m: &clap::ArgMatches) -> Result<()> {
6966
use clap::value_t_or_exit;
70-
let state = value_t_or_exit!(m, "mode", perf::Mode);
67+
let state = value_t_or_exit!(m, "mode", sys::perf::Mode);
7168

72-
perf::Device::open()?.set_mode(state)
69+
sys::perf::Device::open()?.set_mode(state)
7370
}
7471

7572
fn cmd_perf_get(_: &clap::ArgMatches) -> Result<()> {
76-
println!("{}", perf::Device::open()?.get_mode()?);
73+
println!("{}", sys::perf::Device::open()?.get_mode()?);
7774
Ok(())
7875
}
7976

@@ -89,18 +86,18 @@ fn cmd_latch(m: &clap::ArgMatches) -> Result<()> {
8986
}
9087

9188
fn cmd_latch_lock(_: &clap::ArgMatches) -> Result<()> {
92-
latch::Device::open()?.latch_lock()
89+
sys::latch::Device::open()?.latch_lock()
9390
}
9491

9592
fn cmd_latch_unlock(_: &clap::ArgMatches) -> Result<()> {
96-
latch::Device::open()?.latch_unlock()
93+
sys::latch::Device::open()?.latch_unlock()
9794
}
9895

9996
fn cmd_latch_request(_: &clap::ArgMatches) -> Result<()> {
100-
latch::Device::open()?.latch_request()
97+
sys::latch::Device::open()?.latch_request()
10198
}
10299

103100
fn cmd_latch_get_opmode(_: &clap::ArgMatches) -> Result<()> {
104-
println!("{}", latch::Device::open()?.get_opmode()?);
101+
println!("{}", sys::latch::Device::open()?.get_opmode()?);
105102
Ok(())
106103
}
File renamed without changes.
File renamed without changes.

src/sys/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pub mod dgpu;
2+
pub mod perf;
3+
pub mod latch;
File renamed without changes.

0 commit comments

Comments
 (0)