diff options
Diffstat (limited to 'fs/ceph/ceph_strings.c')
-rw-r--r-- | fs/ceph/ceph_strings.c | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/fs/ceph/ceph_strings.c b/fs/ceph/ceph_strings.c new file mode 100644 index 000000000000..8e4be6a80c62 --- /dev/null +++ b/fs/ceph/ceph_strings.c | |||
@@ -0,0 +1,176 @@ | |||
1 | /* | ||
2 | * Ceph string constants | ||
3 | */ | ||
4 | #include "types.h" | ||
5 | |||
6 | const char *ceph_entity_type_name(int type) | ||
7 | { | ||
8 | switch (type) { | ||
9 | case CEPH_ENTITY_TYPE_MDS: return "mds"; | ||
10 | case CEPH_ENTITY_TYPE_OSD: return "osd"; | ||
11 | case CEPH_ENTITY_TYPE_MON: return "mon"; | ||
12 | case CEPH_ENTITY_TYPE_CLIENT: return "client"; | ||
13 | case CEPH_ENTITY_TYPE_ADMIN: return "admin"; | ||
14 | case CEPH_ENTITY_TYPE_AUTH: return "auth"; | ||
15 | default: return "unknown"; | ||
16 | } | ||
17 | } | ||
18 | |||
19 | const char *ceph_osd_op_name(int op) | ||
20 | { | ||
21 | switch (op) { | ||
22 | case CEPH_OSD_OP_READ: return "read"; | ||
23 | case CEPH_OSD_OP_STAT: return "stat"; | ||
24 | |||
25 | case CEPH_OSD_OP_MASKTRUNC: return "masktrunc"; | ||
26 | |||
27 | case CEPH_OSD_OP_WRITE: return "write"; | ||
28 | case CEPH_OSD_OP_DELETE: return "delete"; | ||
29 | case CEPH_OSD_OP_TRUNCATE: return "truncate"; | ||
30 | case CEPH_OSD_OP_ZERO: return "zero"; | ||
31 | case CEPH_OSD_OP_WRITEFULL: return "writefull"; | ||
32 | |||
33 | case CEPH_OSD_OP_APPEND: return "append"; | ||
34 | case CEPH_OSD_OP_STARTSYNC: return "startsync"; | ||
35 | case CEPH_OSD_OP_SETTRUNC: return "settrunc"; | ||
36 | case CEPH_OSD_OP_TRIMTRUNC: return "trimtrunc"; | ||
37 | |||
38 | case CEPH_OSD_OP_TMAPUP: return "tmapup"; | ||
39 | case CEPH_OSD_OP_TMAPGET: return "tmapget"; | ||
40 | case CEPH_OSD_OP_TMAPPUT: return "tmapput"; | ||
41 | |||
42 | case CEPH_OSD_OP_GETXATTR: return "getxattr"; | ||
43 | case CEPH_OSD_OP_GETXATTRS: return "getxattrs"; | ||
44 | case CEPH_OSD_OP_SETXATTR: return "setxattr"; | ||
45 | case CEPH_OSD_OP_SETXATTRS: return "setxattrs"; | ||
46 | case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs"; | ||
47 | case CEPH_OSD_OP_RMXATTR: return "rmxattr"; | ||
48 | |||
49 | case CEPH_OSD_OP_PULL: return "pull"; | ||
50 | case CEPH_OSD_OP_PUSH: return "push"; | ||
51 | case CEPH_OSD_OP_BALANCEREADS: return "balance-reads"; | ||
52 | case CEPH_OSD_OP_UNBALANCEREADS: return "unbalance-reads"; | ||
53 | case CEPH_OSD_OP_SCRUB: return "scrub"; | ||
54 | |||
55 | case CEPH_OSD_OP_WRLOCK: return "wrlock"; | ||
56 | case CEPH_OSD_OP_WRUNLOCK: return "wrunlock"; | ||
57 | case CEPH_OSD_OP_RDLOCK: return "rdlock"; | ||
58 | case CEPH_OSD_OP_RDUNLOCK: return "rdunlock"; | ||
59 | case CEPH_OSD_OP_UPLOCK: return "uplock"; | ||
60 | case CEPH_OSD_OP_DNLOCK: return "dnlock"; | ||
61 | |||
62 | case CEPH_OSD_OP_CALL: return "call"; | ||
63 | |||
64 | case CEPH_OSD_OP_PGLS: return "pgls"; | ||
65 | } | ||
66 | return "???"; | ||
67 | } | ||
68 | |||
69 | const char *ceph_mds_state_name(int s) | ||
70 | { | ||
71 | switch (s) { | ||
72 | /* down and out */ | ||
73 | case CEPH_MDS_STATE_DNE: return "down:dne"; | ||
74 | case CEPH_MDS_STATE_STOPPED: return "down:stopped"; | ||
75 | /* up and out */ | ||
76 | case CEPH_MDS_STATE_BOOT: return "up:boot"; | ||
77 | case CEPH_MDS_STATE_STANDBY: return "up:standby"; | ||
78 | case CEPH_MDS_STATE_STANDBY_REPLAY: return "up:standby-replay"; | ||
79 | case CEPH_MDS_STATE_CREATING: return "up:creating"; | ||
80 | case CEPH_MDS_STATE_STARTING: return "up:starting"; | ||
81 | /* up and in */ | ||
82 | case CEPH_MDS_STATE_REPLAY: return "up:replay"; | ||
83 | case CEPH_MDS_STATE_RESOLVE: return "up:resolve"; | ||
84 | case CEPH_MDS_STATE_RECONNECT: return "up:reconnect"; | ||
85 | case CEPH_MDS_STATE_REJOIN: return "up:rejoin"; | ||
86 | case CEPH_MDS_STATE_CLIENTREPLAY: return "up:clientreplay"; | ||
87 | case CEPH_MDS_STATE_ACTIVE: return "up:active"; | ||
88 | case CEPH_MDS_STATE_STOPPING: return "up:stopping"; | ||
89 | } | ||
90 | return "???"; | ||
91 | } | ||
92 | |||
93 | const char *ceph_session_op_name(int op) | ||
94 | { | ||
95 | switch (op) { | ||
96 | case CEPH_SESSION_REQUEST_OPEN: return "request_open"; | ||
97 | case CEPH_SESSION_OPEN: return "open"; | ||
98 | case CEPH_SESSION_REQUEST_CLOSE: return "request_close"; | ||
99 | case CEPH_SESSION_CLOSE: return "close"; | ||
100 | case CEPH_SESSION_REQUEST_RENEWCAPS: return "request_renewcaps"; | ||
101 | case CEPH_SESSION_RENEWCAPS: return "renewcaps"; | ||
102 | case CEPH_SESSION_STALE: return "stale"; | ||
103 | case CEPH_SESSION_RECALL_STATE: return "recall_state"; | ||
104 | } | ||
105 | return "???"; | ||
106 | } | ||
107 | |||
108 | const char *ceph_mds_op_name(int op) | ||
109 | { | ||
110 | switch (op) { | ||
111 | case CEPH_MDS_OP_LOOKUP: return "lookup"; | ||
112 | case CEPH_MDS_OP_LOOKUPHASH: return "lookuphash"; | ||
113 | case CEPH_MDS_OP_LOOKUPPARENT: return "lookupparent"; | ||
114 | case CEPH_MDS_OP_GETATTR: return "getattr"; | ||
115 | case CEPH_MDS_OP_SETXATTR: return "setxattr"; | ||
116 | case CEPH_MDS_OP_SETATTR: return "setattr"; | ||
117 | case CEPH_MDS_OP_RMXATTR: return "rmxattr"; | ||
118 | case CEPH_MDS_OP_READDIR: return "readdir"; | ||
119 | case CEPH_MDS_OP_MKNOD: return "mknod"; | ||
120 | case CEPH_MDS_OP_LINK: return "link"; | ||
121 | case CEPH_MDS_OP_UNLINK: return "unlink"; | ||
122 | case CEPH_MDS_OP_RENAME: return "rename"; | ||
123 | case CEPH_MDS_OP_MKDIR: return "mkdir"; | ||
124 | case CEPH_MDS_OP_RMDIR: return "rmdir"; | ||
125 | case CEPH_MDS_OP_SYMLINK: return "symlink"; | ||
126 | case CEPH_MDS_OP_CREATE: return "create"; | ||
127 | case CEPH_MDS_OP_OPEN: return "open"; | ||
128 | case CEPH_MDS_OP_LOOKUPSNAP: return "lookupsnap"; | ||
129 | case CEPH_MDS_OP_LSSNAP: return "lssnap"; | ||
130 | case CEPH_MDS_OP_MKSNAP: return "mksnap"; | ||
131 | case CEPH_MDS_OP_RMSNAP: return "rmsnap"; | ||
132 | } | ||
133 | return "???"; | ||
134 | } | ||
135 | |||
136 | const char *ceph_cap_op_name(int op) | ||
137 | { | ||
138 | switch (op) { | ||
139 | case CEPH_CAP_OP_GRANT: return "grant"; | ||
140 | case CEPH_CAP_OP_REVOKE: return "revoke"; | ||
141 | case CEPH_CAP_OP_TRUNC: return "trunc"; | ||
142 | case CEPH_CAP_OP_EXPORT: return "export"; | ||
143 | case CEPH_CAP_OP_IMPORT: return "import"; | ||
144 | case CEPH_CAP_OP_UPDATE: return "update"; | ||
145 | case CEPH_CAP_OP_DROP: return "drop"; | ||
146 | case CEPH_CAP_OP_FLUSH: return "flush"; | ||
147 | case CEPH_CAP_OP_FLUSH_ACK: return "flush_ack"; | ||
148 | case CEPH_CAP_OP_FLUSHSNAP: return "flushsnap"; | ||
149 | case CEPH_CAP_OP_FLUSHSNAP_ACK: return "flushsnap_ack"; | ||
150 | case CEPH_CAP_OP_RELEASE: return "release"; | ||
151 | case CEPH_CAP_OP_RENEW: return "renew"; | ||
152 | } | ||
153 | return "???"; | ||
154 | } | ||
155 | |||
156 | const char *ceph_lease_op_name(int o) | ||
157 | { | ||
158 | switch (o) { | ||
159 | case CEPH_MDS_LEASE_REVOKE: return "revoke"; | ||
160 | case CEPH_MDS_LEASE_RELEASE: return "release"; | ||
161 | case CEPH_MDS_LEASE_RENEW: return "renew"; | ||
162 | case CEPH_MDS_LEASE_REVOKE_ACK: return "revoke_ack"; | ||
163 | } | ||
164 | return "???"; | ||
165 | } | ||
166 | |||
167 | const char *ceph_snap_op_name(int o) | ||
168 | { | ||
169 | switch (o) { | ||
170 | case CEPH_SNAP_OP_UPDATE: return "update"; | ||
171 | case CEPH_SNAP_OP_CREATE: return "create"; | ||
172 | case CEPH_SNAP_OP_DESTROY: return "destroy"; | ||
173 | case CEPH_SNAP_OP_SPLIT: return "split"; | ||
174 | } | ||
175 | return "???"; | ||
176 | } | ||