Merge branch 'misc_changes' into 'master'
Couple of improvements See merge request redox-os/redox-initfs!1
This commit is contained in:
+1
-5
@@ -15,12 +15,8 @@ default = ["std"]
|
||||
|
||||
std = []
|
||||
|
||||
# Enables functionality to actually read the filesystem, which is only done in
|
||||
# the kernel. (Writing to the filesystem is done in utils, and that crate only
|
||||
# needs the type definitions).
|
||||
kernel = []
|
||||
|
||||
[dev-dependencies]
|
||||
# FIXME remove loggers
|
||||
log = "0.4"
|
||||
env_logger = "0.8"
|
||||
anyhow = "1"
|
||||
|
||||
+4
-1
@@ -1,7 +1,10 @@
|
||||
#![cfg_attr(not(any(test, feature = "std")), no_std)]
|
||||
#![no_std]
|
||||
//! A super simple initfs, only meant to be loaded into RAM by the bootloader, and then directly be
|
||||
//! read.
|
||||
|
||||
#[cfg(any(test, feature = "std"))]
|
||||
extern crate std;
|
||||
|
||||
use core::convert::{TryFrom, TryInto};
|
||||
|
||||
pub mod types;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ name = "redox-initfs-dump"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
clap = "2.33"
|
||||
clap = { version = "4", features = ["cargo"] }
|
||||
env_logger = "0.8"
|
||||
log = "0.4"
|
||||
plain = "0.2"
|
||||
|
||||
+12
-15
@@ -1,44 +1,41 @@
|
||||
use std::path::Path;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use clap::{App, Arg};
|
||||
use clap::{Arg, Command};
|
||||
|
||||
#[path = "../archive_common.rs"]
|
||||
mod archive_common;
|
||||
use self::archive_common::{self as archive, Args, DEFAULT_MAX_SIZE};
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let matches = App::new("redox-initfs-ar")
|
||||
let matches = Command::new("redox-initfs-ar")
|
||||
.about("create an initfs image from a directory")
|
||||
.version(clap::crate_version!())
|
||||
.author(clap::crate_authors!())
|
||||
.arg(
|
||||
Arg::with_name("MAX_SIZE")
|
||||
.long("--max-size")
|
||||
.short("-m")
|
||||
.takes_value(true)
|
||||
Arg::new("MAX_SIZE")
|
||||
.long("max-size")
|
||||
.short('m')
|
||||
.required(false)
|
||||
.help("Set the upper limit for how large the image can become (default 64 MiB)."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("SOURCE")
|
||||
.takes_value(true)
|
||||
Arg::new("SOURCE")
|
||||
.required(true)
|
||||
.help("Specify the source directory to build the image from."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("OUTPUT")
|
||||
.takes_value(true)
|
||||
Arg::new("OUTPUT")
|
||||
.required(true)
|
||||
.long("--output")
|
||||
.short("-o")
|
||||
.long("output")
|
||||
.short('o')
|
||||
.help("Specify the path of the new image file."),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
env_logger::init();
|
||||
|
||||
let max_size = if let Some(max_size_str) = matches.value_of("MAX_SIZE") {
|
||||
let max_size = if let Some(max_size_str) = matches.get_one::<String>("MAX_SIZE") {
|
||||
max_size_str
|
||||
.parse::<u64>()
|
||||
.context("expected an integer for MAX_SIZE")?
|
||||
@@ -47,11 +44,11 @@ fn main() -> Result<()> {
|
||||
};
|
||||
|
||||
let source = matches
|
||||
.value_of("SOURCE")
|
||||
.get_one::<String>("SOURCE")
|
||||
.expect("expected the required arg SOURCE to exist");
|
||||
|
||||
let destination = matches
|
||||
.value_of("OUTPUT")
|
||||
.get_one::<String>("OUTPUT")
|
||||
.expect("expected the required arg OUTPUT to exist");
|
||||
|
||||
let args = Args {
|
||||
|
||||
+18
-8
@@ -1,23 +1,24 @@
|
||||
use std::ffi::OsString;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use clap::{App, Arg};
|
||||
use clap::{Arg, Command};
|
||||
|
||||
use redox_initfs::InitFs;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let matches = App::new("redox-initfs-dump")
|
||||
let matches = Command::new("redox-initfs-dump")
|
||||
.about("dump initfs metadata")
|
||||
.version(clap::crate_version!())
|
||||
.author(clap::crate_authors!())
|
||||
.arg(
|
||||
Arg::with_name("IMAGE")
|
||||
.takes_value(true)
|
||||
Arg::new("IMAGE")
|
||||
.required(true)
|
||||
.help("specify the image to dump")
|
||||
.help("specify the image to dump"),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
let source = matches
|
||||
.value_of_os("IMAGE")
|
||||
.get_one::<OsString>("IMAGE")
|
||||
.expect("expected the required arg IMAGE to exist");
|
||||
|
||||
let bytes = std::fs::read(source).context("failed to read image into memory")?;
|
||||
@@ -35,7 +36,12 @@ fn main() -> Result<()> {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
print!("mode={:#0o}, uid={}, gid={}, kind=", inode_struct.mode(), inode_struct.uid(), inode_struct.gid());
|
||||
print!(
|
||||
"mode={:#0o}, uid={}, gid={}, kind=",
|
||||
inode_struct.mode(),
|
||||
inode_struct.uid(),
|
||||
inode_struct.gid()
|
||||
);
|
||||
|
||||
use redox_initfs::InodeKind;
|
||||
|
||||
@@ -67,7 +73,11 @@ fn main() -> Result<()> {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
println!("\t`{}` => {:?},", String::from_utf8_lossy(name), entry.inode());
|
||||
println!(
|
||||
"\t`{}` => {:?},",
|
||||
String::from_utf8_lossy(name),
|
||||
entry.inode()
|
||||
);
|
||||
}
|
||||
|
||||
println!("]}}");
|
||||
|
||||
Reference in New Issue
Block a user