1 /*
2 * Device number printing routine.
3 *
4 * Copyright (c) 2016-2021 The strace developers.
5 * All rights reserved.
6 *
7 * SPDX-License-Identifier: LGPL-2.1-or-later
8 */
9
10 #include "defs.h"
11 #include <sys/sysmacros.h>
12
13 void
14 print_dev_t(const unsigned long long dev)
15 {
16 if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV)
17 PRINT_VAL_X(dev);
18
19 if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)
20 return;
21
22 if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
23 tprint_comment_begin();
24
25 const unsigned int dev_major = major(dev);
26 const unsigned int dev_minor = minor(dev);
27
28 tprints_arg_begin("makedev");
29
30 PRINT_VAL_X(dev_major);
31 tprint_arg_next();
32
33 PRINT_VAL_X(dev_minor);
34 tprint_arg_end();
35
36 if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
37 tprint_comment_end();
38 }