diff options
author | Marvin Borner | 2021-05-20 16:16:01 +0200 |
---|---|---|
committer | Marvin Borner | 2021-05-20 16:16:01 +0200 |
commit | 9da2af6699ca6e954bc3cb523dd74a9195a503d5 (patch) | |
tree | d2630dcc08bf05a211989a51f1b0c68f0b535a56 /kernel/features | |
parent | 3f928975d3f2925c6227e7389adf03c22df2d898 (diff) |
Coding style fixes
Diffstat (limited to 'kernel/features')
-rw-r--r-- | kernel/features/fs.c | 5 | ||||
-rw-r--r-- | kernel/features/io.c | 2 | ||||
-rw-r--r-- | kernel/features/mm.c | 3 | ||||
-rw-r--r-- | kernel/features/net.c | 4 |
4 files changed, 5 insertions, 9 deletions
diff --git a/kernel/features/fs.c b/kernel/features/fs.c index 923ab7c..dc8c071 100644 --- a/kernel/features/fs.c +++ b/kernel/features/fs.c @@ -318,8 +318,7 @@ static res ext2_read_inode(struct ext2_inode *in, void *buf, u32 offset, u32 cou u32 remaining = MIN(count, in->size - offset); u32 copied = 0; - u32 indirect = 0; - u32 blocknum = 0; + u32 indirect, blocknum; // TODO: Support triply indirect pointers for (u32 i = first_block; i <= last_block; i++) { @@ -412,8 +411,8 @@ static struct ext2_inode *ext2_find_inode_by_path(const char *path, struct ext2_ path_cp++; u32 current_inode = EXT2_ROOT; - u32 i = 0; while (1) { + u32 i; for (i = 0; path_cp[i] != '/' && path_cp[i] != '\0'; i++) ; diff --git a/kernel/features/io.c b/kernel/features/io.c index eb4b7a5..bc7977a 100644 --- a/kernel/features/io.c +++ b/kernel/features/io.c @@ -84,7 +84,6 @@ res io_poll(u32 *devs) struct io_dev *dev = io_get(io); if (!dev || !dev->read) { io_remove_group(group); - group--; return -ENOENT; } @@ -92,7 +91,6 @@ res io_poll(u32 *devs) res ready = dev->ready(); if (ready == EOK) { io_remove_group(group); - group--; return io; } else if (ready != -EAGAIN) { return ready; diff --git a/kernel/features/mm.c b/kernel/features/mm.c index eca1aae..0f80fda 100644 --- a/kernel/features/mm.c +++ b/kernel/features/mm.c @@ -730,9 +730,8 @@ void memory_user_hook(void) CLEAR void memory_install(void) { // Set all memory 'used' - for (u32 i = 0; i < 1024 * 1024 / 8; i++) { + for (u32 i = 0; i < sizeof(memory); i++) memory[i] = 0xff; - } // Free memory using mmap multiboot_mmap(); diff --git a/kernel/features/net.c b/kernel/features/net.c index 6c971cd..530837b 100644 --- a/kernel/features/net.c +++ b/kernel/features/net.c @@ -259,12 +259,12 @@ static void ip_send_packet(u32 dst, void *data, int len, u8 prot) if (data) memcpy(packet->data, data, (u32)len); - int arp_sent = 3; u8 zero_hardware_addr[] = { 0, 0, 0, 0, 0, 0 }; u8 dst_mac[6]; if (same_net(dst)) { scheduler_disable(); sti(); + int arp_sent = 3; while (!arp_lookup(dst_mac, dst)) { if (arp_sent) { arp_sent--; @@ -321,7 +321,7 @@ static void tcp_send_packet(struct socket *socket, u16 flags, void *data, int le packet->src_port = (u16)htons(socket->src_port); packet->dst_port = (u16)htons(socket->dst_port); packet->seq_number = htonl(socket->prot.tcp.seq_no); - packet->ack_number = flags & TCP_FLAG_ACK ? htonl(socket->prot.tcp.ack_no) : 0; + packet->ack_number = (flags & TCP_FLAG_ACK) ? htonl(socket->prot.tcp.ack_no) : 0; packet->flags = (u16)htons(0x5000 ^ (flags & 0xff)); packet->window_size = htons(U16_MAX); // TODO: Support TCP windows packet->urgent = 0; |