1
2
3
4
5
6
7
8
9
10
11
12#ifndef CEPH_FS_H
13#define CEPH_FS_H
14
15#include <linux/ceph/msgr.h>
16#include <linux/ceph/rados.h>
17
18
19
20
21
22
23
24#define CEPH_OSDC_PROTOCOL 24
25#define CEPH_MDSC_PROTOCOL 32
26#define CEPH_MONC_PROTOCOL 15
27
28
29#define CEPH_INO_ROOT 1
30#define CEPH_INO_CEPH 2
31#define CEPH_INO_DOTDOT 3
32
33
34#define CEPH_MAX_MON 31
35
36
37
38
39struct ceph_file_layout {
40
41 __le32 fl_stripe_unit;
42
43 __le32 fl_stripe_count;
44 __le32 fl_object_size;
45
46 __le32 fl_cas_hash;
47
48
49 __le32 fl_object_stripe_unit;
50
51
52 __le32 fl_unused;
53 __le32 fl_pg_pool;
54} __attribute__ ((packed));
55
56#define ceph_file_layout_su(l) ((__s32)le32_to_cpu((l).fl_stripe_unit))
57#define ceph_file_layout_stripe_count(l) \
58 ((__s32)le32_to_cpu((l).fl_stripe_count))
59#define ceph_file_layout_object_size(l) ((__s32)le32_to_cpu((l).fl_object_size))
60#define ceph_file_layout_cas_hash(l) ((__s32)le32_to_cpu((l).fl_cas_hash))
61#define ceph_file_layout_object_su(l) \
62 ((__s32)le32_to_cpu((l).fl_object_stripe_unit))
63#define ceph_file_layout_pg_pool(l) \
64 ((__s32)le32_to_cpu((l).fl_pg_pool))
65
66static inline unsigned ceph_file_layout_stripe_width(struct ceph_file_layout *l)
67{
68 return le32_to_cpu(l->fl_stripe_unit) *
69 le32_to_cpu(l->fl_stripe_count);
70}
71
72
73static inline unsigned ceph_file_layout_period(struct ceph_file_layout *l)
74{
75 return le32_to_cpu(l->fl_object_size) *
76 le32_to_cpu(l->fl_stripe_count);
77}
78
79#define CEPH_MIN_STRIPE_UNIT 65536
80
81int ceph_file_layout_is_valid(const struct ceph_file_layout *layout);
82
83struct ceph_dir_layout {
84 __u8 dl_dir_hash;
85 __u8 dl_unused1;
86 __u16 dl_unused2;
87 __u32 dl_unused3;
88} __attribute__ ((packed));
89
90
91#define CEPH_CRYPTO_NONE 0x0
92#define CEPH_CRYPTO_AES 0x1
93
94#define CEPH_AES_IV "cephsageyudagreg"
95
96
97#define CEPH_AUTH_UNKNOWN 0x0
98#define CEPH_AUTH_NONE 0x1
99#define CEPH_AUTH_CEPHX 0x2
100
101#define CEPH_AUTH_UID_DEFAULT ((__u64) -1)
102
103
104
105
106
107
108
109
110
111
112
113#define CEPH_MSG_SHUTDOWN 1
114#define CEPH_MSG_PING 2
115
116
117#define CEPH_MSG_MON_MAP 4
118#define CEPH_MSG_MON_GET_MAP 5
119#define CEPH_MSG_STATFS 13
120#define CEPH_MSG_STATFS_REPLY 14
121#define CEPH_MSG_MON_SUBSCRIBE 15
122#define CEPH_MSG_MON_SUBSCRIBE_ACK 16
123#define CEPH_MSG_AUTH 17
124#define CEPH_MSG_AUTH_REPLY 18
125#define CEPH_MSG_MON_GET_VERSION 19
126#define CEPH_MSG_MON_GET_VERSION_REPLY 20
127
128
129#define CEPH_MSG_MDS_MAP 21
130
131#define CEPH_MSG_CLIENT_SESSION 22
132#define CEPH_MSG_CLIENT_RECONNECT 23
133
134#define CEPH_MSG_CLIENT_REQUEST 24
135#define CEPH_MSG_CLIENT_REQUEST_FORWARD 25
136#define CEPH_MSG_CLIENT_REPLY 26
137#define CEPH_MSG_CLIENT_CAPS 0x310
138#define CEPH_MSG_CLIENT_LEASE 0x311
139#define CEPH_MSG_CLIENT_SNAP 0x312
140#define CEPH_MSG_CLIENT_CAPRELEASE 0x313
141
142
143#define CEPH_MSG_POOLOP_REPLY 48
144#define CEPH_MSG_POOLOP 49
145
146
147
148#define CEPH_MSG_OSD_MAP 41
149#define CEPH_MSG_OSD_OP 42
150#define CEPH_MSG_OSD_OPREPLY 43
151#define CEPH_MSG_WATCH_NOTIFY 44
152
153
154
155enum {
156 WATCH_NOTIFY = 1,
157 WATCH_NOTIFY_COMPLETE = 2,
158};
159
160
161
162enum {
163 POOL_OP_CREATE = 0x01,
164 POOL_OP_DELETE = 0x02,
165 POOL_OP_AUID_CHANGE = 0x03,
166 POOL_OP_CREATE_SNAP = 0x11,
167 POOL_OP_DELETE_SNAP = 0x12,
168 POOL_OP_CREATE_UNMANAGED_SNAP = 0x21,
169 POOL_OP_DELETE_UNMANAGED_SNAP = 0x22,
170};
171
172struct ceph_mon_request_header {
173 __le64 have_version;
174 __le16 session_mon;
175 __le64 session_mon_tid;
176} __attribute__ ((packed));
177
178struct ceph_mon_statfs {
179 struct ceph_mon_request_header monhdr;
180 struct ceph_fsid fsid;
181} __attribute__ ((packed));
182
183struct ceph_statfs {
184 __le64 kb, kb_used, kb_avail;
185 __le64 num_objects;
186} __attribute__ ((packed));
187
188struct ceph_mon_statfs_reply {
189 struct ceph_fsid fsid;
190 __le64 version;
191 struct ceph_statfs st;
192} __attribute__ ((packed));
193
194const char *ceph_pool_op_name(int op);
195
196struct ceph_mon_poolop {
197 struct ceph_mon_request_header monhdr;
198 struct ceph_fsid fsid;
199 __le32 pool;
200 __le32 op;
201 __le64 auid;
202 __le64 snapid;
203 __le32 name_len;
204} __attribute__ ((packed));
205
206struct ceph_mon_poolop_reply {
207 struct ceph_mon_request_header monhdr;
208 struct ceph_fsid fsid;
209 __le32 reply_code;
210 __le32 epoch;
211 char has_data;
212 char data[0];
213} __attribute__ ((packed));
214
215struct ceph_mon_unmanaged_snap {
216 __le64 snapid;
217} __attribute__ ((packed));
218
219struct ceph_osd_getmap {
220 struct ceph_mon_request_header monhdr;
221 struct ceph_fsid fsid;
222 __le32 start;
223} __attribute__ ((packed));
224
225struct ceph_mds_getmap {
226 struct ceph_mon_request_header monhdr;
227 struct ceph_fsid fsid;
228} __attribute__ ((packed));
229
230struct ceph_client_mount {
231 struct ceph_mon_request_header monhdr;
232} __attribute__ ((packed));
233
234#define CEPH_SUBSCRIBE_ONETIME 1
235
236struct ceph_mon_subscribe_item {
237 __le64 have_version; __le64 have;
238 __u8 onetime;
239} __attribute__ ((packed));
240
241struct ceph_mon_subscribe_ack {
242 __le32 duration;
243 struct ceph_fsid fsid;
244} __attribute__ ((packed));
245
246
247
248
249#define CEPH_MDSMAP_DOWN (1<<0)
250
251
252
253
254
255
256#define CEPH_MDS_STATE_DNE 0
257#define CEPH_MDS_STATE_STOPPED -1
258
259#define CEPH_MDS_STATE_BOOT -4
260#define CEPH_MDS_STATE_STANDBY -5
261#define CEPH_MDS_STATE_CREATING -6
262#define CEPH_MDS_STATE_STARTING -7
263#define CEPH_MDS_STATE_STANDBY_REPLAY -8
264#define CEPH_MDS_STATE_REPLAYONCE -9
265
266#define CEPH_MDS_STATE_REPLAY 8
267#define CEPH_MDS_STATE_RESOLVE 9
268
269#define CEPH_MDS_STATE_RECONNECT 10
270#define CEPH_MDS_STATE_REJOIN 11
271#define CEPH_MDS_STATE_CLIENTREPLAY 12
272#define CEPH_MDS_STATE_ACTIVE 13
273#define CEPH_MDS_STATE_STOPPING 14
274
275extern const char *ceph_mds_state_name(int s);
276
277
278
279
280
281
282
283
284#define CEPH_LOCK_DVERSION 1
285#define CEPH_LOCK_DN 2
286#define CEPH_LOCK_ISNAP 16
287#define CEPH_LOCK_IVERSION 32
288#define CEPH_LOCK_IFILE 64
289#define CEPH_LOCK_IAUTH 128
290#define CEPH_LOCK_ILINK 256
291#define CEPH_LOCK_IDFT 512
292#define CEPH_LOCK_INEST 1024
293#define CEPH_LOCK_IXATTR 2048
294#define CEPH_LOCK_IFLOCK 4096
295#define CEPH_LOCK_INO 8192
296#define CEPH_LOCK_IPOLICY 16384
297
298
299enum {
300 CEPH_SESSION_REQUEST_OPEN,
301 CEPH_SESSION_OPEN,
302 CEPH_SESSION_REQUEST_CLOSE,
303 CEPH_SESSION_CLOSE,
304 CEPH_SESSION_REQUEST_RENEWCAPS,
305 CEPH_SESSION_RENEWCAPS,
306 CEPH_SESSION_STALE,
307 CEPH_SESSION_RECALL_STATE,
308 CEPH_SESSION_FLUSHMSG,
309 CEPH_SESSION_FLUSHMSG_ACK,
310};
311
312extern const char *ceph_session_op_name(int op);
313
314struct ceph_mds_session_head {
315 __le32 op;
316 __le64 seq;
317 struct ceph_timespec stamp;
318 __le32 max_caps, max_leases;
319} __attribute__ ((packed));
320
321
322
323
324
325
326
327
328#define CEPH_MDS_OP_WRITE 0x001000
329enum {
330 CEPH_MDS_OP_LOOKUP = 0x00100,
331 CEPH_MDS_OP_GETATTR = 0x00101,
332 CEPH_MDS_OP_LOOKUPHASH = 0x00102,
333 CEPH_MDS_OP_LOOKUPPARENT = 0x00103,
334 CEPH_MDS_OP_LOOKUPINO = 0x00104,
335 CEPH_MDS_OP_LOOKUPNAME = 0x00105,
336
337 CEPH_MDS_OP_SETXATTR = 0x01105,
338 CEPH_MDS_OP_RMXATTR = 0x01106,
339 CEPH_MDS_OP_SETLAYOUT = 0x01107,
340 CEPH_MDS_OP_SETATTR = 0x01108,
341 CEPH_MDS_OP_SETFILELOCK= 0x01109,
342 CEPH_MDS_OP_GETFILELOCK= 0x00110,
343 CEPH_MDS_OP_SETDIRLAYOUT=0x0110a,
344
345 CEPH_MDS_OP_MKNOD = 0x01201,
346 CEPH_MDS_OP_LINK = 0x01202,
347 CEPH_MDS_OP_UNLINK = 0x01203,
348 CEPH_MDS_OP_RENAME = 0x01204,
349 CEPH_MDS_OP_MKDIR = 0x01220,
350 CEPH_MDS_OP_RMDIR = 0x01221,
351 CEPH_MDS_OP_SYMLINK = 0x01222,
352
353 CEPH_MDS_OP_CREATE = 0x01301,
354 CEPH_MDS_OP_OPEN = 0x00302,
355 CEPH_MDS_OP_READDIR = 0x00305,
356
357 CEPH_MDS_OP_LOOKUPSNAP = 0x00400,
358 CEPH_MDS_OP_MKSNAP = 0x01400,
359 CEPH_MDS_OP_RMSNAP = 0x01401,
360 CEPH_MDS_OP_LSSNAP = 0x00402,
361};
362
363extern const char *ceph_mds_op_name(int op);
364
365
366#define CEPH_SETATTR_MODE 1
367#define CEPH_SETATTR_UID 2
368#define CEPH_SETATTR_GID 4
369#define CEPH_SETATTR_MTIME 8
370#define CEPH_SETATTR_ATIME 16
371#define CEPH_SETATTR_SIZE 32
372#define CEPH_SETATTR_CTIME 64
373
374
375
376
377#define CEPH_XATTR_CREATE (1 << 0)
378#define CEPH_XATTR_REPLACE (1 << 1)
379#define CEPH_XATTR_REMOVE (1 << 31)
380
381union ceph_mds_request_args {
382 struct {
383 __le32 mask;
384 } __attribute__ ((packed)) getattr;
385 struct {
386 __le32 mode;
387 __le32 uid;
388 __le32 gid;
389 struct ceph_timespec mtime;
390 struct ceph_timespec atime;
391 __le64 size, old_size;
392 __le32 mask;
393 } __attribute__ ((packed)) setattr;
394 struct {
395 __le32 frag;
396 __le32 max_entries;
397 __le32 max_bytes;
398 } __attribute__ ((packed)) readdir;
399 struct {
400 __le32 mode;
401 __le32 rdev;
402 } __attribute__ ((packed)) mknod;
403 struct {
404 __le32 mode;
405 } __attribute__ ((packed)) mkdir;
406 struct {
407 __le32 flags;
408 __le32 mode;
409 __le32 stripe_unit;
410 __le32 stripe_count;
411 __le32 object_size;
412 __le32 file_replication;
413 __le32 unused;
414 } __attribute__ ((packed)) open;
415 struct {
416 __le32 flags;
417 } __attribute__ ((packed)) setxattr;
418 struct {
419 struct ceph_file_layout layout;
420 } __attribute__ ((packed)) setlayout;
421 struct {
422 __u8 rule;
423 __u8 type;
424 __le64 owner;
425 __le64 pid;
426 __le64 start;
427 __le64 length;
428 __u8 wait;
429 } __attribute__ ((packed)) filelock_change;
430} __attribute__ ((packed));
431
432#define CEPH_MDS_FLAG_REPLAY 1
433#define CEPH_MDS_FLAG_WANT_DENTRY 2
434
435struct ceph_mds_request_head {
436 __le64 oldest_client_tid;
437 __le32 mdsmap_epoch;
438 __le32 flags;
439 __u8 num_retry, num_fwd;
440 __le16 num_releases;
441 __le32 op;
442 __le32 caller_uid, caller_gid;
443 __le64 ino;
444
445 union ceph_mds_request_args args;
446} __attribute__ ((packed));
447
448
449struct ceph_mds_request_release {
450 __le64 ino, cap_id;
451 __le32 caps, wanted;
452 __le32 seq, issue_seq, mseq;
453 __le32 dname_seq;
454 __le32 dname_len;
455} __attribute__ ((packed));
456
457
458struct ceph_mds_reply_head {
459 __le32 op;
460 __le32 result;
461 __le32 mdsmap_epoch;
462 __u8 safe;
463 __u8 is_dentry, is_target;
464
465} __attribute__ ((packed));
466
467
468struct ceph_frag_tree_split {
469 __le32 frag;
470 __le32 by;
471} __attribute__ ((packed));
472
473struct ceph_frag_tree_head {
474 __le32 nsplits;
475 struct ceph_frag_tree_split splits[];
476} __attribute__ ((packed));
477
478
479struct ceph_mds_reply_cap {
480 __le32 caps, wanted;
481 __le64 cap_id;
482 __le32 seq, mseq;
483 __le64 realm;
484 __u8 flags;
485} __attribute__ ((packed));
486
487#define CEPH_CAP_FLAG_AUTH (1 << 0)
488#define CEPH_CAP_FLAG_RELEASE (1 << 1)
489
490
491struct ceph_mds_reply_inode {
492 __le64 ino;
493 __le64 snapid;
494 __le32 rdev;
495 __le64 version;
496 __le64 xattr_version;
497 struct ceph_mds_reply_cap cap;
498 struct ceph_file_layout layout;
499 struct ceph_timespec ctime, mtime, atime;
500 __le32 time_warp_seq;
501 __le64 size, max_size, truncate_size;
502 __le32 truncate_seq;
503 __le32 mode, uid, gid;
504 __le32 nlink;
505 __le64 files, subdirs, rbytes, rfiles, rsubdirs;
506 struct ceph_timespec rctime;
507 struct ceph_frag_tree_head fragtree;
508} __attribute__ ((packed));
509
510
511
512struct ceph_mds_reply_lease {
513 __le16 mask;
514 __le32 duration_ms;
515 __le32 seq;
516} __attribute__ ((packed));
517
518struct ceph_mds_reply_dirfrag {
519 __le32 frag;
520 __le32 auth;
521 __le32 ndist;
522 __le32 dist[];
523} __attribute__ ((packed));
524
525#define CEPH_LOCK_FCNTL 1
526#define CEPH_LOCK_FLOCK 2
527
528#define CEPH_LOCK_SHARED 1
529#define CEPH_LOCK_EXCL 2
530#define CEPH_LOCK_UNLOCK 4
531
532struct ceph_filelock {
533 __le64 start;
534 __le64 length;
535 __le64 client;
536 __le64 owner;
537 __le64 pid;
538 __u8 type;
539} __attribute__ ((packed));
540
541
542
543#define CEPH_FILE_MODE_PIN 0
544#define CEPH_FILE_MODE_RD 1
545#define CEPH_FILE_MODE_WR 2
546#define CEPH_FILE_MODE_RDWR 3
547#define CEPH_FILE_MODE_LAZY 4
548#define CEPH_FILE_MODE_NUM 8
549
550int ceph_flags_to_mode(int flags);
551
552
553
554#define CEPH_CAP_PIN 1
555
556
557#define CEPH_CAP_GSHARED 1
558#define CEPH_CAP_GEXCL 2
559#define CEPH_CAP_GCACHE 4
560#define CEPH_CAP_GRD 8
561#define CEPH_CAP_GWR 16
562#define CEPH_CAP_GBUFFER 32
563#define CEPH_CAP_GWREXTEND 64
564#define CEPH_CAP_GLAZYIO 128
565
566#define CEPH_CAP_SIMPLE_BITS 2
567#define CEPH_CAP_FILE_BITS 8
568
569
570#define CEPH_CAP_SAUTH 2
571#define CEPH_CAP_SLINK 4
572#define CEPH_CAP_SXATTR 6
573#define CEPH_CAP_SFILE 8
574#define CEPH_CAP_SFLOCK 20
575
576#define CEPH_CAP_BITS 22
577
578
579#define CEPH_CAP_AUTH_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SAUTH)
580#define CEPH_CAP_AUTH_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SAUTH)
581#define CEPH_CAP_LINK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SLINK)
582#define CEPH_CAP_LINK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SLINK)
583#define CEPH_CAP_XATTR_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SXATTR)
584#define CEPH_CAP_XATTR_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SXATTR)
585#define CEPH_CAP_FILE(x) (x << CEPH_CAP_SFILE)
586#define CEPH_CAP_FILE_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFILE)
587#define CEPH_CAP_FILE_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFILE)
588#define CEPH_CAP_FILE_CACHE (CEPH_CAP_GCACHE << CEPH_CAP_SFILE)
589#define CEPH_CAP_FILE_RD (CEPH_CAP_GRD << CEPH_CAP_SFILE)
590#define CEPH_CAP_FILE_WR (CEPH_CAP_GWR << CEPH_CAP_SFILE)
591#define CEPH_CAP_FILE_BUFFER (CEPH_CAP_GBUFFER << CEPH_CAP_SFILE)
592#define CEPH_CAP_FILE_WREXTEND (CEPH_CAP_GWREXTEND << CEPH_CAP_SFILE)
593#define CEPH_CAP_FILE_LAZYIO (CEPH_CAP_GLAZYIO << CEPH_CAP_SFILE)
594#define CEPH_CAP_FLOCK_SHARED (CEPH_CAP_GSHARED << CEPH_CAP_SFLOCK)
595#define CEPH_CAP_FLOCK_EXCL (CEPH_CAP_GEXCL << CEPH_CAP_SFLOCK)
596
597
598
599#define CEPH_STAT_CAP_INODE CEPH_CAP_PIN
600#define CEPH_STAT_CAP_TYPE CEPH_CAP_PIN
601#define CEPH_STAT_CAP_SYMLINK CEPH_CAP_PIN
602#define CEPH_STAT_CAP_UID CEPH_CAP_AUTH_SHARED
603#define CEPH_STAT_CAP_GID CEPH_CAP_AUTH_SHARED
604#define CEPH_STAT_CAP_MODE CEPH_CAP_AUTH_SHARED
605#define CEPH_STAT_CAP_NLINK CEPH_CAP_LINK_SHARED
606#define CEPH_STAT_CAP_LAYOUT CEPH_CAP_FILE_SHARED
607#define CEPH_STAT_CAP_MTIME CEPH_CAP_FILE_SHARED
608#define CEPH_STAT_CAP_SIZE CEPH_CAP_FILE_SHARED
609#define CEPH_STAT_CAP_ATIME CEPH_CAP_FILE_SHARED
610#define CEPH_STAT_CAP_XATTR CEPH_CAP_XATTR_SHARED
611#define CEPH_STAT_CAP_INODE_ALL (CEPH_CAP_PIN | \
612 CEPH_CAP_AUTH_SHARED | \
613 CEPH_CAP_LINK_SHARED | \
614 CEPH_CAP_FILE_SHARED | \
615 CEPH_CAP_XATTR_SHARED)
616
617#define CEPH_CAP_ANY_SHARED (CEPH_CAP_AUTH_SHARED | \
618 CEPH_CAP_LINK_SHARED | \
619 CEPH_CAP_XATTR_SHARED | \
620 CEPH_CAP_FILE_SHARED)
621#define CEPH_CAP_ANY_RD (CEPH_CAP_ANY_SHARED | CEPH_CAP_FILE_RD | \
622 CEPH_CAP_FILE_CACHE)
623
624#define CEPH_CAP_ANY_EXCL (CEPH_CAP_AUTH_EXCL | \
625 CEPH_CAP_LINK_EXCL | \
626 CEPH_CAP_XATTR_EXCL | \
627 CEPH_CAP_FILE_EXCL)
628#define CEPH_CAP_ANY_FILE_RD (CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE | \
629 CEPH_CAP_FILE_SHARED)
630#define CEPH_CAP_ANY_FILE_WR (CEPH_CAP_FILE_WR | CEPH_CAP_FILE_BUFFER | \
631 CEPH_CAP_FILE_EXCL)
632#define CEPH_CAP_ANY_WR (CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_FILE_WR)
633#define CEPH_CAP_ANY (CEPH_CAP_ANY_RD | CEPH_CAP_ANY_EXCL | \
634 CEPH_CAP_ANY_FILE_WR | CEPH_CAP_FILE_LAZYIO | \
635 CEPH_CAP_PIN)
636
637#define CEPH_CAP_LOCKS (CEPH_LOCK_IFILE | CEPH_LOCK_IAUTH | CEPH_LOCK_ILINK | \
638 CEPH_LOCK_IXATTR)
639
640int ceph_caps_for_mode(int mode);
641
642enum {
643 CEPH_CAP_OP_GRANT,
644 CEPH_CAP_OP_REVOKE,
645 CEPH_CAP_OP_TRUNC,
646 CEPH_CAP_OP_EXPORT,
647 CEPH_CAP_OP_IMPORT,
648 CEPH_CAP_OP_UPDATE,
649 CEPH_CAP_OP_DROP,
650 CEPH_CAP_OP_FLUSH,
651 CEPH_CAP_OP_FLUSH_ACK,
652 CEPH_CAP_OP_FLUSHSNAP,
653 CEPH_CAP_OP_FLUSHSNAP_ACK,
654 CEPH_CAP_OP_RELEASE,
655 CEPH_CAP_OP_RENEW,
656};
657
658extern const char *ceph_cap_op_name(int op);
659
660
661
662
663struct ceph_mds_caps {
664 __le32 op;
665 __le64 ino, realm;
666 __le64 cap_id;
667 __le32 seq, issue_seq;
668 __le32 caps, wanted, dirty;
669 __le32 migrate_seq;
670 __le64 snap_follows;
671 __le32 snap_trace_len;
672
673
674 __le32 uid, gid, mode;
675
676
677 __le32 nlink;
678
679
680 __le32 xattr_len;
681 __le64 xattr_version;
682
683
684 __le64 size, max_size, truncate_size;
685 __le32 truncate_seq;
686 struct ceph_timespec mtime, atime, ctime;
687 struct ceph_file_layout layout;
688 __le32 time_warp_seq;
689} __attribute__ ((packed));
690
691struct ceph_mds_cap_peer {
692 __le64 cap_id;
693 __le32 seq;
694 __le32 mseq;
695 __le32 mds;
696 __u8 flags;
697} __attribute__ ((packed));
698
699
700struct ceph_mds_cap_release {
701 __le32 num;
702} __attribute__ ((packed));
703
704struct ceph_mds_cap_item {
705 __le64 ino;
706 __le64 cap_id;
707 __le32 migrate_seq, seq;
708} __attribute__ ((packed));
709
710#define CEPH_MDS_LEASE_REVOKE 1
711#define CEPH_MDS_LEASE_RELEASE 2
712#define CEPH_MDS_LEASE_RENEW 3
713#define CEPH_MDS_LEASE_REVOKE_ACK 4
714
715extern const char *ceph_lease_op_name(int o);
716
717
718struct ceph_mds_lease {
719 __u8 action;
720 __le16 mask;
721 __le64 ino;
722 __le64 first, last;
723 __le32 seq;
724 __le32 duration_ms;
725} __attribute__ ((packed));
726
727
728
729struct ceph_mds_cap_reconnect {
730 __le64 cap_id;
731 __le32 wanted;
732 __le32 issued;
733 __le64 snaprealm;
734 __le64 pathbase;
735 __le32 flock_len;
736} __attribute__ ((packed));
737
738
739struct ceph_mds_cap_reconnect_v1 {
740 __le64 cap_id;
741 __le32 wanted;
742 __le32 issued;
743 __le64 size;
744 struct ceph_timespec mtime, atime;
745 __le64 snaprealm;
746 __le64 pathbase;
747} __attribute__ ((packed));
748
749struct ceph_mds_snaprealm_reconnect {
750 __le64 ino;
751 __le64 seq;
752 __le64 parent;
753} __attribute__ ((packed));
754
755
756
757
758enum {
759 CEPH_SNAP_OP_UPDATE,
760 CEPH_SNAP_OP_CREATE,
761 CEPH_SNAP_OP_DESTROY,
762 CEPH_SNAP_OP_SPLIT,
763};
764
765extern const char *ceph_snap_op_name(int o);
766
767
768struct ceph_mds_snap_head {
769 __le32 op;
770 __le64 split;
771 __le32 num_split_inos;
772 __le32 num_split_realms;
773 __le32 trace_len;
774} __attribute__ ((packed));
775
776
777
778
779
780struct ceph_mds_snap_realm {
781 __le64 ino;
782 __le64 created;
783 __le64 parent;
784 __le64 parent_since;
785 __le64 seq;
786 __le32 num_snaps;
787 __le32 num_prior_parent_snaps;
788} __attribute__ ((packed));
789
790
791#endif
792