rbd_types.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. /*
  16. * rbd image 'foo' consists of objects
  17. * foo.rbd - image metadata
  18. * foo.00000000
  19. * foo.00000001
  20. * ... - data
  21. */
  22. #define RBD_SUFFIX ".rbd"
  23. #define RBD_DIRECTORY "rbd_directory"
  24. #define RBD_INFO "rbd_info"
  25. #define RBD_DEFAULT_OBJ_ORDER 22 /* 4MB */
  26. #define RBD_MIN_OBJ_ORDER 16
  27. #define RBD_MAX_OBJ_ORDER 30
  28. #define RBD_MAX_OBJ_NAME_LEN 96
  29. #define RBD_MAX_SEG_NAME_LEN 128
  30. #define RBD_COMP_NONE 0
  31. #define RBD_CRYPT_NONE 0
  32. #define RBD_HEADER_TEXT "<<< Rados Block Device Image >>>\n"
  33. #define RBD_HEADER_SIGNATURE "RBD"
  34. #define RBD_HEADER_VERSION "001.005"
  35. struct rbd_info {
  36. __le64 max_id;
  37. } __attribute__ ((packed));
  38. struct rbd_image_snap_ondisk {
  39. __le64 id;
  40. __le64 image_size;
  41. } __attribute__((packed));
  42. struct rbd_image_header_ondisk {
  43. char text[40];
  44. char block_name[24];
  45. char signature[4];
  46. char version[8];
  47. struct {
  48. __u8 order;
  49. __u8 crypt_type;
  50. __u8 comp_type;
  51. __u8 unused;
  52. } __attribute__((packed)) options;
  53. __le64 image_size;
  54. __le64 snap_seq;
  55. __le32 snap_count;
  56. __le32 reserved;
  57. __le64 snap_names_len;
  58. struct rbd_image_snap_ondisk snaps[0];
  59. } __attribute__((packed));
  60. #endif