blob: 980c9d73905f6de83af2999e05ac29bf78c2acc2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/*
* 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
|