feat: rank drivers at compile time
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
#include <tasks/task.h>
|
||||
#include <tasks/locking.h>
|
||||
#include <attributes.h>
|
||||
#include <libc/sort.h>
|
||||
#include "blockdev.h"
|
||||
|
||||
#define MAX_BLOCK_DEVS 64
|
||||
@@ -80,21 +79,6 @@ void block_dev_scan() {
|
||||
}
|
||||
}
|
||||
|
||||
int block_dev_driver_comp(const void *a, const void *b) {
|
||||
int rank_a = ((struct block_dev_driver *) a)->rank;
|
||||
int rank_b = ((struct block_dev_driver *) b)->rank;
|
||||
if (rank_a > rank_b) {
|
||||
return 1;
|
||||
} else if (rank_a < rank_b) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void block_dev_pre_init() {
|
||||
qsort(DRIVER(0), NUM_DRIVERS, sizeof(struct block_dev_driver), block_dev_driver_comp);
|
||||
}
|
||||
|
||||
void noreturn block_dev_task(void *data) {
|
||||
while (true) {
|
||||
semaphore_wait(block_semaphore);
|
||||
|
||||
Reference in New Issue
Block a user