Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SC64][SW] Add inital fuse support #97

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
**/*.zip

!**/.vscode/tasks.json
sw/deployer/.idea/
.idea/
Comment on lines +8 to +9
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use **/.idea instead of creating specific entries. Please keep the style consistent by moving it above !.. entry, and don't forget to sort entries alphabetically.

90 changes: 88 additions & 2 deletions sw/deployer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions sw/deployer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ rust-ini = "0.18.0"
serial2 = "0.2.26"
serialport = "4.4.0"

[target.'cfg(unix)'.dependencies]
Copy link
Owner

@Polprzewodnikowy Polprzewodnikowy Nov 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is anything preventing this code from working on macOS?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my understanding "unix" does also include macOS? I didn't test it yet though

fuse_mt = "0.6.1"
libc = "0.2.161"
log = "0.4.22"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this even needed? println! is not enough?


[profile.release]
lto = true
strip = true
14 changes: 14 additions & 0 deletions sw/deployer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ enum SDCommands {
/// Format the SD card
#[command(name = "mkfs")]
Format,

/// Mount the SD card
#[command(name = "fuse")]
#[cfg(unix)]
Fuse {
/// Path to the directory
mount_path: PathBuf,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the name of parameter to path and explain what it does in the description one line above. "Path to the directory" tells noting in this context.

},
}

#[derive(Subcommand)]
Expand Down Expand Up @@ -990,6 +998,12 @@ fn handle_sd_command(connection: Connection, command: &SDCommands) -> Result<(),
}
log_wait(format!("Formatting the SD card"), || ff.mkfs())?;
}
#[cfg(unix)]
SDCommands::Fuse { mount_path } => {
let fuse_args = [std::ffi::OsStr::new("-o"), std::ffi::OsStr::new("fsname=passthrufs,allow_other,auto_unmount")];

fuse_mt::mount(fuse_mt::FuseMT::new(ff, 1), mount_path, &fuse_args[..])?;
}
}

Ok(())
Expand Down
Loading