diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-04-03 13:18:42 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-04-03 13:18:42 +0200 |
commit | 58c4d41c5fd18549e4cd799d0094cedbd2c30ea3 (patch) | |
tree | 04481e9a33372b890f5c3681ef9be311f31ffc15 /Kernel | |
parent | a095a90b51190386b93828153e2a533725cc2ab7 (diff) | |
download | serenity-58c4d41c5fd18549e4cd799d0094cedbd2c30ea3.zip |
Kernel: Remove Limits.h
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Devices/Device.h | 1 | ||||
-rw-r--r-- | Kernel/Devices/FullDevice.cpp | 3 | ||||
-rw-r--r-- | Kernel/Devices/NullDevice.cpp | 3 | ||||
-rw-r--r-- | Kernel/Devices/RandomDevice.cpp | 5 | ||||
-rw-r--r-- | Kernel/Devices/ZeroDevice.cpp | 5 | ||||
-rw-r--r-- | Kernel/FileDescriptor.cpp | 2 | ||||
-rw-r--r-- | Kernel/FileSystem/FileSystem.h | 1 | ||||
-rw-r--r-- | Kernel/FileSystem/VirtualFileSystem.h | 1 | ||||
-rw-r--r-- | Kernel/Limits.h | 9 | ||||
-rw-r--r-- | Kernel/UnixTypes.h | 3 |
10 files changed, 9 insertions, 24 deletions
diff --git a/Kernel/Devices/Device.h b/Kernel/Devices/Device.h index 27e31bad8d..2e1c291d1f 100644 --- a/Kernel/Devices/Device.h +++ b/Kernel/Devices/Device.h @@ -2,7 +2,6 @@ #include <AK/Retainable.h> #include <AK/Types.h> -#include "Limits.h" #include "FileDescriptor.h" class Process; diff --git a/Kernel/Devices/FullDevice.cpp b/Kernel/Devices/FullDevice.cpp index 6d7acfadc7..2b9ad32b4a 100644 --- a/Kernel/Devices/FullDevice.cpp +++ b/Kernel/Devices/FullDevice.cpp @@ -1,5 +1,4 @@ #include "FullDevice.h" -#include "Limits.h" #include <LibC/errno_numbers.h> #include <AK/StdLibExtras.h> #include <AK/kstdio.h> @@ -20,7 +19,7 @@ bool FullDevice::can_read(Process&) const ssize_t FullDevice::read(Process&, byte* buffer, ssize_t size) { - ssize_t count = min(GoodBufferSize, size); + ssize_t count = min(PAGE_SIZE, size); memset(buffer, 0, (size_t)count); return count; } diff --git a/Kernel/Devices/NullDevice.cpp b/Kernel/Devices/NullDevice.cpp index cfb73450e1..eae5a2e037 100644 --- a/Kernel/Devices/NullDevice.cpp +++ b/Kernel/Devices/NullDevice.cpp @@ -1,5 +1,4 @@ #include "NullDevice.h" -#include "Limits.h" #include <AK/StdLibExtras.h> #include <AK/kstdio.h> @@ -33,6 +32,6 @@ ssize_t NullDevice::read(Process&, byte*, ssize_t) ssize_t NullDevice::write(Process&, const byte*, ssize_t buffer_size) { - return min(GoodBufferSize, buffer_size); + return min(PAGE_SIZE, buffer_size); } diff --git a/Kernel/Devices/RandomDevice.cpp b/Kernel/Devices/RandomDevice.cpp index 7f4face5cb..b09a0b63c5 100644 --- a/Kernel/Devices/RandomDevice.cpp +++ b/Kernel/Devices/RandomDevice.cpp @@ -1,5 +1,4 @@ #include "RandomDevice.h" -#include "Limits.h" #include <AK/StdLibExtras.h> RandomDevice::RandomDevice() @@ -42,7 +41,7 @@ bool RandomDevice::can_read(Process&) const ssize_t RandomDevice::read(Process&, byte* buffer, ssize_t size) { const int range = 'z' - 'a'; - ssize_t nread = min(size, GoodBufferSize); + ssize_t nread = min(size, PAGE_SIZE); for (ssize_t i = 0; i < nread; ++i) { dword r = random_value() % range; buffer[i] = (byte)('a' + r); @@ -53,6 +52,6 @@ ssize_t RandomDevice::read(Process&, byte* buffer, ssize_t size) ssize_t RandomDevice::write(Process&, const byte*, ssize_t size) { // FIXME: Use input for entropy? I guess that could be a neat feature? - return min(GoodBufferSize, size); + return min(PAGE_SIZE, size); } diff --git a/Kernel/Devices/ZeroDevice.cpp b/Kernel/Devices/ZeroDevice.cpp index 3527e85b55..be9ef67529 100644 --- a/Kernel/Devices/ZeroDevice.cpp +++ b/Kernel/Devices/ZeroDevice.cpp @@ -1,5 +1,4 @@ #include "ZeroDevice.h" -#include "Limits.h" #include <AK/StdLibExtras.h> #include <AK/kstdio.h> @@ -19,13 +18,13 @@ bool ZeroDevice::can_read(Process&) const ssize_t ZeroDevice::read(Process&, byte* buffer, ssize_t size) { - ssize_t count = min(GoodBufferSize, size); + ssize_t count = min(PAGE_SIZE, size); memset(buffer, 0, (size_t)count); return count; } ssize_t ZeroDevice::write(Process&, const byte*, ssize_t size) { - return min(GoodBufferSize, size); + return min(PAGE_SIZE, size); } diff --git a/Kernel/FileDescriptor.cpp b/Kernel/FileDescriptor.cpp index 940978abe9..78e23f2602 100644 --- a/Kernel/FileDescriptor.cpp +++ b/Kernel/FileDescriptor.cpp @@ -112,7 +112,7 @@ bool addition_would_overflow(off_t a, off_t b) { ASSERT(a > 0); uint64_t ua = a; - return (ua + b) > maxFileOffset; + return (ua + b) > OFF_T_MAX; } KResult FileDescriptor::fstat(stat& buffer) diff --git a/Kernel/FileSystem/FileSystem.h b/Kernel/FileSystem/FileSystem.h index 7a33c17d2c..833f09d440 100644 --- a/Kernel/FileSystem/FileSystem.h +++ b/Kernel/FileSystem/FileSystem.h @@ -3,7 +3,6 @@ #include <Kernel/Devices/DiskDevice.h> #include "InodeIdentifier.h" #include "InodeMetadata.h" -#include "Limits.h" #include "UnixTypes.h" #include <AK/ByteBuffer.h> #include <AK/HashMap.h> diff --git a/Kernel/FileSystem/VirtualFileSystem.h b/Kernel/FileSystem/VirtualFileSystem.h index 6baee90cd0..cbedd4c6b7 100644 --- a/Kernel/FileSystem/VirtualFileSystem.h +++ b/Kernel/FileSystem/VirtualFileSystem.h @@ -8,7 +8,6 @@ #include <AK/Function.h> #include "InodeIdentifier.h" #include "InodeMetadata.h" -#include "Limits.h" #include "FileSystem.h" #include <Kernel/KResult.h> diff --git a/Kernel/Limits.h b/Kernel/Limits.h deleted file mode 100644 index 87abe0389b..0000000000 --- a/Kernel/Limits.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -#include "UnixTypes.h" - -inline static const off_t maxFileOffset = 2147483647; - -static const ssize_t GoodBufferSize = 4096; - - diff --git a/Kernel/UnixTypes.h b/Kernel/UnixTypes.h index 57d390656f..c3e9e6f89b 100644 --- a/Kernel/UnixTypes.h +++ b/Kernel/UnixTypes.h @@ -255,7 +255,8 @@ struct sigaction { #define SIG_UNBLOCK 1 #define SIG_SETMASK 2 -// FIXME: Support 64-bit offsets! +#define OFF_T_MAX 2147483647 + typedef signed_dword off_t; typedef dword time_t; |