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_CB_REQUEST_PORTAL 15
72 #define LDLM_CB_REPLY_PORTAL 16
73 #define LDLM_CANCEL_REQUEST_PORTAL 17
74 #define LDLM_CANCEL_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 {
100 #define DEAD_HANDLE_MAGIC 0xdeadbeefcafebabe
102 static inline void ptlrpc_invalidate_handle(struct lustre_handle *hdl)
104 hdl->addr = hdl->cookie = 0; /* XXX invalid enough? */
107 /* we depend on this structure to be 8-byte aligned */
110 __u64 cookie; /* security token */
116 __u64 last_committed;
124 /* Flags that are operation-specific go in the top 16 bits. */
125 #define MSG_OP_FLAG_MASK 0xffff0000
126 #define MSG_OP_FLAG_SHIFT 16
128 /* Flags that apply to all requests are in the bottom 16 bits */
129 #define MSG_GEN_FLAG_MASK 0x0000ffff
131 static inline u16 lustre_msg_get_flags(struct lustre_msg *msg)
133 return (u16)(msg->flags & MSG_GEN_FLAG_MASK);
136 static inline void lustre_msg_set_flags(struct lustre_msg *msg, u16 flags)
138 msg->flags &= ~MSG_GEN_FLAG_MASK;
142 static inline u16 lustre_msg_get_op_flags(struct lustre_msg *msg)
144 return (u16)(msg->flags >> MSG_OP_FLAG_SHIFT);
147 static inline void lustre_msg_set_op_flags(struct lustre_msg *msg, u16 flags)
149 msg->flags &= ~MSG_OP_FLAG_MASK;
150 msg->flags |= (flags << MSG_OP_FLAG_SHIFT);
153 #define CONNMGR_REPLY 0
154 #define CONNMGR_CONNECT 1
157 * OST requests: OBDO & OBD request records
161 #define OST_REPLY 0 /* reply ? */
162 #define OST_GETATTR 1
163 #define OST_SETATTR 2
167 #define OST_DESTROY 6
168 #define OST_GET_INFO 7
169 #define OST_CONNECT 8
170 #define OST_DISCONNECT 9
174 #define OST_STATFS 13
177 typedef uint64_t obd_id;
178 typedef uint64_t obd_gr;
179 typedef uint64_t obd_time;
180 typedef uint64_t obd_size;
181 typedef uint64_t obd_off;
182 typedef uint64_t obd_blocks;
183 typedef uint32_t obd_blksize;
184 typedef uint32_t obd_mode;
185 typedef uint32_t obd_uid;
186 typedef uint32_t obd_gid;
187 typedef uint64_t obd_rdev;
188 typedef uint32_t obd_flag;
189 typedef uint32_t obd_count;
191 #define OBD_FL_INLINEDATA (0x00000001)
192 #define OBD_FL_OBDMDEXISTS (0x00000002)
194 #define OBD_INLINESZ 60
196 /* Note: 64-bit types are 64-bit aligned in structure */
206 obd_blksize o_blksize;
212 obd_count o_generation;
213 obd_flag o_valid; /* hot fields in this obdo */
216 char o_inline[OBD_INLINESZ];
219 struct lov_object_id { /* per-child structure */
223 #define LOV_MAGIC 0x0BD00BD0
227 __u32 lmm_easize; /* packed size of extended */
228 __u64 lmm_object_id; /* lov object id */
229 __u32 lmm_stripe_offset; /* starting stripe offset in lmd_objects */
230 __u32 lmm_stripe_count; /* number of stipes in use for this object */
231 __u64 lmm_stripe_size; /* size of the stripe */
232 __u32 lmm_ost_count; /* how many OST idx are in this LOV md */
233 __u32 lmm_stripe_pattern; /* per-lov object stripe pattern */
234 struct lov_object_id lmm_objects[0];
237 #define OBD_MD_FLALL (0xffffffff)
238 #define OBD_MD_FLID (0x00000001) /* object ID */
239 #define OBD_MD_FLATIME (0x00000002) /* access time */
240 #define OBD_MD_FLMTIME (0x00000004) /* data modification time */
241 #define OBD_MD_FLCTIME (0x00000008) /* change time */
242 #define OBD_MD_FLSIZE (0x00000010) /* size */
243 #define OBD_MD_FLBLOCKS (0x00000020) /* allocated blocks count */
244 #define OBD_MD_FLBLKSZ (0x00000040) /* block size */
245 #define OBD_MD_FLMODE (0x00000080) /* access bits (mode & ~S_IFMT) */
246 #define OBD_MD_FLTYPE (0x00000100) /* object type (mode & S_IFMT) */
247 #define OBD_MD_FLUID (0x00000200) /* user ID */
248 #define OBD_MD_FLGID (0x00000400) /* group ID */
249 #define OBD_MD_FLFLAGS (0x00000800) /* flags word */
250 #define OBD_MD_FLOBDFLG (0x00001000)
251 #define OBD_MD_FLNLINK (0x00002000) /* link count */
252 #define OBD_MD_FLGENER (0x00004000) /* generation number */
253 #define OBD_MD_FLINLINE (0x00008000) /* inline data */
254 #define OBD_MD_FLRDEV (0x00010000) /* device number */
255 #define OBD_MD_FLEASIZE (0x00020000) /* extended attribute data */
256 #define OBD_MD_LINKNAME (0x00040000) /* symbolic link target */
257 #define OBD_MD_FLHANDLE (0x00080000) /* file handle */
258 #define OBD_MD_FLNOTOBD (~(OBD_MD_FLOBDFLG | OBD_MD_FLBLOCKS | OBD_MD_LINKNAME))
273 /* ost_body.data values for OST_BRW */
275 #define OBD_BRW_READ 0x1
276 #define OBD_BRW_WRITE 0x2
277 #define OBD_BRW_RWMASK (OBD_BRW_READ | OBD_BRW_WRITE)
278 #define OBD_BRW_CREATE 0x4
280 #define OBD_OBJECT_EOF 0xffffffffffffffffULL
285 /* struct lustre_handle ioo_handle; XXX in the future */
290 struct niobuf_remote {
297 #define CONNMGR_REPLY 0
298 #define CONNMGR_CONNECT 1
300 struct connmgr_body {
304 obd_uuid_t conn_uuid;
307 /* request structure for OST's */
309 #define OST_REQ_HAS_OA1 0x1
320 #define MDS_GETATTR 1
324 #define MDS_READPAGE 6
325 #define MDS_CONNECT 7
326 #define MDS_DISCONNECT 8
327 #define MDS_GETSTATUS 9
328 #define MDS_STATFS 10
329 #define MDS_GETLOVINFO 11
331 #define REINT_SETATTR 1
332 #define REINT_CREATE 2
334 #define REINT_UNLINK 4
335 #define REINT_RENAME 5
338 #define REINT_OPCODE_MASK 0xff /* opcodes must fit into this mask */
339 #define REINT_REPLAYING 0x1000 /* masked into the opcode to indicate replay */
348 #define MDS_STATUS_CONN 1
349 #define MDS_STATUS_LOV 2
351 struct mds_status_req {
356 struct mds_fileh_body {
358 struct lustre_handle f_handle;
361 struct mds_conn_status {
362 struct ll_fid rootfid;
364 __u64 last_committed;
366 /* XXX preallocated quota & obj fields here */
372 struct lustre_handle handle;
374 __u32 ino; /* make this a __u64 */
391 #define MDS_OPEN_HAS_EA 1 /* this open has an EA, for a delayed create*/
393 /* MDS update records */
396 //struct mds_update_record_hdr {
400 struct mds_rec_setattr {
407 struct ll_fid sa_fid;
418 struct mds_rec_create {
425 struct ll_fid cr_fid;
426 struct ll_fid cr_replayfid;
433 struct mds_rec_link {
438 struct ll_fid lk_fid1;
439 struct ll_fid lk_fid2;
442 struct mds_rec_unlink {
449 struct ll_fid ul_fid1;
450 struct ll_fid ul_fid2;
453 struct mds_rec_rename {
458 struct ll_fid rn_fid1;
459 struct ll_fid rn_fid2;
464 * LOV data structures
471 __u32 ld_tgt_count; /* how many OBD's */
472 __u32 ld_active_tgt_count; /* how many active */
473 __u32 ld_default_stripe_count; /* how many objects are used */
474 __u64 ld_default_stripe_size; /* in bytes */
475 __u64 ld_default_stripe_offset; /* in bytes */
476 __u32 ld_pattern; /* RAID 0,1 etc */
483 /* opcodes -- MUST be distinct from OST/MDS opcodes */
484 #define LDLM_ENQUEUE 101
485 #define LDLM_CONVERT 102
486 #define LDLM_CANCEL 103
487 #define LDLM_BL_CALLBACK 104
488 #define LDLM_CP_CALLBACK 105
490 #define RES_NAME_SIZE 3
491 #define RES_VERSION_SIZE 4
512 /* Note this unaligned structure; as long as it's only used in ldlm_request
513 * below, we're probably fine. */
514 struct ldlm_resource_desc {
516 __u64 lr_name[RES_NAME_SIZE];
517 __u32 lr_version[RES_VERSION_SIZE];
520 struct ldlm_lock_desc {
521 struct ldlm_resource_desc l_resource;
522 ldlm_mode_t l_req_mode;
523 ldlm_mode_t l_granted_mode;
524 struct ldlm_extent l_extent;
525 __u32 l_version[RES_VERSION_SIZE];
528 struct ldlm_request {
530 struct ldlm_lock_desc lock_desc;
531 struct lustre_handle lock_handle1;
532 struct lustre_handle lock_handle2;
538 __u64 lock_resource_name[RES_NAME_SIZE];
539 struct lustre_handle lock_handle;
540 struct ldlm_extent lock_extent; /* XXX make this policy 1 &2 */
541 __u64 lock_policy_res1;
542 __u64 lock_policy_res2;