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