1/* Definitions of macros to access `dev_t' values.
2 Copyright (C) 1996-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
18
19#ifndef _SYS_SYSMACROS_H
20#define _SYS_SYSMACROS_H 1
21
22#include <features.h>
23#include <bits/types.h>
24#include <bits/sysmacros.h>
25
26#define __SYSMACROS_DECL_TEMPL(rtype, name, proto) \
27 extern rtype gnu_dev_##name proto __THROW __attribute_const__;
28
29#define __SYSMACROS_IMPL_TEMPL(rtype, name, proto) \
30 __extension__ __extern_inline __attribute_const__ rtype \
31 __NTH (gnu_dev_##name proto)
32
33__BEGIN_DECLS
34
35__SYSMACROS_DECLARE_MAJOR (__SYSMACROS_DECL_TEMPL)
36__SYSMACROS_DECLARE_MINOR (__SYSMACROS_DECL_TEMPL)
37__SYSMACROS_DECLARE_MAKEDEV (__SYSMACROS_DECL_TEMPL)
38
39#ifdef __USE_EXTERN_INLINES
40
41__SYSMACROS_DEFINE_MAJOR (__SYSMACROS_IMPL_TEMPL)
42__SYSMACROS_DEFINE_MINOR (__SYSMACROS_IMPL_TEMPL)
43__SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_IMPL_TEMPL)
44
45#endif
46
47__END_DECLS
48
49#ifndef __SYSMACROS_NEED_IMPLEMENTATION
50# undef __SYSMACROS_DECL_TEMPL
51# undef __SYSMACROS_IMPL_TEMPL
52# undef __SYSMACROS_DECLARE_MAJOR
53# undef __SYSMACROS_DECLARE_MINOR
54# undef __SYSMACROS_DECLARE_MAKEDEV
55# undef __SYSMACROS_DEFINE_MAJOR
56# undef __SYSMACROS_DEFINE_MINOR
57# undef __SYSMACROS_DEFINE_MAKEDEV
58#endif
59
60#define major(dev) gnu_dev_major (dev)
61#define minor(dev) gnu_dev_minor (dev)
62#define makedev(maj, min) gnu_dev_makedev (maj, min)
63
64#endif /* sys/sysmacros.h */
65