rbd_types.h 1.9 KB

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