summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-17 09:19:52 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-11-17 09:19:52 +0100
commit0d931fe17b32cc5082f1180138dbb7bd6416dd14 (patch)
tree2c5b2f6176423cf53d419fd2e6d5131d2bbb224f
parentbfce4d5673fc469395e0d438daa7f6d839834abc (diff)
tools: feat: new syntax for function.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
-rw-r--r--.gitignore1
-rw-r--r--dev/boot/BootKit/Qr.h4
-rw-r--r--dev/boot/src/BootFileReader.cc2
-rw-r--r--dev/boot/src/HEL/AMD64/BootEFI.cc2
-rw-r--r--dev/kernel/HALKit/AMD64/HalDebugOutput.cc8
-rw-r--r--dev/kernel/HALKit/AMD64/HalKernelMain.cc2
-rw-r--r--dev/kernel/HALKit/ARM64/HalKernelMain.cc2
-rw-r--r--dev/kernel/KernelKit/KernelTaskScheduler.h2
-rw-r--r--dev/kernel/src/UserProcessScheduler.cc6
-rw-r--r--dev/modules/APM/APM.h4
-rw-r--r--dev/modules/CoreGfx/CoreAccess.h8
-rw-r--r--dev/modules/CoreGfx/CoreGfx.h14
-rw-r--r--dev/modules/CoreGfx/MathGfx.h6
-rw-r--r--dev/modules/CoreGfx/TextGfx.h6
-rw-r--r--dev/modules/HPET/.gitkeep0
-rw-r--r--docs/drawio/GUI_DESIGN.drawio6
-rw-r--r--tools/chk.hefs.cc (renamed from tools/fsck.hefs.cc)8
-rw-r--r--tools/chk.hefs.json (renamed from tools/fsck.hefs.json)4
-rw-r--r--tools/libmkfs/mkfs.h5
-rw-r--r--tools/mkfs.hefs.cc47
20 files changed, 70 insertions, 67 deletions
diff --git a/.gitignore b/.gitignore
index 329688e2..fcd84d09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,6 +24,7 @@ neoskrnl/neoskrnl.xcodeproj/project.xcworkspace/xcshareddata/
tools/dist/mkfs.*
tools/dist/fsck.*
+tools/dist/chk.*
html/
latex/
diff --git a/dev/boot/BootKit/Qr.h b/dev/boot/BootKit/Qr.h
index 2dcfc5fe..f537aa5e 100644
--- a/dev/boot/BootKit/Qr.h
+++ b/dev/boot/BootKit/Qr.h
@@ -306,7 +306,7 @@ template <int V>
bool Qr<V>::draw(int whereX, int whereY) noexcept {
if (!this->status) return false; // it may be invalid.
- fb_init();
+ cg_init();
for (int y = 0; y < (this->side_size()); ++y) {
for (int x = 0; x < (this->side_size()); ++x) {
@@ -315,7 +315,7 @@ bool Qr<V>::draw(int whereX, int whereY) noexcept {
}
}
- fb_clear();
+ cg_clear();
return false;
}
diff --git a/dev/boot/src/BootFileReader.cc b/dev/boot/src/BootFileReader.cc
index c95623b6..dca260bc 100644
--- a/dev/boot/src/BootFileReader.cc
+++ b/dev/boot/src/BootFileReader.cc
@@ -75,7 +75,7 @@ Boot::BootFileReader::BootFileReader(const CharacterTypeUTF16* path, EfiHandlePt
mWriter.Write(L"BootZ: Fetch-Protocol: No-Such-Path: ").Write(mPath).Write(L"\r");
this->mErrorCode = kNotSupported;
- fb_render_string("BootZ: PLEASE RECOVER YOUR NEKERNEL INSTALL.", 40, 10, RGB(0xFF, 0xFF, 0xFF));
+ cg_render_string("BootZ: PLEASE RECOVER YOUR NEKERNEL INSTALL.", 40, 10, RGB(0xFF, 0xFF, 0xFF));
mRootFs->Close(mRootFs);
diff --git a/dev/boot/src/HEL/AMD64/BootEFI.cc b/dev/boot/src/HEL/AMD64/BootEFI.cc
index 5bcdff5a..1cefa70c 100644
--- a/dev/boot/src/HEL/AMD64/BootEFI.cc
+++ b/dev/boot/src/HEL/AMD64/BootEFI.cc
@@ -111,7 +111,7 @@ EFI_EXTERN_C EFI_API Int32 BootloaderMain(EfiHandlePtr image_handle, EfiSystemTa
kHandoverHeader = handover_hdr;
- FB::fb_clear_video();
+ FB::cg_clear_video();
UInt32 cnt_enabled = 0;
UInt32 cnt_disabled = 0;
diff --git a/dev/kernel/HALKit/AMD64/HalDebugOutput.cc b/dev/kernel/HALKit/AMD64/HalDebugOutput.cc
index 789c1067..aa3f284f 100644
--- a/dev/kernel/HALKit/AMD64/HalDebugOutput.cc
+++ b/dev/kernel/HALKit/AMD64/HalDebugOutput.cc
@@ -90,7 +90,7 @@ EXTERN_C void ke_utf_io_write(DeviceInterface<const Utf8Char*>* obj, const Utf8C
tmp_str[0] = (bytes[index] > 127) ? '?' : bytes[index];
tmp_str[1] = 0;
- fb_render_string(tmp_str, kY, kX, RGB(0xff, 0xff, 0xff));
+ cg_render_string(tmp_str, kY, kX, RGB(0xff, 0xff, 0xff));
if (bytes[index] == '\r') {
kY += kFontSizeY;
@@ -106,7 +106,7 @@ EXTERN_C void ke_utf_io_write(DeviceInterface<const Utf8Char*>* obj, const Utf8C
if (kY > kHandoverHeader->f_GOP.f_Height) {
kY = kFontSizeY;
- FBDrawInRegion(fb_get_clear_clr(), FB::FBAccessibilty::Height(), FB::FBAccessibilty::Width(),
+ FBDrawInRegion(cg_get_clear_clr(), FB::CGAccessibilty::Height(), FB::CGAccessibilty::Width(),
0, 0);
}
@@ -146,7 +146,7 @@ EXTERN_C void ke_io_write(DeviceInterface<const Char*>* obj, const Char* bytes)
tmp_str[0] = bytes[index];
tmp_str[1] = 0;
- fb_render_string(tmp_str, kY, kX, RGB(0xff, 0xff, 0xff));
+ cg_render_string(tmp_str, kY, kX, RGB(0xff, 0xff, 0xff));
if (bytes[index] == '\r') {
kY += kFontSizeY;
@@ -162,7 +162,7 @@ EXTERN_C void ke_io_write(DeviceInterface<const Char*>* obj, const Char* bytes)
if (kY > kHandoverHeader->f_GOP.f_Height) {
kY = kFontSizeY;
- FBDrawInRegion(fb_get_clear_clr(), FB::FBAccessibilty::Height(), FB::FBAccessibilty::Width(),
+ FBDrawInRegion(cg_get_clear_clr(), FB::CGAccessibilty::Height(), FB::CGAccessibilty::Width(),
0, 0);
}
diff --git a/dev/kernel/HALKit/AMD64/HalKernelMain.cc b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
index e67501cc..2339f56d 100644
--- a/dev/kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/AMD64/HalKernelMain.cc
@@ -118,7 +118,7 @@ EXTERN_C Int32 hal_init_platform(Kernel::HEL::BootInfoHeader* handover_hdr) {
kGDTArray[4].fFlags = 0;
kGDTArray[4].fBaseHigh = 0;
- FB::fb_clear_video();
+ FB::cg_clear_video();
// Load memory descriptors.
HAL::Register64 gdt_reg;
diff --git a/dev/kernel/HALKit/ARM64/HalKernelMain.cc b/dev/kernel/HALKit/ARM64/HalKernelMain.cc
index b711b833..ad516539 100644
--- a/dev/kernel/HALKit/ARM64/HalKernelMain.cc
+++ b/dev/kernel/HALKit/ARM64/HalKernelMain.cc
@@ -42,7 +42,7 @@ EXTERN_C void hal_init_platform(Kernel::HEL::BootInfoHeader* handover_hdr) {
handover_hdr->f_HardwareTables.f_ImageHandle);
#endif
- FB::fb_clear_video();
+ FB::cg_clear_video();
/************************************** */
/* INITIALIZE BIT MAP. */
diff --git a/dev/kernel/KernelKit/KernelTaskScheduler.h b/dev/kernel/KernelKit/KernelTaskScheduler.h
index 2029ae7b..659362fe 100644
--- a/dev/kernel/KernelKit/KernelTaskScheduler.h
+++ b/dev/kernel/KernelKit/KernelTaskScheduler.h
@@ -29,7 +29,7 @@ class KERNEL_TASK final {
UInt8* StackReserve{nullptr};
SizeT StackSize{kSchedMaxStackSz};
ProcessImage Image{};
- /// @brief a KID is a Kernel Identification Descriptor, it is used to find a task running within
+ /// @brief a KID is a Kernel ID, it is used to find a task running within
/// the kernel.
KID Kid{0};
};
diff --git a/dev/kernel/src/UserProcessScheduler.cc b/dev/kernel/src/UserProcessScheduler.cc
index ac25c3d8..02d5c1d6 100644
--- a/dev/kernel/src/UserProcessScheduler.cc
+++ b/dev/kernel/src/UserProcessScheduler.cc
@@ -678,11 +678,13 @@ UserProcessScheduler::operator bool() {
/// @brief this checks if no process is on the team.
////////////////////////////////////////////////////////////
Bool UserProcessScheduler::operator!() {
+ SInt64 cnt = 0UL;
+
for (auto process_index = 0UL; process_index < mTeam.AsArray().Count(); ++process_index) {
auto& process = mTeam.AsArray()[process_index];
- if (UserProcessHelper::CanBeScheduled(process)) return false;
+ if (UserProcessHelper::CanBeScheduled(process)) ++cnt;
}
- return true;
+ return cnt == 0L;
}
} // namespace Kernel
diff --git a/dev/modules/APM/APM.h b/dev/modules/APM/APM.h
index 29de5114..95c749e1 100644
--- a/dev/modules/APM/APM.h
+++ b/dev/modules/APM/APM.h
@@ -21,9 +21,9 @@ enum {
kAPMPowerCommandReboot = 0x08,
};
-/// @brief Send a APM command into it's own IO space.
+/// @brief Send a APM command into it's controller. (Shutdown, Reboot, Sleep...)
/// @param base_dma the IO base port.
/// @param cmd the command.
-/// @return status code.
+/// @return status code of the APM command.
EXTERN_C Int32 apm_send_io_command(UInt16 cmd);
} // namespace Kernel
diff --git a/dev/modules/CoreGfx/CoreAccess.h b/dev/modules/CoreGfx/CoreAccess.h
index f092b5a6..246b386a 100644
--- a/dev/modules/CoreGfx/CoreAccess.h
+++ b/dev/modules/CoreGfx/CoreAccess.h
@@ -17,12 +17,12 @@ namespace FB {
using namespace Kernel;
/// @brief common User interface class.
-class FBAccessibilty final {
- explicit FBAccessibilty() = default;
- ~FBAccessibilty() = default;
+class CGAccessibilty final {
+ explicit CGAccessibilty() = default;
+ ~CGAccessibilty() = default;
public:
- NE_COPY_DELETE(FBAccessibilty)
+ NE_COPY_DELETE(CGAccessibilty)
static UInt64 Width() noexcept { return kHandoverHeader->f_GOP.f_Width; }
diff --git a/dev/modules/CoreGfx/CoreGfx.h b/dev/modules/CoreGfx/CoreGfx.h
index d5cfa5a3..0ab3bcbc 100644
--- a/dev/modules/CoreGfx/CoreGfx.h
+++ b/dev/modules/CoreGfx/CoreGfx.h
@@ -8,13 +8,13 @@
#include <NeKit/Defines.h>
-#define fb_init() Kernel::UInt32 kCGCursor = 0
+#define cg_init() Kernel::UInt32 kCGCursor = 0
-#define fb_color(R, G, B) RGB(R, G, B)
+#define cg_color(R, G, B) RGB(R, G, B)
-#define fb_get_clear_clr() RGB(0, 0, 0x80)
+#define cg_get_clear_clr() RGB(0, 0, 0x80)
-#define fb_clear() kCGCursor = 0UL
+#define cg_clear() kCGCursor = 0UL
#ifdef __NE_AMD64__
/// @brief Performs Alpha drawing on the framebuffer.
@@ -57,7 +57,7 @@
for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) { \
*(((volatile Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
4 * kHandoverHeader->f_GOP.f_PixelPerLine * i + 4 * u))) = \
- fb_get_clear_clr(); \
+ cg_get_clear_clr(); \
} \
}
@@ -111,8 +111,8 @@
#endif // ifndef CORE_GFX_ACCESSIBILITY_H
namespace FB {
-inline Void fb_clear_video() noexcept {
- FBDrawInRegion(fb_get_clear_clr(), FB::FBAccessibilty::Height(), FB::FBAccessibilty::Width(), 0,
+inline Void cg_clear_video() noexcept {
+ FBDrawInRegion(cg_get_clear_clr(), FB::CGAccessibilty::Height(), FB::CGAccessibilty::Width(), 0,
0);
}
} // namespace FB \ No newline at end of file
diff --git a/dev/modules/CoreGfx/MathGfx.h b/dev/modules/CoreGfx/MathGfx.h
index 0b483fad..523f4b31 100644
--- a/dev/modules/CoreGfx/MathGfx.h
+++ b/dev/modules/CoreGfx/MathGfx.h
@@ -11,9 +11,9 @@
namespace UI {
#ifdef NE_CORE_GFX_USE_DOUBLE
-typedef double fb_real_t;
+typedef double cg_real_t;
#else
-typedef float fb_real_t;
+typedef float cg_real_t;
#endif
/// @brief Linear interpolation equation solver.
@@ -21,7 +21,7 @@ typedef float fb_real_t;
/// @param to to which value.
/// @param stat
/// @return Linear interop value.
-inline fb_real_t fb_math_lerp(fb_real_t to, fb_real_t from, fb_real_t stat) {
+inline cg_real_t cg_math_lerp(cg_real_t to, cg_real_t from, cg_real_t stat) {
return (from) + (to - from) * stat;
}
} // namespace UI \ No newline at end of file
diff --git a/dev/modules/CoreGfx/TextGfx.h b/dev/modules/CoreGfx/TextGfx.h
index 1bcc1397..359af6a8 100644
--- a/dev/modules/CoreGfx/TextGfx.h
+++ b/dev/modules/CoreGfx/TextGfx.h
@@ -145,7 +145,7 @@ inline const Kernel::UInt8 kFontBitmap[kFontNOFChars][kFontSizeX] = {
};
-inline Kernel::Void fb_render_string_for_bitmap(const Kernel::UInt8* bitmap,
+inline Kernel::Void cg_render_string_for_bitmap(const Kernel::UInt8* bitmap,
const Kernel::SizeT x_sz, const Kernel::SizeT y_sz,
Kernel::Int32& x_dst, Kernel::Int32& y_dst,
Kernel::Int32& color) {
@@ -167,7 +167,7 @@ inline Kernel::Void fb_render_string_for_bitmap(const Kernel::UInt8* bitmap,
}
}
-inline Kernel::Void fb_render_string(const Kernel::Char* text, Kernel::Int32 x_dst,
+inline Kernel::Void cg_render_string(const Kernel::Char* text, Kernel::Int32 x_dst,
Kernel::Int32 y_dst, Kernel::Int32 color) {
#ifndef __BOOTZ__
auto len = Kernel::rt_string_len(text);
@@ -176,7 +176,7 @@ inline Kernel::Void fb_render_string(const Kernel::Char* text, Kernel::Int32 x_d
#endif
for (Kernel::SizeT i = 0; i < len; ++i) {
- fb_render_string_for_bitmap(&kFontBitmap[(Kernel::UInt8) text[i]][0], kFontSizeX, kFontSizeY,
+ cg_render_string_for_bitmap(&kFontBitmap[(Kernel::UInt8) text[i]][0], kFontSizeX, kFontSizeY,
x_dst, y_dst, color);
y_dst += kFontSizeY;
}
diff --git a/dev/modules/HPET/.gitkeep b/dev/modules/HPET/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/dev/modules/HPET/.gitkeep
+++ /dev/null
diff --git a/docs/drawio/GUI_DESIGN.drawio b/docs/drawio/GUI_DESIGN.drawio
index 31fc11cf..bdf977af 100644
--- a/docs/drawio/GUI_DESIGN.drawio
+++ b/docs/drawio/GUI_DESIGN.drawio
@@ -1,16 +1,16 @@
<mxfile host="65bd71144e">
<diagram name="Page-1" id="yf45V2V4Ppj0j8o4dQoi">
- <mxGraphModel dx="1144" dy="442" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
+ <mxGraphModel dx="1149" dy="361" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
- <mxCell id="mspNsT0Gx7HsNPX6GqQO-2" value="libsci" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxCell id="mspNsT0Gx7HsNPX6GqQO-2" value="libSystem" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="50" y="500" width="450" height="140" as="geometry"/>
</mxCell>
<mxCell id="2" style="edgeStyle=none;html=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" parent="1" source="mspNsT0Gx7HsNPX6GqQO-3" target="mspNsT0Gx7HsNPX6GqQO-13" edge="1">
<mxGeometry relative="1" as="geometry"/>
</mxCell>
- <mxCell id="mspNsT0Gx7HsNPX6GqQO-3" value="LibGUI" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxCell id="mspNsT0Gx7HsNPX6GqQO-3" value="libGUI" style="rounded=1;whiteSpace=wrap;html=1;" parent="1" vertex="1">
<mxGeometry x="250" y="210" width="270" height="160" as="geometry"/>
</mxCell>
<mxCell id="mspNsT0Gx7HsNPX6GqQO-11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.093;entryY=1.019;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="mspNsT0Gx7HsNPX6GqQO-2" target="mspNsT0Gx7HsNPX6GqQO-3" edge="1">
diff --git a/tools/fsck.hefs.cc b/tools/chk.hefs.cc
index a2162a4f..121604f1 100644
--- a/tools/fsck.hefs.cc
+++ b/tools/chk.hefs.cc
@@ -14,16 +14,16 @@ static uint16_t kNumericalBase = 10;
int main(int argc, char** argv) {
if (argc < 2) {
- mkfs::console_out() << "fsck: hefs: usage: fsck.hefs -in=<input_device> -org=<origin>"
+ mkfs::console_out() << "fsck: hefs: usage: chk.hefs -in=<input_device> -b=<origin>"
<< "\n";
return EXIT_FAILURE;
}
auto args = mkfs::detail::build_args(argc, argv);
- auto opt_disk = mkfs::get_option<char>(args, "-in");
+ auto opt_disk = mkfs::get_option<char>(args, "in");
- auto origin = mkfs::get_option<char>(args, "-org");
+ auto origin = mkfs::get_option<char>(args, "b");
if (opt_disk.empty()) {
mkfs::console_out() << "fsck: hefs: error: OpenHeFS partition is empty! Exiting..."
@@ -68,7 +68,7 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
- mkfs::console_out() << "hefs: OpenHeFS partition is healthy, exiting...\n";
+ mkfs::console_out() << "hefs: OpenHeFS partition is healthy. Exiting...\n";
output_device.close();
diff --git a/tools/fsck.hefs.json b/tools/chk.hefs.json
index 970665aa..58918613 100644
--- a/tools/fsck.hefs.json
+++ b/tools/chk.hefs.json
@@ -5,9 +5,9 @@
"../"
],
"sources_path": [
- "fsck.hefs.cc"
+ "chk.hefs.cc"
],
- "output_name": "./dist/fsck.hefs",
+ "output_name": "./dist/chk.hefs",
"cpp_macros": [
"kFsckHeFSVersion=0x0100",
"kFsckHeFSVersionHighest=0x0100",
diff --git a/tools/libmkfs/mkfs.h b/tools/libmkfs/mkfs.h
index 6e242293..18ed571b 100644
--- a/tools/libmkfs/mkfs.h
+++ b/tools/libmkfs/mkfs.h
@@ -8,7 +8,6 @@
#include <tools/rang.h>
#include <iostream>
-#include <sstream>
#include <string>
#define kMkFsSectorSz (512U)
@@ -63,10 +62,10 @@ namespace detail {
template <typename CharType>
inline std::basic_string<CharType> get_option(const std::basic_string<CharType>& args,
const std::basic_string<CharType>& option) {
- size_t pos = args.find(option + CharType('='));
+ size_t pos = args.find(CharType('-') + option + CharType('='));
if (pos != std::string::npos) {
- size_t start = pos + option.length() + 1;
+ size_t start = pos + option.length() + 2;
size_t end = args.find(' ', start);
return args.substr(start, end - start);
}
diff --git a/tools/mkfs.hefs.cc b/tools/mkfs.hefs.cc
index d1139e10..77dd1658 100644
--- a/tools/mkfs.hefs.cc
+++ b/tools/mkfs.hefs.cc
@@ -12,12 +12,13 @@
#include <fstream>
#include <limits>
-static size_t kDiskSize = mkfs::detail::gib_cast(4UL);
static uint16_t kVersion = kHeFSVersion;
-static std::u8string kLabel;
-static size_t kSectorSize = 512;
static uint16_t kNumericalBase = 10;
+static size_t kDiskSize = mkfs::detail::gib_cast(4UL);
+static std::u8string kDiskLabel;
+static size_t kDiskSectorSz = 512;
+
int main(int argc, char** argv) {
if (argc < 2) {
mkfs::console_out()
@@ -30,13 +31,13 @@ int main(int argc, char** argv) {
std::string args = mkfs::detail::build_args(argc, argv);
- auto output_path = mkfs::get_option<char>(args, "-o");
+ auto output_path = mkfs::get_option<char>(args, "o");
if (output_path.empty()) {
mkfs::console_out() << "hefs: error: Missing -o <output_device> argument.\n";
return EXIT_FAILURE;
}
- auto opt_s = mkfs::get_option<char>(args, "-s");
+ auto opt_s = mkfs::get_option<char>(args, "s");
long parsed_s = 0;
if (!mkfs::detail::parse_signed(opt_s, parsed_s, kNumericalBase) || parsed_s == 0) {
mkfs::console_out() << "hefs: error: Invalid sector size \"" << opt_s
@@ -49,20 +50,20 @@ int main(int argc, char** argv) {
<< "\" is not a power of two.\n";
return EXIT_FAILURE;
}
- kSectorSize = static_cast<size_t>(parsed_s);
+ kDiskSectorSz = static_cast<size_t>(parsed_s);
- auto opt_L = mkfs::get_option<char>(args, "-L");
+ auto opt_L = mkfs::get_option<char>(args, "L");
if (!opt_L.empty()) {
- kLabel.clear();
- for (char c : opt_L) kLabel.push_back(static_cast<char8_t>(c));
+ kDiskLabel.clear();
+ for (char c : opt_L) kDiskLabel.push_back(static_cast<char8_t>(c));
} else {
- kLabel.clear();
+ kDiskLabel.clear();
for (size_t i = 0; i < kHeFSPartNameLen && kHeFSDefaultVolumeName[i] != u'\0'; ++i) {
- kLabel.push_back(static_cast<char8_t>(kHeFSDefaultVolumeName[i]));
+ kDiskLabel.push_back(static_cast<char8_t>(kHeFSDefaultVolumeName[i]));
}
}
- auto opt_S = mkfs::get_option<char>(args, "-S");
+ auto opt_S = mkfs::get_option<char>(args, "S");
unsigned long long gb = 0;
if (!mkfs::detail::parse_decimal(opt_S, gb) || gb == 0ULL) {
mkfs::console_out() << "hefs: error: Invalid disk size \"" << opt_S
@@ -76,12 +77,12 @@ int main(int argc, char** argv) {
}
kDiskSize = static_cast<size_t>(gb * 1024ULL * 1024ULL * 1024ULL);
- auto opt_b = mkfs::get_option<char>(args, "-b");
- auto opt_e = mkfs::get_option<char>(args, "-e");
- auto opt_bs = mkfs::get_option<char>(args, "-bs");
- auto opt_be = mkfs::get_option<char>(args, "-be");
- auto opt_is = mkfs::get_option<char>(args, "-is");
- auto opt_ie = mkfs::get_option<char>(args, "-ie");
+ auto opt_b = mkfs::get_option<char>(args, "b");
+ auto opt_e = mkfs::get_option<char>(args, "e");
+ auto opt_bs = mkfs::get_option<char>(args, "bs");
+ auto opt_be = mkfs::get_option<char>(args, "be");
+ auto opt_is = mkfs::get_option<char>(args, "is");
+ auto opt_ie = mkfs::get_option<char>(args, "ie");
long start_ind = 0, end_ind = 0;
long start_block = 0, end_block = 0;
@@ -117,7 +118,7 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
- if (static_cast<size_t>(end_block) * kSectorSize > kDiskSize ||
+ if (static_cast<size_t>(end_block) * kDiskSectorSz > kDiskSize ||
static_cast<size_t>(end_ind) > kDiskSize || static_cast<size_t>(end_in) > kDiskSize) {
mkfs::console_out() << "hefs: error: One or more ranges exceed disk size.\n";
return EXIT_FAILURE;
@@ -137,8 +138,8 @@ int main(int argc, char** argv) {
boot_node.diskKind = mkfs::hefs::kHeFSHardDrive;
boot_node.encoding = mkfs::hefs::kHeFSEncodingFlagsUTF8;
boot_node.diskSize = kDiskSize;
- boot_node.sectorSize = kSectorSize;
- boot_node.sectorCount = kDiskSize / kSectorSize;
+ boot_node.sectorSize = kDiskSectorSz;
+ boot_node.sectorCount = kDiskSize / kDiskSectorSz;
boot_node.startIND = static_cast<size_t>(start_ind) + sizeof(mkfs::hefs::BootNode);
boot_node.endIND = static_cast<size_t>(end_ind);
boot_node.startIN = static_cast<size_t>(start_in);
@@ -161,10 +162,10 @@ int main(int argc, char** argv) {
std::memset(boot_node.volumeName, 0, sizeof(boot_node.volumeName));
- size_t label_units = std::min(kLabel.size(), vol_slots - 1);
+ size_t label_units = std::min(kDiskLabel.size(), vol_slots - 1);
for (size_t i = 0; i < label_units; ++i) {
- boot_node.volumeName[i] = static_cast<char8_t>(kLabel[i]);
+ boot_node.volumeName[i] = static_cast<char8_t>(kDiskLabel[i]);
}
boot_node.volumeName[label_units] = 0U;