4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, 2013, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/include/lustre_req_layout.h
38 * Lustre Metadata Target (mdt) request handler
40 * Author: Nikita Danilov <nikita@clusterfs.com>
43 #ifndef _LUSTRE_REQ_LAYOUT_H__
44 #define _LUSTRE_REQ_LAYOUT_H__
46 /** \defgroup req_layout req_layout
55 struct ptlrpc_request;
63 /* Maximal number of fields (buffers) in a request message. */
64 #define REQ_MAX_FIELD_NR 9
67 struct ptlrpc_request *rc_req;
68 const struct req_format *rc_fmt;
69 enum req_location rc_loc;
70 __u32 rc_area[RCL_NR][REQ_MAX_FIELD_NR];
73 #if !defined(__REQ_LAYOUT_USER__)
75 /* struct ptlrpc_request, lustre_msg* */
76 #include <lustre_net.h>
78 void req_capsule_init(struct req_capsule *pill, struct ptlrpc_request *req,
79 enum req_location location);
80 void req_capsule_fini(struct req_capsule *pill);
82 void req_capsule_set(struct req_capsule *pill, const struct req_format *fmt);
83 void req_capsule_client_dump(struct req_capsule *pill);
84 void req_capsule_server_dump(struct req_capsule *pill);
85 void req_capsule_init_area(struct req_capsule *pill);
86 int req_capsule_filled_sizes(struct req_capsule *pill, enum req_location loc);
87 int req_capsule_server_pack(struct req_capsule *pill);
89 void *req_capsule_client_get(struct req_capsule *pill,
90 const struct req_msg_field *field);
91 void *req_capsule_client_swab_get(struct req_capsule *pill,
92 const struct req_msg_field *field,
94 void *req_capsule_client_sized_get(struct req_capsule *pill,
95 const struct req_msg_field *field,
97 void *req_capsule_server_get(struct req_capsule *pill,
98 const struct req_msg_field *field);
99 void *req_capsule_server_sized_get(struct req_capsule *pill,
100 const struct req_msg_field *field,
102 void *req_capsule_server_swab_get(struct req_capsule *pill,
103 const struct req_msg_field *field,
105 void *req_capsule_server_sized_swab_get(struct req_capsule *pill,
106 const struct req_msg_field *field,
107 int len, void *swabber);
108 const void *req_capsule_other_get(struct req_capsule *pill,
109 const struct req_msg_field *field);
111 void req_capsule_set_size(struct req_capsule *pill,
112 const struct req_msg_field *field,
113 enum req_location loc, int size);
114 int req_capsule_get_size(const struct req_capsule *pill,
115 const struct req_msg_field *field,
116 enum req_location loc);
117 int req_capsule_msg_size(struct req_capsule *pill, enum req_location loc);
118 int req_capsule_fmt_size(__u32 magic, const struct req_format *fmt,
119 enum req_location loc);
120 void req_capsule_extend(struct req_capsule *pill, const struct req_format *fmt);
122 int req_capsule_has_field(const struct req_capsule *pill,
123 const struct req_msg_field *field,
124 enum req_location loc);
125 int req_capsule_field_present(const struct req_capsule *pill,
126 const struct req_msg_field *field,
127 enum req_location loc);
128 void req_capsule_shrink(struct req_capsule *pill,
129 const struct req_msg_field *field,
131 enum req_location loc);
132 int req_capsule_server_grow(struct req_capsule *pill,
133 const struct req_msg_field *field,
134 unsigned int newlen);
135 int req_layout_init(void);
136 void req_layout_fini(void);
138 /* __REQ_LAYOUT_USER__ */
141 extern struct req_format RQF_OBD_PING;
142 extern struct req_format RQF_OBD_SET_INFO;
143 extern struct req_format RQF_SEC_CTX;
144 extern struct req_format RQF_OBD_IDX_READ;
146 extern struct req_format RQF_MGS_TARGET_REG;
147 extern struct req_format RQF_MGS_SET_INFO;
148 extern struct req_format RQF_MGS_CONFIG_READ;
149 /* fid/fld req_format */
150 extern struct req_format RQF_SEQ_QUERY;
151 extern struct req_format RQF_FLD_QUERY;
152 extern struct req_format RQF_FLD_READ;
154 extern struct req_format RQF_MDS_CONNECT;
155 extern struct req_format RQF_MDS_DISCONNECT;
156 extern struct req_format RQF_MDS_STATFS;
157 extern struct req_format RQF_MDS_GETSTATUS;
158 extern struct req_format RQF_MDS_SYNC;
159 extern struct req_format RQF_MDS_GETXATTR;
160 extern struct req_format RQF_MDS_GETATTR;
161 extern struct req_format RQF_OUT_UPDATE;
164 * This is format of direct (non-intent) MDS_GETATTR_NAME request.
166 extern struct req_format RQF_MDS_GETATTR_NAME;
167 extern struct req_format RQF_MDS_CLOSE;
168 extern struct req_format RQF_MDS_RELEASE_CLOSE;
169 extern struct req_format RQF_MDS_PIN;
170 extern struct req_format RQF_MDS_UNPIN;
171 extern struct req_format RQF_MDS_CONNECT;
172 extern struct req_format RQF_MDS_DISCONNECT;
173 extern struct req_format RQF_MDS_GET_INFO;
174 extern struct req_format RQF_MDS_READPAGE;
175 extern struct req_format RQF_MDS_WRITEPAGE;
176 extern struct req_format RQF_MDS_IS_SUBDIR;
177 extern struct req_format RQF_MDS_DONE_WRITING;
178 extern struct req_format RQF_MDS_REINT;
179 extern struct req_format RQF_MDS_REINT_CREATE;
180 extern struct req_format RQF_MDS_REINT_CREATE_RMT_ACL;
181 extern struct req_format RQF_MDS_REINT_CREATE_SLAVE;
182 extern struct req_format RQF_MDS_REINT_CREATE_SYM;
183 extern struct req_format RQF_MDS_REINT_OPEN;
184 extern struct req_format RQF_MDS_REINT_UNLINK;
185 extern struct req_format RQF_MDS_REINT_LINK;
186 extern struct req_format RQF_MDS_REINT_RENAME;
187 extern struct req_format RQF_MDS_REINT_SETATTR;
188 extern struct req_format RQF_MDS_REINT_SETXATTR;
189 extern struct req_format RQF_MDS_QUOTACHECK;
190 extern struct req_format RQF_MDS_QUOTACTL;
191 extern struct req_format RQF_QC_CALLBACK;
192 extern struct req_format RQF_QUOTA_DQACQ;
193 extern struct req_format RQF_MDS_SWAP_LAYOUTS;
194 /* MDS hsm formats */
195 extern struct req_format RQF_MDS_HSM_STATE_GET;
196 extern struct req_format RQF_MDS_HSM_STATE_SET;
197 extern struct req_format RQF_MDS_HSM_ACTION;
198 extern struct req_format RQF_MDS_HSM_PROGRESS;
199 extern struct req_format RQF_MDS_HSM_CT_REGISTER;
200 extern struct req_format RQF_MDS_HSM_CT_UNREGISTER;
201 extern struct req_format RQF_MDS_HSM_REQUEST;
203 extern struct req_format RQF_OST_CONNECT;
204 extern struct req_format RQF_OST_DISCONNECT;
205 extern struct req_format RQF_OST_QUOTACHECK;
206 extern struct req_format RQF_OST_QUOTACTL;
207 extern struct req_format RQF_OST_GETATTR;
208 extern struct req_format RQF_OST_SETATTR;
209 extern struct req_format RQF_OST_CREATE;
210 extern struct req_format RQF_OST_PUNCH;
211 extern struct req_format RQF_OST_SYNC;
212 extern struct req_format RQF_OST_DESTROY;
213 extern struct req_format RQF_OST_BRW_READ;
214 extern struct req_format RQF_OST_BRW_WRITE;
215 extern struct req_format RQF_OST_STATFS;
216 extern struct req_format RQF_OST_SET_GRANT_INFO;
217 extern struct req_format RQF_OST_GET_INFO;
218 extern struct req_format RQF_OST_GET_INFO_LAST_ID;
219 extern struct req_format RQF_OST_GET_INFO_LAST_FID;
220 extern struct req_format RQF_OST_SET_INFO_LAST_FID;
221 extern struct req_format RQF_OST_GET_INFO_FIEMAP;
223 /* LDLM req_format */
224 extern struct req_format RQF_LDLM_ENQUEUE;
225 extern struct req_format RQF_LDLM_ENQUEUE_LVB;
226 extern struct req_format RQF_LDLM_CONVERT;
227 extern struct req_format RQF_LDLM_INTENT;
228 extern struct req_format RQF_LDLM_INTENT_BASIC;
229 extern struct req_format RQF_LDLM_INTENT_LAYOUT;
230 extern struct req_format RQF_LDLM_INTENT_GETATTR;
231 extern struct req_format RQF_LDLM_INTENT_OPEN;
232 extern struct req_format RQF_LDLM_INTENT_CREATE;
233 extern struct req_format RQF_LDLM_INTENT_UNLINK;
234 extern struct req_format RQF_LDLM_INTENT_GETXATTR;
235 extern struct req_format RQF_LDLM_INTENT_QUOTA;
236 extern struct req_format RQF_LDLM_CANCEL;
237 extern struct req_format RQF_LDLM_CALLBACK;
238 extern struct req_format RQF_LDLM_CP_CALLBACK;
239 extern struct req_format RQF_LDLM_BL_CALLBACK;
240 extern struct req_format RQF_LDLM_GL_CALLBACK;
241 extern struct req_format RQF_LDLM_GL_DESC_CALLBACK;
243 extern struct req_format RQF_LOG_CANCEL;
244 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_CREATE;
245 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_DESTROY;
246 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK;
247 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_PREV_BLOCK;
248 extern struct req_format RQF_LLOG_ORIGIN_HANDLE_READ_HEADER;
249 extern struct req_format RQF_LLOG_ORIGIN_CONNECT;
251 extern struct req_format RQF_CONNECT;
253 /* LFSCK req_format */
254 extern struct req_format RQF_LFSCK_NOTIFY;
255 extern struct req_format RQF_LFSCK_QUERY;
257 extern struct req_msg_field RMF_GENERIC_DATA;
258 extern struct req_msg_field RMF_PTLRPC_BODY;
259 extern struct req_msg_field RMF_MDT_BODY;
260 extern struct req_msg_field RMF_MDT_EPOCH;
261 extern struct req_msg_field RMF_OBD_STATFS;
262 extern struct req_msg_field RMF_NAME;
263 extern struct req_msg_field RMF_SYMTGT;
264 extern struct req_msg_field RMF_TGTUUID;
265 extern struct req_msg_field RMF_CLUUID;
266 extern struct req_msg_field RMF_SETINFO_VAL;
267 extern struct req_msg_field RMF_SETINFO_KEY;
268 extern struct req_msg_field RMF_GETINFO_VAL;
269 extern struct req_msg_field RMF_GETINFO_VALLEN;
270 extern struct req_msg_field RMF_GETINFO_KEY;
271 extern struct req_msg_field RMF_IDX_INFO;
272 extern struct req_msg_field RMF_CLOSE_DATA;
275 * connection handle received in MDS_CONNECT request.
277 extern struct req_msg_field RMF_CONN;
278 extern struct req_msg_field RMF_CONNECT_DATA;
279 extern struct req_msg_field RMF_DLM_REQ;
280 extern struct req_msg_field RMF_DLM_REP;
281 extern struct req_msg_field RMF_DLM_LVB;
282 extern struct req_msg_field RMF_DLM_GL_DESC;
283 extern struct req_msg_field RMF_LDLM_INTENT;
284 extern struct req_msg_field RMF_LAYOUT_INTENT;
285 extern struct req_msg_field RMF_MDT_MD;
286 extern struct req_msg_field RMF_REC_REINT;
287 extern struct req_msg_field RMF_EADATA;
288 extern struct req_msg_field RMF_EAVALS;
289 extern struct req_msg_field RMF_EAVALS_LENS;
290 extern struct req_msg_field RMF_ACL;
291 extern struct req_msg_field RMF_LOGCOOKIES;
292 extern struct req_msg_field RMF_CAPA1;
293 extern struct req_msg_field RMF_CAPA2;
294 extern struct req_msg_field RMF_OBD_QUOTACHECK;
295 extern struct req_msg_field RMF_OBD_QUOTACTL;
296 extern struct req_msg_field RMF_QUOTA_BODY;
297 extern struct req_msg_field RMF_STRING;
298 extern struct req_msg_field RMF_SWAP_LAYOUTS;
299 extern struct req_msg_field RMF_MDS_HSM_PROGRESS;
300 extern struct req_msg_field RMF_MDS_HSM_REQUEST;
301 extern struct req_msg_field RMF_MDS_HSM_USER_ITEM;
302 extern struct req_msg_field RMF_MDS_HSM_ARCHIVE;
303 extern struct req_msg_field RMF_HSM_USER_STATE;
304 extern struct req_msg_field RMF_HSM_STATE_SET;
305 extern struct req_msg_field RMF_MDS_HSM_CURRENT_ACTION;
306 extern struct req_msg_field RMF_MDS_HSM_REQUEST;
309 extern struct req_msg_field RMF_SEQ_OPC;
310 extern struct req_msg_field RMF_SEQ_RANGE;
311 extern struct req_msg_field RMF_FID_SPACE;
314 extern struct req_msg_field RMF_FLD_OPC;
315 extern struct req_msg_field RMF_FLD_MDFLD;
317 extern struct req_msg_field RMF_LLOGD_BODY;
318 extern struct req_msg_field RMF_LLOG_LOG_HDR;
319 extern struct req_msg_field RMF_LLOGD_CONN_BODY;
321 extern struct req_msg_field RMF_MGS_TARGET_INFO;
322 extern struct req_msg_field RMF_MGS_SEND_PARAM;
324 extern struct req_msg_field RMF_OST_BODY;
325 extern struct req_msg_field RMF_OBD_IOOBJ;
326 extern struct req_msg_field RMF_OBD_ID;
327 extern struct req_msg_field RMF_FID;
328 extern struct req_msg_field RMF_NIOBUF_REMOTE;
329 extern struct req_msg_field RMF_RCS;
330 extern struct req_msg_field RMF_FIEMAP_KEY;
331 extern struct req_msg_field RMF_FIEMAP_VAL;
332 extern struct req_msg_field RMF_OST_ID;
334 /* MGS config read message format */
335 extern struct req_msg_field RMF_MGS_CONFIG_BODY;
336 extern struct req_msg_field RMF_MGS_CONFIG_RES;
339 extern struct req_msg_field RMF_U32;
341 /* OBJ update format */
342 extern struct req_msg_field RMF_OUT_UPDATE;
343 extern struct req_msg_field RMF_OUT_UPDATE_REPLY;
346 extern struct req_msg_field RMF_LFSCK_REQUEST;
347 extern struct req_msg_field RMF_LFSCK_REPLY;
350 #endif /* _LUSTRE_REQ_LAYOUT_H__ */