xref: /openbmc/linux/include/trace/misc/fs.h (revision 247c01ff)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Display helpers for generic filesystem items
4  *
5  * Author: Chuck Lever <chuck.lever@oracle.com>
6  *
7  * Copyright (c) 2020, Oracle and/or its affiliates.
8  */
9 
10 #include <linux/fs.h>
11 
12 #define show_fs_dirent_type(x) \
13 	__print_symbolic(x, \
14 		{ DT_UNKNOWN,		"UNKNOWN" }, \
15 		{ DT_FIFO,		"FIFO" }, \
16 		{ DT_CHR,		"CHR" }, \
17 		{ DT_DIR,		"DIR" }, \
18 		{ DT_BLK,		"BLK" }, \
19 		{ DT_REG,		"REG" }, \
20 		{ DT_LNK,		"LNK" }, \
21 		{ DT_SOCK,		"SOCK" }, \
22 		{ DT_WHT,		"WHT" })
23 
24 #define show_fs_fcntl_open_flags(x) \
25 	__print_flags(x, "|", \
26 		{ O_WRONLY,		"O_WRONLY" }, \
27 		{ O_RDWR,		"O_RDWR" }, \
28 		{ O_CREAT,		"O_CREAT" }, \
29 		{ O_EXCL,		"O_EXCL" }, \
30 		{ O_NOCTTY,		"O_NOCTTY" }, \
31 		{ O_TRUNC,		"O_TRUNC" }, \
32 		{ O_APPEND,		"O_APPEND" }, \
33 		{ O_NONBLOCK,		"O_NONBLOCK" }, \
34 		{ O_DSYNC,		"O_DSYNC" }, \
35 		{ O_DIRECT,		"O_DIRECT" }, \
36 		{ O_LARGEFILE,		"O_LARGEFILE" }, \
37 		{ O_DIRECTORY,		"O_DIRECTORY" }, \
38 		{ O_NOFOLLOW,		"O_NOFOLLOW" }, \
39 		{ O_NOATIME,		"O_NOATIME" }, \
40 		{ O_CLOEXEC,		"O_CLOEXEC" })
41 
42 #define __fmode_flag(x)	{ (__force unsigned long)FMODE_##x, #x }
43 #define show_fs_fmode_flags(x) \
44 	__print_flags(x, "|", \
45 		__fmode_flag(READ), \
46 		__fmode_flag(WRITE), \
47 		__fmode_flag(EXEC))
48 
49 #ifdef CONFIG_64BIT
50 #define show_fs_fcntl_cmd(x) \
51 	__print_symbolic(x, \
52 		{ F_DUPFD,		"DUPFD" }, \
53 		{ F_GETFD,		"GETFD" }, \
54 		{ F_SETFD,		"SETFD" }, \
55 		{ F_GETFL,		"GETFL" }, \
56 		{ F_SETFL,		"SETFL" }, \
57 		{ F_GETLK,		"GETLK" }, \
58 		{ F_SETLK,		"SETLK" }, \
59 		{ F_SETLKW,		"SETLKW" }, \
60 		{ F_SETOWN,		"SETOWN" }, \
61 		{ F_GETOWN,		"GETOWN" }, \
62 		{ F_SETSIG,		"SETSIG" }, \
63 		{ F_GETSIG,		"GETSIG" }, \
64 		{ F_SETOWN_EX,		"SETOWN_EX" }, \
65 		{ F_GETOWN_EX,		"GETOWN_EX" }, \
66 		{ F_GETOWNER_UIDS,	"GETOWNER_UIDS" }, \
67 		{ F_OFD_GETLK,		"OFD_GETLK" }, \
68 		{ F_OFD_SETLK,		"OFD_SETLK" }, \
69 		{ F_OFD_SETLKW,		"OFD_SETLKW" })
70 #else /* CONFIG_64BIT */
71 #define show_fs_fcntl_cmd(x) \
72 	__print_symbolic(x, \
73 		{ F_DUPFD,		"DUPFD" }, \
74 		{ F_GETFD,		"GETFD" }, \
75 		{ F_SETFD,		"SETFD" }, \
76 		{ F_GETFL,		"GETFL" }, \
77 		{ F_SETFL,		"SETFL" }, \
78 		{ F_GETLK,		"GETLK" }, \
79 		{ F_SETLK,		"SETLK" }, \
80 		{ F_SETLKW,		"SETLKW" }, \
81 		{ F_SETOWN,		"SETOWN" }, \
82 		{ F_GETOWN,		"GETOWN" }, \
83 		{ F_SETSIG,		"SETSIG" }, \
84 		{ F_GETSIG,		"GETSIG" }, \
85 		{ F_GETLK64,		"GETLK64" }, \
86 		{ F_SETLK64,		"SETLK64" }, \
87 		{ F_SETLKW64,		"SETLKW64" }, \
88 		{ F_SETOWN_EX,		"SETOWN_EX" }, \
89 		{ F_GETOWN_EX,		"GETOWN_EX" }, \
90 		{ F_GETOWNER_UIDS,	"GETOWNER_UIDS" }, \
91 		{ F_OFD_GETLK,		"OFD_GETLK" }, \
92 		{ F_OFD_SETLK,		"OFD_SETLK" }, \
93 		{ F_OFD_SETLKW,		"OFD_SETLKW" })
94 #endif /* CONFIG_64BIT */
95 
96 #define show_fs_fcntl_lock_type(x) \
97 	__print_symbolic(x, \
98 		{ F_RDLCK,		"RDLCK" }, \
99 		{ F_WRLCK,		"WRLCK" }, \
100 		{ F_UNLCK,		"UNLCK" })
101 
102 #define show_fs_lookup_flags(flags) \
103 	__print_flags(flags, "|", \
104 		{ LOOKUP_FOLLOW,	"FOLLOW" }, \
105 		{ LOOKUP_DIRECTORY,	"DIRECTORY" }, \
106 		{ LOOKUP_AUTOMOUNT,	"AUTOMOUNT" }, \
107 		{ LOOKUP_EMPTY,		"EMPTY" }, \
108 		{ LOOKUP_DOWN,		"DOWN" }, \
109 		{ LOOKUP_MOUNTPOINT,	"MOUNTPOINT" }, \
110 		{ LOOKUP_REVAL,		"REVAL" }, \
111 		{ LOOKUP_RCU,		"RCU" }, \
112 		{ LOOKUP_OPEN,		"OPEN" }, \
113 		{ LOOKUP_CREATE,	"CREATE" }, \
114 		{ LOOKUP_EXCL,		"EXCL" }, \
115 		{ LOOKUP_RENAME_TARGET,	"RENAME_TARGET" }, \
116 		{ LOOKUP_PARENT,	"PARENT" }, \
117 		{ LOOKUP_NO_SYMLINKS,	"NO_SYMLINKS" }, \
118 		{ LOOKUP_NO_MAGICLINKS,	"NO_MAGICLINKS" }, \
119 		{ LOOKUP_NO_XDEV,	"NO_XDEV" }, \
120 		{ LOOKUP_BENEATH,	"BENEATH" }, \
121 		{ LOOKUP_IN_ROOT,	"IN_ROOT" }, \
122 		{ LOOKUP_CACHED,	"CACHED" })
123