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