diff options
| -rw-r--r-- | Private/FSKit/IndexableProperty.hxx | 15 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootCustomPart.cxx | 40 | ||||
| -rw-r--r-- | Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx | 10 | ||||
| -rw-r--r-- | Private/Source/IndexableProperty.cxx | 15 | ||||
| -rw-r--r-- | Private/Source/NewFS+IO.cxx | 34 |
5 files changed, 55 insertions, 59 deletions
diff --git a/Private/FSKit/IndexableProperty.hxx b/Private/FSKit/IndexableProperty.hxx index ab034bc6..1a7925fe 100644 --- a/Private/FSKit/IndexableProperty.hxx +++ b/Private/FSKit/IndexableProperty.hxx @@ -10,14 +10,15 @@ #include <CompilerKit/CompilerKit.hxx> #include <KernelKit/DriveManager.hxx> +#define kIndexerNodeNameLength 256 +#define kIndexerClaimed 0xCF + namespace NewOS { namespace Indexer { struct IndexProperty final { public: Char Drive[kDriveNameLen]; - Char Path[256]; - Char From[256]; - Char To[256]; + Char Path[kIndexerNodeNameLength]; }; class IndexableProperty final : public Property { @@ -34,10 +35,18 @@ class IndexableProperty final : public Property { public: void AddFlag(Int16 flag); void RemoveFlag(Int16 flag); + Int16 HasFlag(Int16 flag); private: IndexProperty fIndex; UInt32 fFlags; }; + +/// @brief Index a file into the indexer instance. +/// @param filename path +/// @param filenameLen used bytes in path. +/// @param indexer the filesystem indexer. +/// @return none. +Void fs_index_file(const Char* filename, SizeT filenameLen, IndexableProperty& indexer); } // namespace Indexer } // namespace NewOS diff --git a/Private/NewBoot/Source/HEL/AMD64/BootCustomPart.cxx b/Private/NewBoot/Source/HEL/AMD64/BootCustomPart.cxx deleted file mode 100644 index d3022339..00000000 --- a/Private/NewBoot/Source/HEL/AMD64/BootCustomPart.cxx +++ /dev/null @@ -1,40 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#include <BootKit/BootKit.hxx> -#include <FSKit/NewFS.hxx> - -/// @brief Writes a NewOS partition on top of EPM -/// @param ataInterface The ATA interface. -/// @return -EXTERN_C Boolean boot_write_newos_partition(BootDeviceATA* ataInterface) { - if (!ataInterface) return No; - - ataInterface->Leak().mBase = 0; - ataInterface->Leak().mSize = kATASectorSize; - - Char newOSHeader[kATASectorSize] = { - /// signature of our system partition. - 'N', 'e', 'w', 'O', 'S', - /// version of our os partition - (Char)0x10, - /// to retrieve the header size add these two fileds. (divided into parts.) - /// header size (pt 1) - (Char)0x100, - /// header size (pt 2) - (Char)0x100, - /// Reserved - (Char)0x00, - /// Current LBA. - (Char)0x00, - /// First usable LBA. - (Char)kEPMStartPartitionBlk, - }; - - ataInterface->Write(newOSHeader, 1); - - return Yes; -}
\ No newline at end of file diff --git a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx index 244736c7..52c6a001 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootEPM.cxx @@ -16,11 +16,11 @@ STATIC const BlockGUID kEPMGuid = { 0x425d, {0xbe, 0x7b, 0x75, 0xa3, 0x7c, 0xc6, 0x79, 0xbc}}; -/// @brief External reference, write a NewOS Reserved Partition. -/// @param ataInterface ATA interface +/// @brief Write epm partition to disk. +/// @param namePart partition name +/// @param namePartLength length of name +/// @param ataInterface disk interface, here ATA. /// @return -EXTERN_C Boolean boot_write_newos_partition(BootDeviceATA* ataInterface); - EXTERN_C Boolean boot_write_epm_partition(const Char* namePart, SizeT namePartLength, BootDeviceATA* ataInterface) { if (namePartLength > kEPMNameLength || !namePart) return No; @@ -108,8 +108,6 @@ EXTERN_C Boolean boot_write_epm_partition(const Char* namePart, SizeT namePartLe ataInterface->Write(buf, 1); - boot_write_newos_partition(ataInterface); - return No; } } diff --git a/Private/Source/IndexableProperty.cxx b/Private/Source/IndexableProperty.cxx index eec5f485..8a2c1132 100644 --- a/Private/Source/IndexableProperty.cxx +++ b/Private/Source/IndexableProperty.cxx @@ -22,5 +22,20 @@ IndexProperty& IndexableProperty::LeakProperty() noexcept { return fIndex; } void IndexableProperty::AddFlag(Int16 flag) { fFlags |= flag; } void IndexableProperty::RemoveFlag(Int16 flag) { fFlags &= flag; } +Int16 IndexableProperty::HasFlag(Int16 flag) { return fFlags & flag; } + +/// @brief Index a file into the indexer instance. +/// @param filename path +/// @param filenameLen used bytes in path. +/// @param indexer the filesystem indexer. +/// @return none. +Void fs_index_file(const Char* filename, SizeT filenameLen, IndexableProperty& indexer) { + if (!indexer.HasFlag(kIndexerClaimed)) { + indexer.AddFlag(kIndexerClaimed); + rt_copy_memory((VoidPtr)indexer.LeakProperty().Path, (VoidPtr)filename, filenameLen); + + kcout << "NewKernel.exe: FSKit: index new file: " << filename << endl; + } +} } // namespace Indexer } // namespace NewOS diff --git a/Private/Source/NewFS+IO.cxx b/Private/Source/NewFS+IO.cxx index 502057e5..fb13362e 100644 --- a/Private/Source/NewFS+IO.cxx +++ b/Private/Source/NewFS+IO.cxx @@ -38,23 +38,30 @@ enum { kHCFSSubDriveCount, }; -Int32 ke_newfs_read(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex) { +/// @brief Read from newfs disk. +/// @param Mnt mounted interface. +/// @param DrvTrait drive info +/// @param DrvIndex drive index. +/// @return +Int32 fs_newfs_read(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex) { if (!Mnt) return -1; + DrvTrait.fPacket.fPacketGood = false; + switch (DrvIndex) { - case 0: { + case kHCFSSubDriveA: { NEWFS_READ(A, DrvTrait, Mnt); break; } - case 1: { + case kHCFSSubDriveB: { NEWFS_READ(B, DrvTrait, Mnt); break; } - case 2: { + case kHCFSSubDriveC: { NEWFS_READ(C, DrvTrait, Mnt); break; } - case 3: { + case kHCFSSubDriveD: { NEWFS_READ(D, DrvTrait, Mnt); break; } @@ -63,23 +70,30 @@ Int32 ke_newfs_read(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvInd return DrvTrait.fPacket.fPacketGood; } -Int32 ke_newfs_write(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex) { +/// @brief Write to newfs disk. +/// @param Mnt mounted interface. +/// @param DrvTrait drive info +/// @param DrvIndex drive index. +/// @return +Int32 fs_newfs_write(MountpointInterface* Mnt, DriveTrait& DrvTrait, Int32 DrvIndex) { if (!Mnt) return -1; + DrvTrait.fPacket.fPacketGood = false; + switch (DrvIndex) { - case 0: { + case kHCFSSubDriveA: { NEWFS_WRITE(A, DrvTrait, Mnt); break; } - case 1: { + case kHCFSSubDriveB: { NEWFS_WRITE(B, DrvTrait, Mnt); break; } - case 2: { + case kHCFSSubDriveC: { NEWFS_WRITE(C, DrvTrait, Mnt); break; } - case 3: { + case kHCFSSubDriveD: { NEWFS_WRITE(D, DrvTrait, Mnt); break; } |
