mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:47:34 +00:00
Everywhere: Remove string.h include from AK/Traits.h and resolve fallout
A lot of places were relying on AK/Traits.h to give it strnlen, memcmp, memcpy and other related declarations. In the quest to remove inclusion of LibC headers from Kernel files, deal with all the fallout of this included-everywhere header including less things.
This commit is contained in:
parent
0420736143
commit
7ab37ee22c
14 changed files with 35 additions and 18 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <Kernel/Bus/USB/USBConfiguration.h>
|
||||
#include <Kernel/Bus/USB/USBInterface.h>
|
||||
#include <Kernel/Bus/USB/USBRequest.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
|
||||
namespace Kernel::USB {
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <Kernel/Bus/USB/USBTransfer.h>
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
#include <Kernel/StdLib.h>
|
||||
|
||||
namespace Kernel::USB {
|
||||
|
||||
|
|
|
@ -992,11 +992,11 @@ ErrorOr<void> Ext2FSInode::update_timestamps(Optional<Time> atime, Optional<Time
|
|||
MutexLocker locker(m_inode_lock);
|
||||
if (fs().is_readonly())
|
||||
return EROFS;
|
||||
if (atime.value_or({}).to_timespec().tv_sec > INT32_MAX)
|
||||
if (atime.value_or({}).to_timespec().tv_sec > NumericLimits<i32>::max())
|
||||
return EINVAL;
|
||||
if (ctime.value_or({}).to_timespec().tv_sec > INT32_MAX)
|
||||
if (ctime.value_or({}).to_timespec().tv_sec > NumericLimits<i32>::max())
|
||||
return EINVAL;
|
||||
if (mtime.value_or({}).to_timespec().tv_sec > INT32_MAX)
|
||||
if (mtime.value_or({}).to_timespec().tv_sec > NumericLimits<i32>::max())
|
||||
return EINVAL;
|
||||
if (atime.has_value())
|
||||
m_raw_inode.i_atime = atime.value().to_timespec().tv_sec;
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <AK/Assertions.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <Kernel/Memory/MemoryManager.h>
|
||||
#include <Kernel/StdLib.h> // For memcpy. FIXME: Make memcpy less expensive to access a declaration of in the Kernel.
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ void const* memmem(void const* haystack, size_t, void const* needle, size_t);
|
|||
[[nodiscard]] inline u16 htons(u16 w) { return (w & 0xff) << 8 | ((w >> 8) & 0xff); }
|
||||
}
|
||||
|
||||
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]] inline ErrorOr<void> copy_from_user(T* dest, T const* src)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue