| 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 | |
| 24 | #ifndef __SEAMA_HEADER_FILE__ |
| 25 | #define __SEAMA_HEADER_FILE__ |
| 26 | |
| 27 | #include <stdint.h> |
| 28 | |
| 29 | #define SEAMA_MAGIC 0x5EA3A417 |
| 30 | |
| 31 | /* |
| 32 | * SEAMA looks like the following map. |
| 33 | * All the data of the header should be in network byte order. |
| 34 | * |
| 35 | * +-------------+-------------+------------ |
| 36 | * | SEAMA magic | ^ |
| 37 | * +-------------+-------------+ | |
| 38 | * | reserved | meta size | | |
| 39 | * +-------------+-------------+ header |
| 40 | * | image size (0 bytes) | | |
| 41 | * +-------------+-------------+ | |
| 42 | * ~ Meta data ~ v |
| 43 | * +-------------+-------------+------------ |
| 44 | * | SEAMA magic | ^ ^ |
| 45 | * +-------------+-------------+ | | |
| 46 | * | reserved | meta size | | | |
| 47 | * +-------------+-------------+ | | |
| 48 | * | image size | | | |
| 49 | * +-------------+-------------+ header | |
| 50 | * | | | | |
| 51 | * | 16 bytes of MD5 digest | | | |
| 52 | * | | | | |
| 53 | * | | | | |
| 54 | * +-------------+-------------+ | | |
| 55 | * ~ Meta data ~ v | |
| 56 | * +-------------+-------------+------- | |
| 57 | * | | | |
| 58 | * | Image of the 1st entity | | |
| 59 | * ~ ~ 1st entity |
| 60 | * | | | |
| 61 | * | | v |
| 62 | * +-------------+-------------+------------- |
| 63 | * | SEAMA magic | ^ ^ |
| 64 | * +-------------+-------------+ | | |
| 65 | * | reserved | meta size | | | |
| 66 | * +-------------+-------------+ | | |
| 67 | * | image size | | | |
| 68 | * +-------------+-------------+ header | |
| 69 | * | | | | |
| 70 | * | 16 bytes of MD5 digest | | | |
| 71 | * | | | | |
| 72 | * | | | | |
| 73 | * +-------------+-------------+ | | |
| 74 | * ~ Meta data ~ v | |
| 75 | * +-------------+-------------+------- | |
| 76 | * | | | |
| 77 | * | Image of the 2nd entity | | |
| 78 | * ~ ~ 2nd entity |
| 79 | * | | | |
| 80 | * | | v |
| 81 | * +-------------+-------------+------------- |
| 82 | */ |
| 83 | |
| 84 | |
| 85 | /* |
| 86 | * SEAMA header |
| 87 | * |
| 88 | * |<-------- 32 bits -------->| |
| 89 | * +-------------+-------------+ |
| 90 | * | SEAMA magic | |
| 91 | * +-------------+-------------+ |
| 92 | * | reserved | meta size | |
| 93 | * +-------------+-------------+ |
| 94 | * | image size | |
| 95 | * +-------------+-------------+ |
| 96 | */ |
| 97 | /* seama header */ |
| 98 | typedef struct seama_hdr seamahdr_t; |
| 99 | struct seama_hdr |
| 100 | { |
| 101 | uint32_t magic; /* should always be SEAMA_MAGIC. */ |
| 102 | uint16_t reserved; /* reserved for */ |
| 103 | uint16_t metasize; /* size of the META data */ |
| 104 | uint32_t size; /* size of the image */ |
| 105 | } __attribute__ ((packed)); |
| 106 | |
| 107 | |
| 108 | #endif |
| 109 | |