Refactor VFS shared operations and remove unused legacy storage wrappers
This commit is contained in:
1 parent
c28b9dd77f
commit
d318eca262
3 files changed
+150
-291
No files matched your search
@@ -14,7 +14,7 @@ The I/O model operates as follows:
|
|||||||
- `storage_read` / `storage_write` are convenience wrappers that build a stack-local `TIORequest` and call `submit_io_wait`.
|
- `storage_read` / `storage_write` are convenience wrappers that build a stack-local `TIORequest` and call `submit_io_wait`.
|
||||||
- `storage_read_async` / `storage_write_async` build and submit a request with a caller-supplied callback, returning immediately.
|
- `storage_read_async` / `storage_write_async` build and submit a request with a caller-supplied callback, returning immediately.
|
||||||
|
|
||||||
Legacy `storage_read_legacy` / `storage_write_legacy` procedure wrappers are retained for callers not yet migrated to the function-returning API.
|
Blocking callers use `storage_read` / `storage_write` and check the returned `TError`.
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
@@ -205,15 +205,6 @@ function storage_write_async(device : PStorage_Device; addr : uint32; sectors :
|
|||||||
|
|
||||||
Non-blocking write. Analogous to `storage_read_async`.
|
Non-blocking write. Analogous to `storage_read_async`.
|
||||||
|
|
||||||
### storage_read_legacy / storage_write_legacy
|
|
||||||
|
|
||||||
```pascal
|
|
||||||
procedure storage_read_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
|
|
||||||
procedure storage_write_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
|
|
||||||
```
|
|
||||||
|
|
||||||
Drop-in procedure replacements for callers using the old void-returning API. Forward to `storage_read` / `storage_write` and discard the error code. Marked for removal once all callers are migrated.
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- `dispatch_next` is an internal procedure called with interrupts disabled. It dequeues the head of the CFIFO, allocates a heap copy via `ioreq_copy` (for ISR safety), and invokes the appropriate `dispatchRead` or `dispatchWrite` on the device. If neither dispatch pointer is set, the request is failed with `eDeviceNotFound`.
|
- `dispatch_next` is an internal procedure called with interrupts disabled. It dequeues the head of the CFIFO, allocates a heap copy via `ioreq_copy` (for ISR safety), and invokes the appropriate `dispatchRead` or `dispatchWrite` on the device. If neither dispatch pointer is set, the request is failed with `eDeviceNotFound`.
|
||||||
|
|||||||
@@ -19,14 +19,14 @@
|
|||||||
and provides the submit_io / complete_io request-based I/O path.
|
and provides the submit_io / complete_io request-based I/O path.
|
||||||
Device drivers call register_device() when they discover a new device.
|
Device drivers call register_device() when they discover a new device.
|
||||||
|
|
||||||
Phase 2 I/O model:
|
Request-based I/O model:
|
||||||
- submit_io enqueues a TIORequest into the device's per-device CFIFO,
|
- submit_io enqueues a TIORequest into the device's per-device CFIFO,
|
||||||
dispatches to hardware, and sleeps the calling task (proc_await).
|
dispatches to hardware, and returns without waiting for completion.
|
||||||
- complete_io is called from ISR/completion context, wakes the caller.
|
- complete_io delivers callbacks from the driver's completion context.
|
||||||
- storage_read / storage_write are thin wrappers that build a stack-local
|
- storage_read / storage_write are thin wrappers that build a stack-local
|
||||||
TIORequest, call submit_io, and return the resulting TError.
|
TIORequest, call submit_io_wait, and return the resulting TError.
|
||||||
- Legacy sync/async callbacks are still supported as fallback for drivers
|
- Drivers must provide the TDriverDispatch interface; there is no legacy
|
||||||
not yet migrated to the TDriverDispatch interface.
|
callback fallback.
|
||||||
|
|
||||||
@author(Aaron Hance <[email protected]>)
|
@author(Aaron Hance <[email protected]>)
|
||||||
}
|
}
|
||||||
@@ -112,12 +112,6 @@ function storage_read_async(device : PStorage_Device; addr : uint32; sectors : u
|
|||||||
function storage_write_async(device : PStorage_Device; addr : uint32; sectors : uint32;
|
function storage_write_async(device : PStorage_Device; addr : uint32; sectors : uint32;
|
||||||
buffer : puint32; callback : TIOCallback; callbackData : pointer) : TError;
|
buffer : puint32; callback : TIOCallback; callbackData : pointer) : TError;
|
||||||
|
|
||||||
{ Legacy wrappers — procedure signatures matching the old API.
|
|
||||||
Forward to the new functions, silently discard errors.
|
|
||||||
TODO: migrate all callers and remove these. }
|
|
||||||
procedure storage_read_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
|
|
||||||
procedure storage_write_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@@ -744,17 +738,6 @@ begin
|
|||||||
storage_write_async := submit_io(@req);
|
storage_write_async := submit_io(@req);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Legacy procedure wrappers — drop-in replacements for old callers }
|
|
||||||
procedure storage_read_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
|
|
||||||
begin
|
|
||||||
storage_read(device, addr, sectors, buffer);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure storage_write_legacy(device : PStorage_Device; addr : uint32; sectors : uint32; buffer : puint32);
|
|
||||||
begin
|
|
||||||
storage_write(device, addr, sectors, buffer);
|
|
||||||
end;
|
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
boot.mgr.registerBoot('driver.storage.mgr', @init, 'Storage Manager', 'driver.storage.vfs');
|
boot.mgr.registerBoot('driver.storage.mgr', @init, 'Storage Manager', 'driver.storage.vfs');
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user