Statistics
| Branch: | Revision:

root / block / rbd_types.h @ a74cdab4

History | View | Annotate | Download (1.7 kB)

1
/*
2
 * Ceph - scalable distributed file system
3
 *
4
 * Copyright (C) 2004-2010 Sage Weil <sage@newdream.net>
5
 *
6
 * This is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License version 2.1, as published by the Free Software
9
 * Foundation.  See file COPYING.LIB.
10
 *
11
 */
12

    
13
#ifndef CEPH_RBD_TYPES_H
14
#define CEPH_RBD_TYPES_H
15

    
16

    
17
/*
18
 * rbd image 'foo' consists of objects
19
 *   foo.rbd      - image metadata
20
 *   foo.00000000
21
 *   foo.00000001
22
 *   ...          - data
23
 */
24

    
25
#define RBD_SUFFIX              ".rbd"
26
#define RBD_DIRECTORY           "rbd_directory"
27
#define RBD_INFO                "rbd_info"
28

    
29
#define RBD_DEFAULT_OBJ_ORDER   22   /* 4MB */
30

    
31
#define RBD_MAX_OBJ_NAME_SIZE   96
32
#define RBD_MAX_BLOCK_NAME_SIZE 24
33
#define RBD_MAX_SEG_NAME_SIZE   128
34

    
35
#define RBD_COMP_NONE           0
36
#define RBD_CRYPT_NONE          0
37

    
38
#define RBD_HEADER_TEXT         "<<< Rados Block Device Image >>>\n"
39
#define RBD_HEADER_SIGNATURE    "RBD"
40
#define RBD_HEADER_VERSION      "001.005"
41

    
42
struct rbd_info {
43
    uint64_t max_id;
44
} __attribute__ ((packed));
45

    
46
struct rbd_obj_snap_ondisk {
47
    uint64_t id;
48
    uint64_t image_size;
49
} __attribute__((packed));
50

    
51
struct rbd_obj_header_ondisk {
52
    char text[40];
53
    char block_name[RBD_MAX_BLOCK_NAME_SIZE];
54
    char signature[4];
55
    char version[8];
56
    struct {
57
        uint8_t order;
58
        uint8_t crypt_type;
59
        uint8_t comp_type;
60
        uint8_t unused;
61
    } __attribute__((packed)) options;
62
    uint64_t image_size;
63
    uint64_t snap_seq;
64
    uint32_t snap_count;
65
    uint32_t reserved;
66
    uint64_t snap_names_len;
67
    struct rbd_obj_snap_ondisk snaps[0];
68
} __attribute__((packed));
69

    
70

    
71
#endif