xref: /openbmc/linux/net/ceph/ceph_strings.c (revision b34e08d5)
1 /*
2  * Ceph string constants
3  */
4 #include <linux/module.h>
5 #include <linux/ceph/types.h>
6 
7 const char *ceph_entity_type_name(int type)
8 {
9 	switch (type) {
10 	case CEPH_ENTITY_TYPE_MDS: return "mds";
11 	case CEPH_ENTITY_TYPE_OSD: return "osd";
12 	case CEPH_ENTITY_TYPE_MON: return "mon";
13 	case CEPH_ENTITY_TYPE_CLIENT: return "client";
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 	case CEPH_OSD_OP_MAPEXT: return "mapext";
25 	case CEPH_OSD_OP_SPARSE_READ: return "sparse-read";
26 	case CEPH_OSD_OP_NOTIFY: return "notify";
27 	case CEPH_OSD_OP_NOTIFY_ACK: return "notify-ack";
28 	case CEPH_OSD_OP_ASSERT_VER: return "assert-version";
29 
30 	case CEPH_OSD_OP_MASKTRUNC: return "masktrunc";
31 
32 	case CEPH_OSD_OP_CREATE: return "create";
33 	case CEPH_OSD_OP_WRITE: return "write";
34 	case CEPH_OSD_OP_DELETE: return "delete";
35 	case CEPH_OSD_OP_TRUNCATE: return "truncate";
36 	case CEPH_OSD_OP_ZERO: return "zero";
37 	case CEPH_OSD_OP_WRITEFULL: return "writefull";
38 	case CEPH_OSD_OP_ROLLBACK: return "rollback";
39 
40 	case CEPH_OSD_OP_APPEND: return "append";
41 	case CEPH_OSD_OP_STARTSYNC: return "startsync";
42 	case CEPH_OSD_OP_SETTRUNC: return "settrunc";
43 	case CEPH_OSD_OP_TRIMTRUNC: return "trimtrunc";
44 
45 	case CEPH_OSD_OP_TMAPUP: return "tmapup";
46 	case CEPH_OSD_OP_TMAPGET: return "tmapget";
47 	case CEPH_OSD_OP_TMAPPUT: return "tmapput";
48 	case CEPH_OSD_OP_WATCH: return "watch";
49 
50 	case CEPH_OSD_OP_CLONERANGE: return "clonerange";
51 	case CEPH_OSD_OP_ASSERT_SRC_VERSION: return "assert-src-version";
52 	case CEPH_OSD_OP_SRC_CMPXATTR: return "src-cmpxattr";
53 
54 	case CEPH_OSD_OP_GETXATTR: return "getxattr";
55 	case CEPH_OSD_OP_GETXATTRS: return "getxattrs";
56 	case CEPH_OSD_OP_SETXATTR: return "setxattr";
57 	case CEPH_OSD_OP_SETXATTRS: return "setxattrs";
58 	case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs";
59 	case CEPH_OSD_OP_RMXATTR: return "rmxattr";
60 	case CEPH_OSD_OP_CMPXATTR: return "cmpxattr";
61 
62 	case CEPH_OSD_OP_PULL: return "pull";
63 	case CEPH_OSD_OP_PUSH: return "push";
64 	case CEPH_OSD_OP_BALANCEREADS: return "balance-reads";
65 	case CEPH_OSD_OP_UNBALANCEREADS: return "unbalance-reads";
66 	case CEPH_OSD_OP_SCRUB: return "scrub";
67 	case CEPH_OSD_OP_SCRUB_RESERVE: return "scrub-reserve";
68 	case CEPH_OSD_OP_SCRUB_UNRESERVE: return "scrub-unreserve";
69 	case CEPH_OSD_OP_SCRUB_STOP: return "scrub-stop";
70 	case CEPH_OSD_OP_SCRUB_MAP: return "scrub-map";
71 
72 	case CEPH_OSD_OP_WRLOCK: return "wrlock";
73 	case CEPH_OSD_OP_WRUNLOCK: return "wrunlock";
74 	case CEPH_OSD_OP_RDLOCK: return "rdlock";
75 	case CEPH_OSD_OP_RDUNLOCK: return "rdunlock";
76 	case CEPH_OSD_OP_UPLOCK: return "uplock";
77 	case CEPH_OSD_OP_DNLOCK: return "dnlock";
78 
79 	case CEPH_OSD_OP_CALL: return "call";
80 
81 	case CEPH_OSD_OP_PGLS: return "pgls";
82 	case CEPH_OSD_OP_PGLS_FILTER: return "pgls-filter";
83 	case CEPH_OSD_OP_OMAPGETKEYS: return "omap-get-keys";
84 	case CEPH_OSD_OP_OMAPGETVALS: return "omap-get-vals";
85 	case CEPH_OSD_OP_OMAPGETHEADER: return "omap-get-header";
86 	case CEPH_OSD_OP_OMAPGETVALSBYKEYS: return "omap-get-vals-by-keys";
87 	case CEPH_OSD_OP_OMAPSETVALS: return "omap-set-vals";
88 	case CEPH_OSD_OP_OMAPSETHEADER: return "omap-set-header";
89 	case CEPH_OSD_OP_OMAPCLEAR: return "omap-clear";
90 	case CEPH_OSD_OP_OMAPRMKEYS: return "omap-rm-keys";
91 	}
92 	return "???";
93 }
94 
95 const char *ceph_osd_state_name(int s)
96 {
97 	switch (s) {
98 	case CEPH_OSD_EXISTS:
99 		return "exists";
100 	case CEPH_OSD_UP:
101 		return "up";
102 	case CEPH_OSD_AUTOOUT:
103 		return "autoout";
104 	case CEPH_OSD_NEW:
105 		return "new";
106 	default:
107 		return "???";
108 	}
109 }
110 
111 const char *ceph_pool_op_name(int op)
112 {
113 	switch (op) {
114 	case POOL_OP_CREATE: return "create";
115 	case POOL_OP_DELETE: return "delete";
116 	case POOL_OP_AUID_CHANGE: return "auid change";
117 	case POOL_OP_CREATE_SNAP: return "create snap";
118 	case POOL_OP_DELETE_SNAP: return "delete snap";
119 	case POOL_OP_CREATE_UNMANAGED_SNAP: return "create unmanaged snap";
120 	case POOL_OP_DELETE_UNMANAGED_SNAP: return "delete unmanaged snap";
121 	}
122 	return "???";
123 }
124