1 /* 2 * Ceph - scalable distributed file system 3 * 4 * Copyright (C) 2004-2010 Sage Weil <[email protected]> 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. 10 * 11 */ 12 13 #ifndef CEPH_RBD_TYPES_H 14 #define CEPH_RBD_TYPES_H 15 16 #include <linux/types.h> 17 18 /* For format version 2, rbd image 'foo' consists of objects 19 * rbd_id.foo - id of image 20 * rbd_header.<id> - image metadata 21 * rbd_data.<id>.0000000000000000 22 * rbd_data.<id>.0000000000000001 23 * ... - data 24 * Clients do not access header data directly in rbd format 2. 25 */ 26 27 #define RBD_HEADER_PREFIX "rbd_header." 28 #define RBD_DATA_PREFIX "rbd_data." 29 #define RBD_ID_PREFIX "rbd_id." 30 31 /* 32 * For format version 1, rbd image 'foo' consists of objects 33 * foo.rbd - image metadata 34 * rb.<idhi>.<idlo>.00000000 35 * rb.<idhi>.<idlo>.00000001 36 * ... - data 37 * There is no notion of a persistent image id in rbd format 1. 38 */ 39 40 #define RBD_SUFFIX ".rbd" 41 42 #define RBD_DIRECTORY "rbd_directory" 43 #define RBD_INFO "rbd_info" 44 45 #define RBD_DEFAULT_OBJ_ORDER 22 /* 4MB */ 46 #define RBD_MIN_OBJ_ORDER 16 47 #define RBD_MAX_OBJ_ORDER 30 48 49 #define RBD_MAX_SEG_NAME_LEN 128 50 51 #define RBD_COMP_NONE 0 52 #define RBD_CRYPT_NONE 0 53 54 #define RBD_HEADER_TEXT "<<< Rados Block Device Image >>>\n" 55 #define RBD_HEADER_SIGNATURE "RBD" 56 #define RBD_HEADER_VERSION "001.005" 57 58 struct rbd_image_snap_ondisk { 59 __le64 id; 60 __le64 image_size; 61 } __attribute__((packed)); 62 63 struct rbd_image_header_ondisk { 64 char text[40]; 65 char object_prefix[24]; 66 char signature[4]; 67 char version[8]; 68 struct { 69 __u8 order; 70 __u8 crypt_type; 71 __u8 comp_type; 72 __u8 unused; 73 } __attribute__((packed)) options; 74 __le64 image_size; 75 __le64 snap_seq; 76 __le32 snap_count; 77 __le32 reserved; 78 __le64 snap_names_len; 79 struct rbd_image_snap_ondisk snaps[0]; 80 } __attribute__((packed)); 81 82 83 #endif 84