1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:04:59 +00:00

LibC+Kernel: Move device-files related methods to a LibC header file

The Kernel/API directory in general shouldn't include userspace code,
but structure definitions that both are shared between the Kernel and
userspace.

LibC is the most appropriate place for these methods as they're already
included in the sys/sysmacros.h file to create a set of convenient
macros for these methods.
This commit is contained in:
Liav A 2023-09-08 21:50:05 +03:00 committed by Andrew Kaster
parent 139c575cc9
commit 8fe74c7d57
2 changed files with 1 additions and 1 deletions

View file

@ -1,30 +0,0 @@
/*
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Platform.h>
#include <sys/cdefs.h>
#include <sys/types.h>
__BEGIN_DECLS
static ALWAYS_INLINE dev_t serenity_dev_makedev(unsigned major, unsigned minor)
{
return (minor & 0xffu) | (major << 8u) | ((minor & ~0xffu) << 12u);
}
static ALWAYS_INLINE unsigned int serenity_dev_major(dev_t dev)
{
return (dev & 0xfff00u) >> 8u;
}
static ALWAYS_INLINE unsigned int serenity_dev_minor(dev_t dev)
{
return (dev & 0xffu) | ((dev >> 12u) & 0xfff00u);
}
__END_DECLS