Use macro wrappers for device op prototypes
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m35s

This commit is contained in:
2026-03-15 14:27:54 +01:00
parent c784264dc8
commit cd5604da43
15 changed files with 95 additions and 160 deletions

View File

@@ -9,9 +9,7 @@
#include <status.h>
#include <sys/debug.h>
bool ramdrv_init (struct device* device, void* arg, struct proc* proc,
struct reschedule_ctx* rctx) {
(void)proc, (void)rctx;
DEFINE_DEVICE_INIT (ramdrv_init) {
struct ramdrv_init* init = arg;
struct ramdrv* ramdrv = malloc (sizeof (*ramdrv));
@@ -39,19 +37,14 @@ bool ramdrv_init (struct device* device, void* arg, struct proc* proc,
return true;
}
void ramdrv_fini (struct device* device, struct proc* proc, struct reschedule_ctx* rctx) {
(void)proc, (void)rctx;
DEFINE_DEVICE_FINI (ramdrv_fini) {
struct ramdrv* ramdrv = device->udata;
free (ramdrv->buffer);
free (ramdrv);
}
int ramdrv_get_device_type (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
uint64_t* lockflags, void* a1, void* a2, void* a3, void* a4) {
(void)proc, (void)rctx, (void)device, (void)a2, (void)a3, (void)a4;
DEFINE_DEVICE_OP (ramdrv_get_device_type) {
if (a1 == NULL)
return -ST_BAD_ADDRESS_SPACE;
@@ -62,10 +55,7 @@ int ramdrv_get_device_type (struct device* device, struct proc* proc, struct res
return ST_OK;
}
int ramdrv_get_size (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
uint64_t* lockflags, void* a1, void* a2, void* a3, void* a4) {
(void)proc, (void)rctx, (void)a2, (void)a3, (void)a4;
DEFINE_DEVICE_OP (ramdrv_get_size) {
if (a1 == NULL)
return -ST_BAD_ADDRESS_SPACE;
@@ -78,10 +68,7 @@ int ramdrv_get_size (struct device* device, struct proc* proc, struct reschedule
return ST_OK;
}
int ramdrv_get_sector_size (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
uint64_t* lockflags, void* a1, void* a2, void* a3, void* a4) {
(void)proc, (void)rctx, (void)a2, (void)a3, (void)a4;
DEFINE_DEVICE_OP (ramdrv_get_sector_size) {
if (a1 == NULL)
return -ST_BAD_ADDRESS_SPACE;
@@ -94,10 +81,7 @@ int ramdrv_get_sector_size (struct device* device, struct proc* proc, struct res
return ST_OK;
}
int ramdrv_read (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
uint64_t* lockflags, void* a1, void* a2, void* a3, void* a4) {
(void)proc, (void)rctx, (void)a4;
DEFINE_DEVICE_OP (ramdrv_read) {
if (a1 == NULL || a2 == NULL || a3 == NULL)
return -ST_BAD_ADDRESS_SPACE;
@@ -114,10 +98,7 @@ int ramdrv_read (struct device* device, struct proc* proc, struct reschedule_ctx
return ST_OK;
}
int ramdrv_write (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
uint64_t* lockflags, void* a1, void* a2, void* a3, void* a4) {
(void)proc, (void)rctx, (void)a4;
DEFINE_DEVICE_OP (ramdrv_write) {
if (a1 == NULL || a2 == NULL || a3 == NULL)
return -ST_BAD_ADDRESS_SPACE;