xref: /openbmc/linux/fs/ceph/strings.c (revision fbb6b31a)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Ceph fs string constants
4  */
5 #include <linux/module.h>
6 #include <linux/ceph/types.h>
7 
8 
9 const char *ceph_mds_state_name(int s)
10 {
11 	switch (s) {
12 		/* down and out */
13 	case CEPH_MDS_STATE_DNE:        return "down:dne";
14 	case CEPH_MDS_STATE_STOPPED:    return "down:stopped";
15 		/* up and out */
16 	case CEPH_MDS_STATE_BOOT:       return "up:boot";
17 	case CEPH_MDS_STATE_STANDBY:    return "up:standby";
18 	case CEPH_MDS_STATE_STANDBY_REPLAY:    return "up:standby-replay";
19 	case CEPH_MDS_STATE_REPLAYONCE: return "up:oneshot-replay";
20 	case CEPH_MDS_STATE_CREATING:   return "up:creating";
21 	case CEPH_MDS_STATE_STARTING:   return "up:starting";
22 		/* up and in */
23 	case CEPH_MDS_STATE_REPLAY:     return "up:replay";
24 	case CEPH_MDS_STATE_RESOLVE:    return "up:resolve";
25 	case CEPH_MDS_STATE_RECONNECT:  return "up:reconnect";
26 	case CEPH_MDS_STATE_REJOIN:     return "up:rejoin";
27 	case CEPH_MDS_STATE_CLIENTREPLAY: return "up:clientreplay";
28 	case CEPH_MDS_STATE_ACTIVE:     return "up:active";
29 	case CEPH_MDS_STATE_STOPPING:   return "up:stopping";
30 	}
31 	return "???";
32 }
33 
34 const char *ceph_session_op_name(int op)
35 {
36 	switch (op) {
37 	case CEPH_SESSION_REQUEST_OPEN: return "request_open";
38 	case CEPH_SESSION_OPEN: return "open";
39 	case CEPH_SESSION_REQUEST_CLOSE: return "request_close";
40 	case CEPH_SESSION_CLOSE: return "close";
41 	case CEPH_SESSION_REQUEST_RENEWCAPS: return "request_renewcaps";
42 	case CEPH_SESSION_RENEWCAPS: return "renewcaps";
43 	case CEPH_SESSION_STALE: return "stale";
44 	case CEPH_SESSION_RECALL_STATE: return "recall_state";
45 	case CEPH_SESSION_FLUSHMSG: return "flushmsg";
46 	case CEPH_SESSION_FLUSHMSG_ACK: return "flushmsg_ack";
47 	case CEPH_SESSION_FORCE_RO: return "force_ro";
48 	case CEPH_SESSION_REJECT: return "reject";
49 	case CEPH_SESSION_REQUEST_FLUSH_MDLOG: return "flush_mdlog";
50 	}
51 	return "???";
52 }
53 
54 const char *ceph_mds_op_name(int op)
55 {
56 	switch (op) {
57 	case CEPH_MDS_OP_LOOKUP:  return "lookup";
58 	case CEPH_MDS_OP_LOOKUPHASH:  return "lookuphash";
59 	case CEPH_MDS_OP_LOOKUPPARENT:  return "lookupparent";
60 	case CEPH_MDS_OP_LOOKUPINO:  return "lookupino";
61 	case CEPH_MDS_OP_LOOKUPNAME:  return "lookupname";
62 	case CEPH_MDS_OP_GETATTR:  return "getattr";
63 	case CEPH_MDS_OP_GETVXATTR:  return "getvxattr";
64 	case CEPH_MDS_OP_SETXATTR: return "setxattr";
65 	case CEPH_MDS_OP_SETATTR: return "setattr";
66 	case CEPH_MDS_OP_RMXATTR: return "rmxattr";
67 	case CEPH_MDS_OP_SETLAYOUT: return "setlayou";
68 	case CEPH_MDS_OP_SETDIRLAYOUT: return "setdirlayout";
69 	case CEPH_MDS_OP_READDIR: return "readdir";
70 	case CEPH_MDS_OP_MKNOD: return "mknod";
71 	case CEPH_MDS_OP_LINK: return "link";
72 	case CEPH_MDS_OP_UNLINK: return "unlink";
73 	case CEPH_MDS_OP_RENAME: return "rename";
74 	case CEPH_MDS_OP_MKDIR: return "mkdir";
75 	case CEPH_MDS_OP_RMDIR: return "rmdir";
76 	case CEPH_MDS_OP_SYMLINK: return "symlink";
77 	case CEPH_MDS_OP_CREATE: return "create";
78 	case CEPH_MDS_OP_OPEN: return "open";
79 	case CEPH_MDS_OP_LOOKUPSNAP: return "lookupsnap";
80 	case CEPH_MDS_OP_LSSNAP: return "lssnap";
81 	case CEPH_MDS_OP_MKSNAP: return "mksnap";
82 	case CEPH_MDS_OP_RMSNAP: return "rmsnap";
83 	case CEPH_MDS_OP_RENAMESNAP: return "renamesnap";
84 	case CEPH_MDS_OP_SETFILELOCK: return "setfilelock";
85 	case CEPH_MDS_OP_GETFILELOCK: return "getfilelock";
86 	}
87 	return "???";
88 }
89 
90 const char *ceph_cap_op_name(int op)
91 {
92 	switch (op) {
93 	case CEPH_CAP_OP_GRANT: return "grant";
94 	case CEPH_CAP_OP_REVOKE: return "revoke";
95 	case CEPH_CAP_OP_TRUNC: return "trunc";
96 	case CEPH_CAP_OP_EXPORT: return "export";
97 	case CEPH_CAP_OP_IMPORT: return "import";
98 	case CEPH_CAP_OP_UPDATE: return "update";
99 	case CEPH_CAP_OP_DROP: return "drop";
100 	case CEPH_CAP_OP_FLUSH: return "flush";
101 	case CEPH_CAP_OP_FLUSH_ACK: return "flush_ack";
102 	case CEPH_CAP_OP_FLUSHSNAP: return "flushsnap";
103 	case CEPH_CAP_OP_FLUSHSNAP_ACK: return "flushsnap_ack";
104 	case CEPH_CAP_OP_RELEASE: return "release";
105 	case CEPH_CAP_OP_RENEW: return "renew";
106 	}
107 	return "???";
108 }
109 
110 const char *ceph_lease_op_name(int o)
111 {
112 	switch (o) {
113 	case CEPH_MDS_LEASE_REVOKE: return "revoke";
114 	case CEPH_MDS_LEASE_RELEASE: return "release";
115 	case CEPH_MDS_LEASE_RENEW: return "renew";
116 	case CEPH_MDS_LEASE_REVOKE_ACK: return "revoke_ack";
117 	}
118 	return "???";
119 }
120 
121 const char *ceph_snap_op_name(int o)
122 {
123 	switch (o) {
124 	case CEPH_SNAP_OP_UPDATE: return "update";
125 	case CEPH_SNAP_OP_CREATE: return "create";
126 	case CEPH_SNAP_OP_DESTROY: return "destroy";
127 	case CEPH_SNAP_OP_SPLIT: return "split";
128 	}
129 	return "???";
130 }
131