summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-22 16:22:34 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-22 16:22:34 +0200
commit46a06c23e30668d90cb5efb44eab05bb4577d08d (patch)
tree44749101e59434822b7f7f8f7e51fd184206d3d5 /Kernel
parent17acc1e0a862ed03dd1613851d4f9caec5297a50 (diff)
downloadserenity-46a06c23e30668d90cb5efb44eab05bb4577d08d.zip
Kernel: Fix all compiler warnings.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/FileSystem/DiskBackedFileSystem.cpp3
-rw-r--r--Kernel/FileSystem/DiskBackedFileSystem.h2
-rw-r--r--Kernel/FileSystem/ProcFS.cpp2
-rw-r--r--Kernel/Net/IPv4Socket.cpp2
-rw-r--r--Kernel/Net/IPv4Socket.h2
-rw-r--r--Kernel/Net/TCPSocket.cpp3
-rw-r--r--Kernel/Net/TCPSocket.h2
-rw-r--r--Kernel/Net/UDPSocket.cpp3
-rw-r--r--Kernel/Net/UDPSocket.h2
-rw-r--r--Kernel/Process.cpp2
-rw-r--r--Kernel/VM/PhysicalRegion.cpp7
-rw-r--r--Kernel/VM/VMObject.cpp6
-rw-r--r--Kernel/VM/VMObject.h2
13 files changed, 19 insertions, 19 deletions
diff --git a/Kernel/FileSystem/DiskBackedFileSystem.cpp b/Kernel/FileSystem/DiskBackedFileSystem.cpp
index afb4a8cc5f..d8b66803a1 100644
--- a/Kernel/FileSystem/DiskBackedFileSystem.cpp
+++ b/Kernel/FileSystem/DiskBackedFileSystem.cpp
@@ -139,8 +139,9 @@ ByteBuffer DiskBackedFS::read_blocks(unsigned index, unsigned count) const
return blocks;
}
-void DiskBackedFS::set_block_size(unsigned block_size)
+void DiskBackedFS::set_block_size(int block_size)
{
+ ASSERT(block_size > 0);
if (block_size == m_block_size)
return;
m_block_size = block_size;
diff --git a/Kernel/FileSystem/DiskBackedFileSystem.h b/Kernel/FileSystem/DiskBackedFileSystem.h
index 8f75435e71..d1b01e74d8 100644
--- a/Kernel/FileSystem/DiskBackedFileSystem.h
+++ b/Kernel/FileSystem/DiskBackedFileSystem.h
@@ -17,7 +17,7 @@ public:
protected:
explicit DiskBackedFS(NonnullRefPtr<DiskDevice>&&);
- void set_block_size(unsigned);
+ void set_block_size(int);
ByteBuffer read_block(unsigned index) const;
ByteBuffer read_blocks(unsigned index, unsigned count) const;
diff --git a/Kernel/FileSystem/ProcFS.cpp b/Kernel/FileSystem/ProcFS.cpp
index fc712e9e99..b64fd70343 100644
--- a/Kernel/FileSystem/ProcFS.cpp
+++ b/Kernel/FileSystem/ProcFS.cpp
@@ -294,7 +294,7 @@ ByteBuffer procfs$pid_vmo(InodeIdentifier identifier)
region->vmo().name().characters(),
&region->vmo(),
region->vmo().ref_count());
- for (size_t i = 0; i < region->vmo().page_count(); ++i) {
+ for (int i = 0; i < region->vmo().page_count(); ++i) {
auto& physical_page = region->vmo().physical_pages()[i];
builder.appendf("P%x%s(%u) ",
physical_page ? physical_page->paddr().get() : 0,
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index 95ea2a4d19..1d2ec7a57e 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -246,7 +246,7 @@ ssize_t IPv4Socket::recvfrom(FileDescription& description, void* buffer, size_t
return ipv4_packet.payload_size();
}
- return protocol_receive(packet.data, buffer, buffer_length, flags, addr, addr_length);
+ return protocol_receive(packet.data, buffer, buffer_length, flags);
}
void IPv4Socket::did_receive(const IPv4Address& source_address, word source_port, ByteBuffer&& packet)
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h
index e983bf8bc3..63f90fe346 100644
--- a/Kernel/Net/IPv4Socket.h
+++ b/Kernel/Net/IPv4Socket.h
@@ -50,7 +50,7 @@ protected:
int allocate_local_port_if_needed();
virtual KResult protocol_bind() { return KSuccess; }
- virtual int protocol_receive(const ByteBuffer&, void*, size_t, int, sockaddr*, socklen_t*) { return -ENOTIMPL; }
+ virtual int protocol_receive(const ByteBuffer&, void*, size_t, int) { return -ENOTIMPL; }
virtual int protocol_send(const void*, int) { return -ENOTIMPL; }
virtual KResult protocol_connect(FileDescription&, ShouldBlock) { return KSuccess; }
virtual int protocol_allocate_local_port() { return 0; }
diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp
index 595958dd02..f9d1c1281d 100644
--- a/Kernel/Net/TCPSocket.cpp
+++ b/Kernel/Net/TCPSocket.cpp
@@ -43,10 +43,9 @@ NonnullRefPtr<TCPSocket> TCPSocket::create(int protocol)
return adopt(*new TCPSocket(protocol));
}
-int TCPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, size_t buffer_size, int flags, sockaddr* addr, socklen_t* addr_length)
+int TCPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, size_t buffer_size, int flags)
{
(void)flags;
- (void)addr_length;
ASSERT(!packet_buffer.is_null());
auto& ipv4_packet = *(const IPv4Packet*)(packet_buffer.pointer());
auto& tcp_packet = *static_cast<const TCPPacket*>(ipv4_packet.payload());
diff --git a/Kernel/Net/TCPSocket.h b/Kernel/Net/TCPSocket.h
index 905089abba..4c71a9be8d 100644
--- a/Kernel/Net/TCPSocket.h
+++ b/Kernel/Net/TCPSocket.h
@@ -33,7 +33,7 @@ private:
static NetworkOrdered<word> compute_tcp_checksum(const IPv4Address& source, const IPv4Address& destination, const TCPPacket&, word payload_size);
- virtual int protocol_receive(const ByteBuffer&, void* buffer, size_t buffer_size, int flags, sockaddr* addr, socklen_t* addr_length) override;
+ virtual int protocol_receive(const ByteBuffer&, void* buffer, size_t buffer_size, int flags) override;
virtual int protocol_send(const void*, int) override;
virtual KResult protocol_connect(FileDescription&, ShouldBlock) override;
virtual int protocol_allocate_local_port() override;
diff --git a/Kernel/Net/UDPSocket.cpp b/Kernel/Net/UDPSocket.cpp
index 0d1b815d37..c36f09c4bf 100644
--- a/Kernel/Net/UDPSocket.cpp
+++ b/Kernel/Net/UDPSocket.cpp
@@ -43,10 +43,9 @@ NonnullRefPtr<UDPSocket> UDPSocket::create(int protocol)
return adopt(*new UDPSocket(protocol));
}
-int UDPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, size_t buffer_size, int flags, sockaddr* addr, socklen_t* addr_length)
+int UDPSocket::protocol_receive(const ByteBuffer& packet_buffer, void* buffer, size_t buffer_size, int flags)
{
(void)flags;
- (void)addr_length;
ASSERT(!packet_buffer.is_null());
auto& ipv4_packet = *(const IPv4Packet*)(packet_buffer.pointer());
auto& udp_packet = *static_cast<const UDPPacket*>(ipv4_packet.payload());
diff --git a/Kernel/Net/UDPSocket.h b/Kernel/Net/UDPSocket.h
index 3cd147d7e5..fbfce367b2 100644
--- a/Kernel/Net/UDPSocket.h
+++ b/Kernel/Net/UDPSocket.h
@@ -16,7 +16,7 @@ private:
virtual const char* class_name() const override { return "UDPSocket"; }
static Lockable<HashMap<word, UDPSocket*>>& sockets_by_port();
- virtual int protocol_receive(const ByteBuffer&, void* buffer, size_t buffer_size, int flags, sockaddr* addr, socklen_t* addr_length) override;
+ virtual int protocol_receive(const ByteBuffer&, void* buffer, size_t buffer_size, int flags) override;
virtual int protocol_send(const void*, int) override;
virtual KResult protocol_connect(FileDescription&, ShouldBlock) override { return KSuccess; }
virtual int protocol_allocate_local_port() override;
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index aa18ee1131..00454a048f 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -2499,7 +2499,7 @@ int Process::sys$create_shared_buffer(pid_t peer_pid, int size, void** buffer)
int shared_buffer_id = ++s_next_shared_buffer_id;
auto shared_buffer = make<SharedBuffer>(m_pid, peer_pid, size);
shared_buffer->m_shared_buffer_id = shared_buffer_id;
- ASSERT(shared_buffer->size() >= size);
+ ASSERT((int)shared_buffer->size() >= size);
shared_buffer->m_pid1_region = allocate_region_with_vmo(VirtualAddress(), shared_buffer->size(), shared_buffer->m_vmo.copy_ref(), 0, "SharedBuffer", PROT_READ | PROT_WRITE);
shared_buffer->m_pid1_region->set_shared(true);
*buffer = shared_buffer->m_pid1_region->vaddr().as_ptr();
diff --git a/Kernel/VM/PhysicalRegion.cpp b/Kernel/VM/PhysicalRegion.cpp
index 1aa2b73caf..af0947cc57 100644
--- a/Kernel/VM/PhysicalRegion.cpp
+++ b/Kernel/VM/PhysicalRegion.cpp
@@ -78,10 +78,11 @@ void PhysicalRegion::return_page_at(PhysicalAddress addr)
int local_offset = addr.get() - m_lower.get();
ASSERT(local_offset >= 0);
- ASSERT(local_offset < m_pages * PAGE_SIZE);
+ ASSERT(local_offset < (int)(m_pages * PAGE_SIZE));
- auto page = local_offset / PAGE_SIZE;
- if (page < m_last) m_last = page;
+ auto page = (unsigned)local_offset / PAGE_SIZE;
+ if (page < m_last)
+ m_last = page;
m_bitmap.set(page, false);
m_used--;
diff --git a/Kernel/VM/VMObject.cpp b/Kernel/VM/VMObject.cpp
index 9bcd6875eb..0d7bfa65ff 100644
--- a/Kernel/VM/VMObject.cpp
+++ b/Kernel/VM/VMObject.cpp
@@ -98,16 +98,16 @@ void VMObject::inode_size_changed(Badge<Inode>, size_t old_size, size_t new_size
InterruptDisabler disabler;
- size_t old_page_count = page_count();
+ auto old_page_count = page_count();
m_size = new_size;
if (page_count() > old_page_count) {
// Add null pages and let the fault handler page these in when that day comes.
- for (size_t i = old_page_count; i < page_count(); ++i)
+ for (auto i = old_page_count; i < page_count(); ++i)
m_physical_pages.append(nullptr);
} else {
// Prune the no-longer valid pages. I'm not sure this is actually correct behavior.
- for (size_t i = page_count(); i < old_page_count; ++i)
+ for (auto i = page_count(); i < old_page_count; ++i)
m_physical_pages.take_last();
}
diff --git a/Kernel/VM/VMObject.h b/Kernel/VM/VMObject.h
index aff8e2af7c..c96179201c 100644
--- a/Kernel/VM/VMObject.h
+++ b/Kernel/VM/VMObject.h
@@ -33,7 +33,7 @@ public:
const String& name() const { return m_name; }
void set_name(const String& name) { m_name = name; }
- size_t page_count() const { return m_size / PAGE_SIZE; }
+ int page_count() const { return m_size / PAGE_SIZE; }
const Vector<RefPtr<PhysicalPage>>& physical_pages() const { return m_physical_pages; }
Vector<RefPtr<PhysicalPage>>& physical_pages() { return m_physical_pages; }