summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-03 11:10:21 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-03 11:11:19 +0200
commit3e6f0c4ca9154ae7b921adb9c06c98b06780940b (patch)
tree47f5fa0aa34fe34d754cf9f8ac3bd91d7efde0a3 /Private/Source
parentef665258eb745f1da8767d9c42f1076de4000cd5 (diff)
NewFS: IMP: When formating add the root catalog as well as do not let
the user remove the root directory. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source')
-rw-r--r--Private/Source/FS/NewFS.cxx8
1 files changed, 6 insertions, 2 deletions
diff --git a/Private/Source/FS/NewFS.cxx b/Private/Source/FS/NewFS.cxx
index c9dc4bbf..c3384e70 100644
--- a/Private/Source/FS/NewFS.cxx
+++ b/Private/Source/FS/NewFS.cxx
@@ -445,6 +445,9 @@ bool NewFSParser::Format(_Input _Output DriveTrait* drive) {
kcout << "Free-Sectors: " << hex_number(partBlock->FreeSectors) << endl;
kcout << "Sector-Size: " << hex_number(partBlock->SectorSize) << endl;
+ /// write the root catalog.
+ this->CreateCatalog(kNewFSRoot, 0, kNewFSCatalogKindDir);
+
return true;
}
@@ -576,7 +579,7 @@ _Output NewCatalog* NewFSParser::FindCatalog(_Input const char* catalogName,
// zero character.
parentName[--indexReverseCopy] = 0;
- // mandatory / character.
+ // mandatory '/' character.
parentName[--indexReverseCopy] = 0;
while (parentName[indexReverseCopy] != NewFilesystemHelper::Separator()) {
@@ -666,7 +669,8 @@ Boolean NewFSParser::CloseCatalog(_Input _Output NewCatalog* catalog) {
/// @param catalog The catalog structure.
/// @return
Boolean NewFSParser::RemoveCatalog(_Input const Char* catalogName) {
- if (!catalogName) {
+ if (!catalogName ||
+ StringBuilder::Equals(catalogName, NewFilesystemHelper::Root())) {
DbgLastError() = kErrorInternal;
return false;
}