seama.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * (SEA)ttle i(MA)ge is the image which used in project seattle.
  4. *
  5. * Created by David Hsieh <david_hsieh@alphanetworks.com>
  6. * Copyright (C) 2008-2009 Alpha Networks, Inc.
  7. *
  8. * This file is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either'
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * The GNU C Library is distributed in the hope that it will be useful,'
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with the GNU C Library; if not, write to the Free
  20. * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  21. * 02111-1307 USA.
  22. */
  23. #ifndef __SEAMA_HEADER_FILE__
  24. #define __SEAMA_HEADER_FILE__
  25. #include <stdint.h>
  26. #define SEAMA_MAGIC 0x5EA3A417
  27. /*
  28. * SEAMA looks like the following map.
  29. * All the data of the header should be in network byte order.
  30. *
  31. * +-------------+-------------+------------
  32. * | SEAMA magic | ^
  33. * +-------------+-------------+ |
  34. * | reserved | meta size | |
  35. * +-------------+-------------+ header
  36. * | image size (0 bytes) | |
  37. * +-------------+-------------+ |
  38. * ~ Meta data ~ v
  39. * +-------------+-------------+------------
  40. * | SEAMA magic | ^ ^
  41. * +-------------+-------------+ | |
  42. * | reserved | meta size | | |
  43. * +-------------+-------------+ | |
  44. * | image size | | |
  45. * +-------------+-------------+ header |
  46. * | | | |
  47. * | 16 bytes of MD5 digest | | |
  48. * | | | |
  49. * | | | |
  50. * +-------------+-------------+ | |
  51. * ~ Meta data ~ v |
  52. * +-------------+-------------+------- |
  53. * | | |
  54. * | Image of the 1st entity | |
  55. * ~ ~ 1st entity
  56. * | | |
  57. * | | v
  58. * +-------------+-------------+-------------
  59. * | SEAMA magic | ^ ^
  60. * +-------------+-------------+ | |
  61. * | reserved | meta size | | |
  62. * +-------------+-------------+ | |
  63. * | image size | | |
  64. * +-------------+-------------+ header |
  65. * | | | |
  66. * | 16 bytes of MD5 digest | | |
  67. * | | | |
  68. * | | | |
  69. * +-------------+-------------+ | |
  70. * ~ Meta data ~ v |
  71. * +-------------+-------------+------- |
  72. * | | |
  73. * | Image of the 2nd entity | |
  74. * ~ ~ 2nd entity
  75. * | | |
  76. * | | v
  77. * +-------------+-------------+-------------
  78. */
  79. /*
  80. * SEAMA header
  81. *
  82. * |<-------- 32 bits -------->|
  83. * +-------------+-------------+
  84. * | SEAMA magic |
  85. * +-------------+-------------+
  86. * | reserved | meta size |
  87. * +-------------+-------------+
  88. * | image size |
  89. * +-------------+-------------+
  90. */
  91. /* seama header */
  92. typedef struct seama_hdr seamahdr_t;
  93. struct seama_hdr
  94. {
  95. uint32_t magic; /* should always be SEAMA_MAGIC. */
  96. uint16_t reserved; /* reserved for */
  97. uint16_t metasize; /* size of the META data */
  98. uint32_t size; /* size of the image */
  99. } __attribute__ ((packed));
  100. #endif