From 0ecee592583a93a3d1f8ce9ee25eee9f9fe57b42 Mon Sep 17 00:00:00 2001 From: Avril Date: Mon, 28 Dec 2020 00:44:41 +0000 Subject: [PATCH] usage mesasge --- src/main.rs | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index cb6298f..178a94d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,16 +8,35 @@ mod work; mod consts; +fn usage() -> ! +{ + eprintln!("uasge: {} ", std::env::args().next().unwrap()); + + eprintln!(); + eprintln!("mapcat v{}: mmap() based file concatenation", env!("CARGO_PKG_VERSION")); + eprintln!(" by {} with <3 (licensed GPL3+)", env!("CARGO_PKG_AUTHORS")); + eprintln!(); + + eprintln!("NOTES:"); + eprintln!("The output file is required, if one is not provided, we will just exit with error code `2`. If there are no input files, it will just create an empty output and return with error code `0` (unless there were other errors)"); + eprintln!("Output files are always clobbered regardless if there are any inputs, or if the concatenation operation succeeds / fails"); + eprintln!(); + eprintln!(" (compiled with write parallelisation enabled)"); //TODO: we will eventually feature gate the threaded scheduler based solution. but for now, it is the only one implemented so we'll just print this always + + std::process::exit(0) +} + fn main() { - println!("Hello, world!"); + usage() // todo: // - create and open output file - // - open and stat all input files (`job::create_from_file`). + // - open and stat all input files in order (`job::create_from_file`). // - `fallocate` the output file fd to the sum of all input file sizes // - `mmap` the output file as writable // // - spawn the task thread pool - // - dispatch jobs with their fds, stats, and calculated output offsets along with a reference to the output mapped file (`job::Prelude::start`) + // - move the output mapped file to the thread-safe refcounted `state::State`. + // - dispatch jobs to the pool with their fds, stats, and calculated output offsets; along with a reference to the output mapped file (`job::Prelude::start`) // - wait on all worker threads to complete. // - ensure all data was written. }