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 <asm/types.h>
35 # include <linux/list.h>
40 * this file contains all data structures used in Lustre interfaces:
41 * - obdo and obd_request records
42 * - mds_request records
50 typedef __u8 obd_uuid_t[37];
52 /* FOO_REQUEST_PORTAL is for incoming requests on the FOO
53 * FOO_REPLY_PORTAL is for incoming replies on the FOO
54 * FOO_BULK_PORTAL is for incoming bulk on the FOO
57 #define CONNMGR_REQUEST_PORTAL 1
58 #define CONNMGR_REPLY_PORTAL 2
59 #define OSC_REQUEST_PORTAL 3
60 #define OSC_REPLY_PORTAL 4
61 #define OSC_BULK_PORTAL 5
62 #define OST_REQUEST_PORTAL 6
63 #define OST_REPLY_PORTAL 7
64 #define OST_BULK_PORTAL 8
65 #define MDC_REQUEST_PORTAL 9
66 #define MDC_REPLY_PORTAL 10
67 #define MDC_BULK_PORTAL 11
68 #define MDS_REQUEST_PORTAL 12
69 #define MDS_REPLY_PORTAL 13
70 #define MDS_BULK_PORTAL 14
71 #define LDLM_REQUEST_PORTAL 15
72 #define LDLM_REPLY_PORTAL 16
73 #define LDLM_CLI_REQUEST_PORTAL 17
74 #define LDLM_CLI_REPLY_PORTAL 18
80 #define SVC_STOPPING 16
81 #define SVC_STOPPED 32
83 #define LUSTRE_CONN_NEW 1
84 #define LUSTRE_CONN_CON 2
85 #define LUSTRE_CONN_RECOVD 3
86 #define LUSTRE_CONN_FULL 4
89 #define PTL_RPC_MSG_REQUEST 4711
90 #define PTL_RPC_MSG_ERR 4712
91 #define PTL_RPC_MSG_REPLY 4713
93 #define PTLRPC_MSG_MAGIC (cpu_to_le32(0x0BD00BD0))
94 #define PTLRPC_MSG_VERSION (cpu_to_le32(0x00040001))
96 struct lustre_handle {
101 static inline void ptlrpc_invalidate_handle(struct lustre_handle *hdl)
103 hdl->addr = hdl->cookie = 0; /* XXX invalid enough? */
106 /* we depend on this structure to be 8-byte aligned */
109 __u64 cookie; /* security token */
115 __u64 last_committed;
122 #define CONNMGR_REPLY 0
123 #define CONNMGR_CONNECT 1
126 * OST requests: OBDO & OBD request records
130 #define OST_REPLY 0 /* reply ? */
131 #define OST_GETATTR 1
132 #define OST_SETATTR 2
136 #define OST_DESTROY 6
137 #define OST_GET_INFO 7
138 #define OST_CONNECT 8
139 #define OST_DISCONNECT 9
143 #define OST_STATFS 13
146 typedef uint64_t obd_id;
147 typedef uint64_t obd_gr;
148 typedef uint64_t obd_time;
149 typedef uint64_t obd_size;
150 typedef uint64_t obd_off;
151 typedef uint64_t obd_blocks;
152 typedef uint32_t obd_blksize;
153 typedef uint32_t obd_mode;
154 typedef uint32_t obd_uid;
155 typedef uint32_t obd_gid;
156 typedef uint64_t obd_rdev;
157 typedef uint32_t obd_flag;
158 typedef uint32_t obd_count;
160 #define OBD_FL_INLINEDATA (0x00000001)
161 #define OBD_FL_OBDMDEXISTS (0x00000002)
163 #define OBD_INLINESZ 60
165 /* Note: 64-bit types are 64-bit aligned in structure */
175 obd_blksize o_blksize;
181 obd_count o_generation;
182 obd_flag o_valid; /* hot fields in this obdo */
185 char o_inline[OBD_INLINESZ];
188 struct lov_object_id { /* per-child structure */
192 #define LOV_MAGIC 0x0BD00BD0
196 __u32 lmm_easize; /* packed size of extended */
197 __u64 lmm_object_id; /* lov object id */
198 __u32 lmm_stripe_offset; /* starting stripe offset in lmd_objects */
199 __u32 lmm_stripe_count; /* number of stipes in use for this object */
200 __u64 lmm_stripe_size; /* size of the stripe */
201 __u32 lmm_ost_count; /* how many OSTs are in this LOV */
202 __u32 lmm_stripe_pattern; /* per-lov object stripe pattern */
203 struct lov_object_id lmm_objects[0];
206 #define OBD_MD_FLALL (0xffffffff)
207 #define OBD_MD_FLID (0x00000001) /* object ID */
208 #define OBD_MD_FLATIME (0x00000002) /* access time */
209 #define OBD_MD_FLMTIME (0x00000004) /* data modification time */
210 #define OBD_MD_FLCTIME (0x00000008) /* change time */
211 #define OBD_MD_FLSIZE (0x00000010) /* size */
212 #define OBD_MD_FLBLOCKS (0x00000020) /* allocated blocks count */
213 #define OBD_MD_FLBLKSZ (0x00000040) /* block size */
214 #define OBD_MD_FLMODE (0x00000080) /* access bits (mode & ~S_IFMT) */
215 #define OBD_MD_FLTYPE (0x00000100) /* object type (mode & S_IFMT) */
216 #define OBD_MD_FLUID (0x00000200) /* user ID */
217 #define OBD_MD_FLGID (0x00000400) /* group ID */
218 #define OBD_MD_FLFLAGS (0x00000800) /* flags word */
219 #define OBD_MD_FLOBDFLG (0x00001000)
220 #define OBD_MD_FLNLINK (0x00002000) /* link count */
221 #define OBD_MD_FLGENER (0x00004000) /* generation number */
222 #define OBD_MD_FLINLINE (0x00008000) /* inline data */
223 #define OBD_MD_FLRDEV (0x00010000) /* device number */
224 #define OBD_MD_FLEASIZE (0x00020000) /* extended attribute data */
225 #define OBD_MD_LINKNAME (0x00040000) /* symbolic link target */
226 #define OBD_MD_FLHANDLE (0x00080000) /* file handle */
227 #define OBD_MD_FLNOTOBD (~(OBD_MD_FLOBDFLG | OBD_MD_FLBLOCKS | OBD_MD_LINKNAME))
242 /* ost_body.data values for OST_BRW */
244 #define OBD_BRW_READ 0x1
245 #define OBD_BRW_WRITE 0x2
246 #define OBD_BRW_RWMASK (OBD_BRW_READ | OBD_BRW_WRITE)
247 #define OBD_BRW_CREATE 0x4
249 #define OBD_PUNCH_EOF 0xffffffffffffffffULL
254 /* struct lustre_handle ioo_handle; XXX in the future */
259 struct niobuf_remote {
266 #define CONNMGR_REPLY 0
267 #define CONNMGR_CONNECT 1
269 struct connmgr_body {
273 obd_uuid_t conn_uuid;
276 /* request structure for OST's */
278 #define OST_REQ_HAS_OA1 0x1
289 #define MDS_GETATTR 1
293 #define MDS_READPAGE 6
294 #define MDS_CONNECT 7
295 #define MDS_DISCONNECT 8
296 #define MDS_GETSTATUS 9
297 #define MDS_STATFS 10
298 #define MDS_GETLOVINFO 11
300 #define REINT_SETATTR 1
301 #define REINT_CREATE 2
303 #define REINT_UNLINK 4
304 #define REINT_RENAME 5
305 #define REINT_RECREATE 6
315 #define MDS_STATUS_CONN 1
316 #define MDS_STATUS_LOV 2
318 struct mds_status_req {
323 struct mds_fileh_body {
325 struct lustre_handle f_handle;
328 struct mds_conn_status {
329 struct ll_fid rootfid;
331 __u64 last_committed;
333 /* XXX preallocated quota & obj fields here */
339 struct lustre_handle handle;
341 __u32 ino; /* make this a __u64 */
357 /* MDS update records */
360 //struct mds_update_record_hdr {
364 struct mds_rec_setattr {
369 struct ll_fid sa_fid;
380 struct mds_rec_create {
385 struct ll_fid cr_fid;
392 struct mds_rec_link {
397 struct ll_fid lk_fid1;
398 struct ll_fid lk_fid2;
401 struct mds_rec_unlink {
406 struct ll_fid ul_fid1;
407 struct ll_fid ul_fid2;
410 struct mds_rec_rename {
415 struct ll_fid rn_fid1;
416 struct ll_fid rn_fid2;
421 * LOV data structures
428 __u32 ld_tgt_count; /* how many OBD's */
429 __u32 ld_default_stripe_count; /* how many objects are used */
430 __u64 ld_default_stripe_size; /* in bytes */
431 __u64 ld_default_stripe_offset; /* in bytes */
432 __u32 ld_pattern; /* RAID 0,1 etc */
439 /* opcodes -- MUST be distinct from OST/MDS opcodes */
440 #define LDLM_ENQUEUE 101
441 #define LDLM_CONVERT 102
442 #define LDLM_CANCEL 103
443 #define LDLM_BL_CALLBACK 104
444 #define LDLM_CP_CALLBACK 105
446 #define RES_NAME_SIZE 3
447 #define RES_VERSION_SIZE 4
468 /* Note this unaligned structure; as long as it's only used in ldlm_request
469 * below, we're probably fine. */
470 struct ldlm_resource_desc {
472 __u64 lr_name[RES_NAME_SIZE];
473 __u32 lr_version[RES_VERSION_SIZE];
476 struct ldlm_lock_desc {
477 struct ldlm_resource_desc l_resource;
478 ldlm_mode_t l_req_mode;
479 ldlm_mode_t l_granted_mode;
480 struct ldlm_extent l_extent;
481 __u32 l_version[RES_VERSION_SIZE];
484 struct ldlm_request {
486 struct ldlm_lock_desc lock_desc;
487 struct lustre_handle lock_handle1;
488 struct lustre_handle lock_handle2;
494 __u64 lock_resource_name[RES_NAME_SIZE];
495 struct lustre_handle lock_handle;
496 struct ldlm_extent lock_extent; /* XXX make this policy 1 &2 */
497 __u64 lock_policy_res1;
498 __u64 lock_policy_res2;