diff --git a/README.org b/README.org index f704dd5..d7c158c 100644 --- a/README.org +++ b/README.org @@ -44,17 +44,18 @@ In addition to executing commands, you can only do the following things. ** Userland Application -The userland comes with a user library called ulib that is similar to Rust’s -std, so you can use it to develop your favorite commands. If you create a bin -crate named ~_command~ in src/user, the build.rs and mkfs.rs will place a file -named ~command~ in the file system and make it available for use. +The userland comes with a user library called ulib (located at src/user/lib) +that is similar to Rust’s std, so you can use it to develop your favorite +commands. If you create a bin crate named ~_command~ in src/user/bin, the +build.rs and mkfs.rs will place a file named ~command~ in the file system +and make it available for use. - In src/user/Cargo.toml, define a bin crate with the name of the command you want to create with a ~_~ prefix #+begin_src toml [[bin]] name = "_rm" - path = "rm.rs" + path = "bin/rm.rs" #+end_src - userland is also no_std, so don’t forget to add ~#[no_std]~. Use ulib to develop any command you like. Here is an example of the rm command. diff --git a/src/user/Cargo.toml b/src/user/Cargo.toml index 0de634e..3ea3fb6 100644 --- a/src/user/Cargo.toml +++ b/src/user/Cargo.toml @@ -12,59 +12,59 @@ forced-target = "riscv64gc-unknown-none-elf" [lib] name = "ulib" -path = "lib.rs" +path = "lib/lib.rs" [[bin]] name = "_cat" -path = "cat.rs" +path = "bin/cat.rs" [[bin]] name = "_echo" -path = "echo.rs" +path = "bin/echo.rs" [[bin]] name = "_grep" -path = "grep.rs" +path = "bin/grep.rs" [[bin]] name = "_init" -path = "init.rs" +path = "bin/init.rs" [[bin]] name = "_initcode" -path = "initcode.rs" +path = "bin/initcode.rs" [[bin]] name = "_kill" -path = "kill.rs" +path = "bin/kill.rs" [[bin]] name = "_ln" -path = "ln.rs" +path = "bin/ln.rs" [[bin]] name = "_ls" -path = "ls.rs" +path = "bin/ls.rs" [[bin]] name = "_mkdir" -path = "mkdir.rs" +path = "bin/mkdir.rs" [[bin]] name = "_rm" -path = "rm.rs" +path = "bin/rm.rs" [[bin]] name = "_sh" -path = "sh.rs" +path = "bin/sh.rs" [[bin]] name = "_wc" -path = "wc.rs" +path = "bin/wc.rs" [[bin]] name = "_head" -path = "head.rs" +path = "bin/head.rs" [dependencies] libkernel = { workspace = true } diff --git a/src/user/cat.rs b/src/user/bin/cat.rs similarity index 100% rename from src/user/cat.rs rename to src/user/bin/cat.rs diff --git a/src/user/echo.rs b/src/user/bin/echo.rs similarity index 100% rename from src/user/echo.rs rename to src/user/bin/echo.rs diff --git a/src/user/grep.rs b/src/user/bin/grep.rs similarity index 100% rename from src/user/grep.rs rename to src/user/bin/grep.rs diff --git a/src/user/head.rs b/src/user/bin/head.rs similarity index 100% rename from src/user/head.rs rename to src/user/bin/head.rs diff --git a/src/user/init.rs b/src/user/bin/init.rs similarity index 100% rename from src/user/init.rs rename to src/user/bin/init.rs diff --git a/src/user/initcode.rs b/src/user/bin/initcode.rs similarity index 100% rename from src/user/initcode.rs rename to src/user/bin/initcode.rs diff --git a/src/user/kill.rs b/src/user/bin/kill.rs similarity index 100% rename from src/user/kill.rs rename to src/user/bin/kill.rs diff --git a/src/user/ln.rs b/src/user/bin/ln.rs similarity index 100% rename from src/user/ln.rs rename to src/user/bin/ln.rs diff --git a/src/user/ls.rs b/src/user/bin/ls.rs similarity index 100% rename from src/user/ls.rs rename to src/user/bin/ls.rs diff --git a/src/user/mkdir.rs b/src/user/bin/mkdir.rs similarity index 100% rename from src/user/mkdir.rs rename to src/user/bin/mkdir.rs diff --git a/src/user/rm.rs b/src/user/bin/rm.rs similarity index 100% rename from src/user/rm.rs rename to src/user/bin/rm.rs diff --git a/src/user/sh.rs b/src/user/bin/sh.rs similarity index 100% rename from src/user/sh.rs rename to src/user/bin/sh.rs diff --git a/src/user/wc.rs b/src/user/bin/wc.rs similarity index 100% rename from src/user/wc.rs rename to src/user/bin/wc.rs diff --git a/src/user/env.rs b/src/user/lib/env.rs similarity index 100% rename from src/user/env.rs rename to src/user/lib/env.rs diff --git a/src/user/fs.rs b/src/user/lib/fs.rs similarity index 100% rename from src/user/fs.rs rename to src/user/lib/fs.rs diff --git a/src/user/io.rs b/src/user/lib/io.rs similarity index 100% rename from src/user/io.rs rename to src/user/lib/io.rs diff --git a/src/user/lib.rs b/src/user/lib/lib.rs similarity index 100% rename from src/user/lib.rs rename to src/user/lib/lib.rs diff --git a/src/user/mutex.rs b/src/user/lib/mutex.rs similarity index 100% rename from src/user/mutex.rs rename to src/user/lib/mutex.rs diff --git a/src/user/path.rs b/src/user/lib/path.rs similarity index 100% rename from src/user/path.rs rename to src/user/lib/path.rs diff --git a/src/user/pipe.rs b/src/user/lib/pipe.rs similarity index 100% rename from src/user/pipe.rs rename to src/user/lib/pipe.rs diff --git a/src/user/process.rs b/src/user/lib/process.rs similarity index 100% rename from src/user/process.rs rename to src/user/lib/process.rs diff --git a/src/user/stat.rs b/src/user/lib/stat.rs similarity index 100% rename from src/user/stat.rs rename to src/user/lib/stat.rs diff --git a/src/user/stdio.rs b/src/user/lib/stdio.rs similarity index 100% rename from src/user/stdio.rs rename to src/user/lib/stdio.rs diff --git a/src/user/umalloc.rs b/src/user/lib/umalloc.rs similarity index 100% rename from src/user/umalloc.rs rename to src/user/lib/umalloc.rs