xref: /linux/tools/include/nolibc/sys/sysmacros.h (revision 015a99fa76650e7d6efa3e36f20c0f5b346fe9ce)
1 /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2 /*
3  * Sysmacro definitions for NOLIBC
4  * Copyright (C) 2017-2021 Willy Tarreau <w@1wt.eu>
5  */
6 
7 /* make sure to include all global symbols */
8 #include "../nolibc.h"
9 
10 #ifndef _NOLIBC_SYS_SYSMACROS_H
11 #define _NOLIBC_SYS_SYSMACROS_H
12 
13 #include "../std.h"
14 
15 /* WARNING, it only deals with the 4096 first majors and 256 first minors */
16 #define makedev(major, minor) ((dev_t)((((major) & 0xfff) << 8) | ((minor) & 0xff)))
17 #define major(dev) ((unsigned int)(((dev) >> 8) & 0xfff))
18 #define minor(dev) ((unsigned int)((dev) & 0xff))
19 
20 #endif /* _NOLIBC_SYS_SYSMACROS_H */
21