diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-31 14:30:39 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-03-31 14:30:39 +0200 |
| commit | 21b5569ce53892167fb44867b4319ad528602e1e (patch) | |
| tree | b63fdf4184b47f72bf0ff1160dafce9e53dc238c /Private/Source | |
| parent | 48ed22614592c30bd1dc1f98f3988d05454e6c3b (diff) | |
Kernel:FSKit: Worked on filesystem indexing and new fs_ calls.
- Document fs_newfs_write, fs_newfs_read.
- Add fs_index_file.
- Remove custom partition, EPM now says that it must be zeroed out.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/Source')
| -rw-r--r-- | Private/Source/IndexableProperty.cxx | 15 | ||||
| -rw-r--r-- | Private/Source/NewFS+IO.cxx | 34 |
2 files changed, 39 insertions, 10 deletions
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; } |
