summaryrefslogtreecommitdiffhomepage
path: root/tooling
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-05-09 20:22:01 +0200
committerAmlal <amlal@nekernel.org>2025-05-09 20:23:52 +0200
commit1391fa1bdc1cfe864596d3120bda12590131bc62 (patch)
tree103f36459712cd3af1af8d603404684ce41718b4 /tooling
parent902bafa5dc8c3ac5fcbf13a5af73e016e9c64685 (diff)
dev(kernel, tooling): better code quality inside the codebase and more checks inside the kernel, and cli.
also: - make use _NeMain for the mk_fwrk tool. Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'tooling')
-rw-r--r--tooling/fsck.hefs.cc11
-rwxr-xr-xtooling/mk_fwrk.py2
-rw-r--r--tooling/mkfs.hefs.cc11
3 files changed, 19 insertions, 5 deletions
diff --git a/tooling/fsck.hefs.cc b/tooling/fsck.hefs.cc
index 05cf0660..9d67aa38 100644
--- a/tooling/fsck.hefs.cc
+++ b/tooling/fsck.hefs.cc
@@ -5,11 +5,16 @@
------------------------------------------- */
#include <tooling/hefs.h>
+#include <tooling/mkfs.h>
#include <cstdlib>
int main(int argc, char** argv) {
- (void) (argc);
- (void) (argv);
+ if (argc < 2) {
+ mkfs::console_out() << "fsck: hefs: usage: fsck.hefs i <input_device>" << "\n";
+ return EXIT_FAILURE;
+ }
- return EXIT_FAILURE;
+ (void) argv;
+
+ return EXIT_SUCCESS;
} \ No newline at end of file
diff --git a/tooling/mk_fwrk.py b/tooling/mk_fwrk.py
index 36cc4e8e..9bc132e6 100755
--- a/tooling/mk_fwrk.py
+++ b/tooling/mk_fwrk.py
@@ -64,7 +64,7 @@ def create_directory_structure(base_path, project_name):
proj_cpp_path = os.path.join(base_path, project_name, f"src/CommandLine.cc")
- cpp_file = "int main() {\n\treturn 0;\n}"
+ cpp_file = "#include <user/SystemCalls.h>\n\nSInt32 _NeMain(SInt32 argc, Char* argv[]) {\n\treturn EXIT_FAILURE;\n}"
with open(proj_cpp_path, 'w') as cpp_file_io:
cpp_file_io.write(cpp_file)
diff --git a/tooling/mkfs.hefs.cc b/tooling/mkfs.hefs.cc
index c8243b5c..3dcfd11b 100644
--- a/tooling/mkfs.hefs.cc
+++ b/tooling/mkfs.hefs.cc
@@ -9,11 +9,20 @@
#include <cstdlib>
#include <fstream>
-static size_t kDiskSize = 1024 * 1024 * 1024 * 4UL;
+namespace detail {
+/// @interal
+/// @brief GB equation formula.
+static constexpr size_t gib_cast(uint32_t gb) {
+ return ((1024 ^ 3) * gb);
+}
+} // namespace detail
+
+static size_t kDiskSize = detail::gib_cast(4UL);
static uint16_t kVersion = kHeFSVersion;
static std::u8string kLabel = kHeFSDefaultVolumeName;
static size_t kSectorSize = 512;
+/// @brief Entrypoint of tool.
int main(int argc, char** argv) {
if (argc < 2) {
mkfs::console_out()