1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * (Un)packing of OST requests
24 #ifndef _LUSTRE_IDL_H_
25 #define _LUSTRE_IDL_H_
28 # include <linux/ioctl.h>
29 # include <asm/types.h>
30 # include <linux/types.h>
31 # include <linux/list.h>
34 # include <linux/list.h>
39 * this file contains all data structures used in Lustre interfaces:
40 * - obdo and obd_request records
41 * - mds_request records
49 typedef __u8 uuid_t[37];
51 /* FOO_REQUEST_PORTAL is for incoming requests on the FOO
52 * FOO_REPLY_PORTAL is for incoming replies on the FOO
53 * FOO_BULK_PORTAL is for incoming bulk on the FOO
56 #define CONNMGR_REQUEST_PORTAL 1
57 #define CONNMGR_REPLY_PORTAL 2
58 #define OSC_REQUEST_PORTAL 3
59 #define OSC_REPLY_PORTAL 4
60 #define OSC_BULK_PORTAL 5
61 #define OST_REQUEST_PORTAL 6
62 #define OST_REPLY_PORTAL 7
63 #define OST_BULK_PORTAL 8
64 #define MDC_REQUEST_PORTAL 9
65 #define MDC_REPLY_PORTAL 10
66 #define MDC_BULK_PORTAL 11
67 #define MDS_REQUEST_PORTAL 12
68 #define MDS_REPLY_PORTAL 13
69 #define MDS_BULK_PORTAL 14
70 #define LDLM_REQUEST_PORTAL 15
71 #define LDLM_REPLY_PORTAL 16
72 #define LDLM_CLI_REQUEST_PORTAL 17
73 #define LDLM_CLI_REPLY_PORTAL 18
79 #define SVC_STOPPING 16
80 #define SVC_STOPPED 32
82 #define RECOVD_STOPPING 1 /* how cleanup tells recovd to quit */
83 #define RECOVD_IDLE 2 /* normal state */
84 #define RECOVD_STOPPED 4 /* after recovd has stopped */
85 #define RECOVD_FAIL 8 /* RPC timeout: wakeup recovd, sets flag */
86 #define RECOVD_TIMEOUT 16 /* set when recovd detects a timeout */
87 #define RECOVD_UPCALL_WAIT 32 /* an upcall has been placed */
88 #define RECOVD_UPCALL_ANSWER 64 /* an upcall has been answered */
90 #define LUSTRE_CONN_NEW 1
91 #define LUSTRE_CONN_CON 2
92 #define LUSTRE_CONN_RECOVD 3
93 #define LUSTRE_CONN_FULL 4
96 #define PTL_RPC_MSG_REQUEST 4711
97 #define PTL_RPC_MSG_ERR 4712
98 #define PTL_RPC_MSG_OK 0
100 #define PTL_RPC_TYPE_REQUEST 2
101 #define PTL_RPC_TYPE_REPLY 3
103 #define PTLRPC_MSG_MAGIC (cpu_to_le32(0x0BD00BD0))
104 #define PTLRPC_MSG_VERSION (cpu_to_le32(0x00040001))
106 struct lustre_handle {
111 /* we depend on this structure to be 8-byte aligned */
114 __u64 cookie; /* security token */
120 __u64 last_committed;
127 #define CONNMGR_REPLY 0
128 #define CONNMGR_CONNECT 1
131 * OST requests: OBDO & OBD request records
135 #define OST_REPLY 0 /* reply ? */
136 #define OST_GETATTR 1
137 #define OST_SETATTR 2
141 #define OST_DESTROY 6
142 #define OST_GET_INFO 7
143 #define OST_CONNECT 8
144 #define OST_DISCONNECT 9
148 #define OST_STATFS 13
151 typedef uint64_t obd_id;
152 typedef uint64_t obd_gr;
153 typedef uint64_t obd_time;
154 typedef uint64_t obd_size;
155 typedef uint64_t obd_off;
156 typedef uint64_t obd_blocks;
157 typedef uint32_t obd_blksize;
158 typedef uint32_t obd_mode;
159 typedef uint32_t obd_uid;
160 typedef uint32_t obd_gid;
161 typedef uint64_t obd_rdev;
162 typedef uint32_t obd_flag;
163 typedef uint32_t obd_count;
165 #define OBD_FL_INLINEDATA (0x00000001)
166 #define OBD_FL_OBDMDEXISTS (0x00000002)
167 #define OBD_FL_CREATEONOPEN (0x00000004)
169 #define OBD_INLINESZ 60
170 #define OBD_OBDMDSZ 60
171 /* Note: 64-bit types are 64-bit aligned in structure */
181 obd_blksize o_blksize;
187 obd_count o_generation;
188 obd_flag o_valid; /* hot fields in this obdo */
191 char o_inline[OBD_INLINESZ];
194 struct lov_object_id { /* per-child structure */
198 struct lov_stripe_md {
200 __u64 lmd_object_id; /* lov object id */
201 __u64 lmd_stripe_count;
203 __u32 lmd_stripe_size;
204 __u32 lmd_stripe_pattern; /* per-lov object stripe pattern */
205 struct lov_object_id lmd_objects[0];
208 #define OBD_MD_FLALL (0xffffffff)
209 #define OBD_MD_FLID (0x00000001)
210 #define OBD_MD_FLATIME (0x00000002)
211 #define OBD_MD_FLMTIME (0x00000004)
212 #define OBD_MD_FLCTIME (0x00000008)
213 #define OBD_MD_FLSIZE (0x00000010)
214 #define OBD_MD_FLBLOCKS (0x00000020)
215 #define OBD_MD_FLBLKSZ (0x00000040)
216 #define OBD_MD_FLMODE (0x00000080)
217 #define OBD_MD_FLTYPE (0x00000100)
218 #define OBD_MD_FLUID (0x00000200)
219 #define OBD_MD_FLGID (0x00000400)
220 #define OBD_MD_FLFLAGS (0x00000800)
221 #define OBD_MD_FLOBDFLG (0x00001000)
222 #define OBD_MD_FLNLINK (0x00002000)
223 #define OBD_MD_FLGENER (0x00004000)
224 #define OBD_MD_FLINLINE (0x00008000)
225 #define OBD_MD_FLRDEV (0x00010000)
226 #define OBD_MD_FLOBJID (0x00020000)
227 #define OBD_MD_LINKNAME (0x00040000)
228 #define OBD_MD_FLNOTOBD (~(OBD_MD_FLOBDFLG | OBD_MD_FLBLOCKS | OBD_MD_LINKNAME))
243 /* ost_body.data values for OST_BRW */
245 #define OBD_BRW_READ 0x1
246 #define OBD_BRW_WRITE 0x2
247 #define OBD_BRW_RWMASK (OBD_BRW_READ | OBD_BRW_WRITE)
248 #define OBD_BRW_CREATE 0x4
257 struct niobuf_remote {
264 #define CONNMGR_REPLY 0
265 #define CONNMGR_CONNECT 1
267 struct connmgr_body {
274 /* request structure for OST's */
276 #define OST_REQ_HAS_OA1 0x1
287 #define MDS_GETATTR 1
291 #define MDS_READPAGE 6
292 #define MDS_CONNECT 7
293 #define MDS_DISCONNECT 8
294 #define MDS_GETSTATUS 9
295 #define MDS_STATFS 10
296 #define MDS_GETLOVINFO 11
298 #define REINT_SETATTR 1
299 #define REINT_CREATE 2
301 #define REINT_UNLINK 4
302 #define REINT_RENAME 5
303 #define REINT_RECREATE 6
313 #define MDS_STATUS_CONN 1
314 #define MDS_STATUS_LOV 2
316 struct mds_status_req {
321 struct mds_conn_status {
322 struct ll_fid rootfid;
324 __u64 last_committed;
326 /* XXX preallocated quota & obj fields here */
350 /* MDS update records */
351 struct mds_update_record_hdr {
355 struct mds_rec_setattr {
357 struct ll_fid sa_fid;
369 struct mds_rec_create {
371 struct ll_fid cr_fid;
379 struct mds_rec_link {
381 struct ll_fid lk_fid1;
382 struct ll_fid lk_fid2;
385 struct mds_rec_unlink {
387 struct ll_fid ul_fid1;
388 struct ll_fid ul_fid2;
391 struct mds_rec_rename {
393 struct ll_fid rn_fid1;
394 struct ll_fid rn_fid2;
399 * LOV data structures
404 __u32 ld_tgt_count; /* how many OBD's */
405 __u32 ld_default_stripecount;
406 __u32 ld_default_stripesize; /* in bytes */
407 __u32 ld_pattern; /* RAID 0,1 etc */
417 #define LDLM_ENQUEUE 1
418 #define LDLM_CONVERT 2
419 #define LDLM_CANCEL 3
420 #define LDLM_CALLBACK 4
422 #define RES_NAME_SIZE 3
423 #define RES_VERSION_SIZE 4
444 struct ldlm_resource_desc {
446 __u64 lr_name[RES_NAME_SIZE];
447 __u32 lr_version[RES_VERSION_SIZE];
450 struct ldlm_lock_desc {
451 struct ldlm_resource_desc l_resource;
452 ldlm_mode_t l_req_mode;
453 ldlm_mode_t l_granted_mode;
454 struct ldlm_extent l_extent;
455 __u32 l_version[RES_VERSION_SIZE];
458 struct ldlm_request {
460 struct ldlm_lock_desc lock_desc;
461 struct lustre_handle lock_handle1;
462 struct lustre_handle lock_handle2;
467 __u64 lock_resource_name[RES_NAME_SIZE];
468 struct lustre_handle lock_handle;
469 struct ldlm_extent lock_extent; /* XXX make this policy 1 &2 */
470 __u64 lock_policy_res1;
471 __u64 lock_policy_res2;