mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
kernel: remove some unescessary inits
This commit is contained in:
@@ -92,18 +92,14 @@ void kernel_entry() {
|
||||
tty_init();
|
||||
pty_init();
|
||||
|
||||
netdev_init();
|
||||
loopback_init();
|
||||
arp_init();
|
||||
ipv4_init();
|
||||
udp_init();
|
||||
tcp_init();
|
||||
|
||||
block_init();
|
||||
pseudodevices_init();
|
||||
arch_e9_initdev();
|
||||
keyboard_init();
|
||||
mouse_init();
|
||||
arch_ps2_init();
|
||||
fb_init();
|
||||
nvme_init();
|
||||
|
||||
@@ -52,9 +52,11 @@ typedef struct {
|
||||
#define MBR_TYPE_FREE 0
|
||||
#define MBR_TYPE_GPT 0xee
|
||||
|
||||
static mutex_t tablemutex;
|
||||
static int currentid = 1;
|
||||
static hashtable_t blocktable;
|
||||
|
||||
static MUTEX_DEFINE(tablemutex);
|
||||
HASHTABLE_DEFINE_STATIC(blocktable, 10);
|
||||
|
||||
|
||||
static blockdesc_t *getdesc(int id) {
|
||||
void *ret;
|
||||
@@ -307,8 +309,3 @@ void block_register(blockdesc_t *desc, char *name) {
|
||||
|
||||
__assert(registerdesc(permdesc, name) == 0);
|
||||
}
|
||||
|
||||
void block_init() {
|
||||
hashtable_init(&blocktable, 100);
|
||||
MUTEX_INIT(&tablemutex);
|
||||
}
|
||||
|
||||
@@ -44,8 +44,8 @@ void mouse_packet(mouse_t *mouse, mousepacket_t *packet) {
|
||||
interrupt_loweripl(oldipl);
|
||||
}
|
||||
|
||||
static hashtable_t mousetable;
|
||||
static mutex_t tablelock;
|
||||
HASHTABLE_DEFINE_STATIC(mousetable, 10);
|
||||
static MUTEX_DEFINE(tablelock);
|
||||
|
||||
static mouse_t* getmouse(int mouse) {
|
||||
void *mousep = NULL;
|
||||
@@ -181,9 +181,3 @@ mouse_t *mouse_new() {
|
||||
++currentnum;
|
||||
return mouse;
|
||||
}
|
||||
|
||||
void mouse_init() {
|
||||
MUTEX_INIT(&tablelock);
|
||||
__assert(hashtable_init(&mousetable, 20) == 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
#include <string.h>
|
||||
#include <logging.h>
|
||||
|
||||
static hashtable_t nametable;
|
||||
static mutex_t tablelock;
|
||||
HASHTABLE_DEFINE_STATIC(nametable, 10);
|
||||
static MUTEX_DEFINE(tablelock);
|
||||
|
||||
static devops_t devops = {0};
|
||||
|
||||
@@ -37,8 +37,3 @@ netdev_t *netdev_getdev(char *name) {
|
||||
MUTEX_RELEASE(&tablelock);
|
||||
return netdev;
|
||||
}
|
||||
|
||||
void netdev_init() {
|
||||
__assert(hashtable_init(&nametable, 10) == 0);
|
||||
MUTEX_INIT(&tablelock);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ typedef struct {
|
||||
#define ALLOC_RANGE_START 50000
|
||||
#define ALLOC_RANGE_END 60000
|
||||
static socket_t *ports[65536];
|
||||
static spinlock_t portlock;
|
||||
static SPINLOCK_DEFINE(portlock);
|
||||
|
||||
int udp_sendpacket(iovec_iterator_t *iovec_iterator, size_t size, uint32_t ip, uint16_t srcport, uint16_t dstport, netdev_t *broadcastnetdev) {
|
||||
void *newbuff = alloc(size + sizeof(udpframe_t));
|
||||
@@ -56,10 +56,6 @@ int udp_sendpacket(iovec_iterator_t *iovec_iterator, size_t size, uint32_t ip, u
|
||||
return error;
|
||||
}
|
||||
|
||||
void udp_init() {
|
||||
SPINLOCK_INIT(portlock);
|
||||
}
|
||||
|
||||
int udp_allocport(socket_t *socket, uint16_t *port) {
|
||||
bool intstate = interrupt_set(false);
|
||||
spinlock_acquire(&portlock);
|
||||
|
||||
Reference in New Issue
Block a user