Skip to content

Commit d2f96c2

Browse files
authored
Updates losetup deps and adds partscan option (mdaffin#54)
Also fixes some other issues with the arguments.
1 parent 9438762 commit d2f96c2

File tree

3 files changed

+190
-30
lines changed

3 files changed

+190
-30
lines changed

losetup/Cargo.lock

Lines changed: 176 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

losetup/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version = "0.2.0"
55
description = "Setup and control loopback devices"
66

77
[dependencies]
8-
clap = "2.23.3"
8+
clap = "2.34.0"
99

1010
[dependencies.loopdev]
1111
optional = false

losetup/src/main.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ use std::io::{self, Write};
77
use std::process::exit;
88

99
fn find() -> io::Result<()> {
10-
let loopdev = LoopControl::open()?.next_free()?;
11-
println!("{}", loopdev.path().unwrap().display());
10+
println!(
11+
"{}",
12+
LoopControl::open()?.next_free()?.path().unwrap().display()
13+
);
1214
Ok(())
1315
}
1416

@@ -17,9 +19,10 @@ fn attach(matches: &clap::ArgMatches) -> io::Result<()> {
1719
let image = matches.value_of("image").unwrap();
1820
let offset = value_t!(matches.value_of("offset"), u64).unwrap_or(0);
1921
let size_limit = value_t!(matches.value_of("sizelimit"), u64).unwrap_or(0);
20-
let read_only = matches.is_present("read-only");
21-
let autoclear = matches.is_present("autoclear");
22-
let mut loopdev = match matches.value_of("loopdev") {
22+
let read_only = matches.is_present("read_only");
23+
let auto_clear = matches.is_present("auto_clear");
24+
let part_scan = matches.is_present("part_scan");
25+
let loopdev = match matches.value_of("loopdev") {
2326
Some(loopdev) => LoopDevice::open(&loopdev)?,
2427
None => LoopControl::open().and_then(|lc| lc.next_free())?,
2528
};
@@ -28,7 +31,8 @@ fn attach(matches: &clap::ArgMatches) -> io::Result<()> {
2831
.offset(offset)
2932
.size_limit(size_limit)
3033
.read_only(read_only)
31-
.autoclear(autoclear)
34+
.autoclear(auto_clear)
35+
.part_scan(part_scan)
3236
.attach(image)?;
3337

3438
if !quiet {
@@ -69,8 +73,9 @@ fn main() {
6973
(@arg loopdev: "the loop device to attach")
7074
(@arg offset: -o --offset +takes_value "the offset within the file to start at")
7175
(@arg sizelimit: -s --sizelimit +takes_value "the file is limited to this size")
72-
(@arg read_only: -r --read-only "set up a read-only loop device")
73-
(@arg autoclear: -a --autoclear "set the autoclear flag")
76+
(@arg read_only: -r --readonly "set up a read-only loop device")
77+
(@arg auto_clear: -a --autoclear "set the autoclear flag")
78+
(@arg part_scan: -p --partscan "set the part-scan flag")
7479
(@arg quiet: -q --quiet "don't print the device name")
7580
)
7681
(@subcommand detach =>

0 commit comments

Comments
 (0)