Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Ceph string constants |
| 3 | */ |
| 4 | #include "types.h" |
| 5 | |
Sage Weil | 4e7a5dc | 2009-11-18 16:19:57 -0800 | [diff] [blame] | 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"; |
Sage Weil | 4e7a5dc | 2009-11-18 16:19:57 -0800 | [diff] [blame] | 13 | case CEPH_ENTITY_TYPE_AUTH: return "auth"; |
| 14 | default: return "unknown"; |
| 15 | } |
| 16 | } |
| 17 | |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 18 | const char *ceph_osd_op_name(int op) |
| 19 | { |
| 20 | switch (op) { |
| 21 | case CEPH_OSD_OP_READ: return "read"; |
| 22 | case CEPH_OSD_OP_STAT: return "stat"; |
| 23 | |
| 24 | case CEPH_OSD_OP_MASKTRUNC: return "masktrunc"; |
| 25 | |
| 26 | case CEPH_OSD_OP_WRITE: return "write"; |
| 27 | case CEPH_OSD_OP_DELETE: return "delete"; |
| 28 | case CEPH_OSD_OP_TRUNCATE: return "truncate"; |
| 29 | case CEPH_OSD_OP_ZERO: return "zero"; |
| 30 | case CEPH_OSD_OP_WRITEFULL: return "writefull"; |
| 31 | |
| 32 | case CEPH_OSD_OP_APPEND: return "append"; |
| 33 | case CEPH_OSD_OP_STARTSYNC: return "startsync"; |
| 34 | case CEPH_OSD_OP_SETTRUNC: return "settrunc"; |
| 35 | case CEPH_OSD_OP_TRIMTRUNC: return "trimtrunc"; |
| 36 | |
| 37 | case CEPH_OSD_OP_TMAPUP: return "tmapup"; |
| 38 | case CEPH_OSD_OP_TMAPGET: return "tmapget"; |
| 39 | case CEPH_OSD_OP_TMAPPUT: return "tmapput"; |
| 40 | |
| 41 | case CEPH_OSD_OP_GETXATTR: return "getxattr"; |
| 42 | case CEPH_OSD_OP_GETXATTRS: return "getxattrs"; |
| 43 | case CEPH_OSD_OP_SETXATTR: return "setxattr"; |
| 44 | case CEPH_OSD_OP_SETXATTRS: return "setxattrs"; |
| 45 | case CEPH_OSD_OP_RESETXATTRS: return "resetxattrs"; |
| 46 | case CEPH_OSD_OP_RMXATTR: return "rmxattr"; |
Sage Weil | ca9d93a | 2010-05-12 14:48:20 -0700 | [diff] [blame] | 47 | case CEPH_OSD_OP_CMPXATTR: return "cmpxattr"; |
Sage Weil | 0dee3c2 | 2009-10-06 11:31:06 -0700 | [diff] [blame] | 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 | } |
Sage Weil | ca9d93a | 2010-05-12 14:48:20 -0700 | [diff] [blame] | 177 | |
Sage Weil | 3668377 | 2010-05-14 11:36:48 -0700 | [diff] [blame] | 178 | const char *ceph_pool_op_name(int op) |
| 179 | { |
| 180 | switch (op) { |
| 181 | case POOL_OP_CREATE: return "create"; |
| 182 | case POOL_OP_DELETE: return "delete"; |
| 183 | case POOL_OP_AUID_CHANGE: return "auid change"; |
| 184 | case POOL_OP_CREATE_SNAP: return "create snap"; |
| 185 | case POOL_OP_DELETE_SNAP: return "delete snap"; |
| 186 | case POOL_OP_CREATE_UNMANAGED_SNAP: return "create unmanaged snap"; |
| 187 | case POOL_OP_DELETE_UNMANAGED_SNAP: return "delete unmanaged snap"; |
| 188 | } |
| 189 | return "???"; |
Sage Weil | ca9d93a | 2010-05-12 14:48:20 -0700 | [diff] [blame] | 190 | } |