dospart.h 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. #ifndef FS_DOSPART_H_
  2. #define FS_DOSPART_H_
  3. /*
  4. * Copyright (C) 2005 by egnite Software GmbH. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  16. * contributors may be used to endorse or promote products derived
  17. * from this software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. */
  34. /*!
  35. * \file fs/dospart.h
  36. * \brief DOS partition table definitions.
  37. *
  38. * \verbatim
  39. *
  40. * $Log$
  41. * Revision 1.3 2008/08/11 07:00:19 haraldkipp
  42. * BSD types replaced by stdint types (feature request #1282721).
  43. *
  44. * Revision 1.2 2008/07/14 13:09:30 haraldkipp
  45. * Allow small MultiMedia Cards without partition table.
  46. *
  47. * Revision 1.1 2006/01/05 16:32:26 haraldkipp
  48. * First check-in.
  49. *
  50. *
  51. * \endverbatim
  52. */
  53. #include <sys/types.h>
  54. #include <stdint.h>
  55. /*!
  56. * \addtogroup xgPartition
  57. */
  58. /*@{*/
  59. /*!
  60. * \name Known partition types.
  61. */
  62. /*@{*/
  63. #define PTYPE_EMPTY 0x00
  64. #define PTYPE_FAT12 0x01
  65. #define PTYPE_FAT16 0x04
  66. #define PTYPE_DOS_EXT 0x05
  67. #define PTYPE_FAT16_BIG 0x06
  68. #define PTYPE_IFS 0x07
  69. #define PTYPE_OS2V1 0x08
  70. #define PTYPE_AIXDATA 0x09
  71. #define PTYPE_OS2BM 0x0A
  72. #define PTYPE_FAT32 0x0B
  73. #define PTYPE_FAT32_LBA 0x0C
  74. #define PTYPE_FAT16_LBA 0x0E
  75. #define PTYPE_EXT_LBA 0x0F
  76. #define PTYPE_OPUS 0x10
  77. #define PTYPE_FAT12_HIDDEN 0x11
  78. #define PTYPE_OEM 0x12
  79. #define PTYPE_FAT16_HIDDEN 0x14
  80. #define PTYPE_FAT16_BIGH 0x16
  81. #define PTYPE_IFS_HIDDEN 0x17
  82. #define PTYPE_AST_SLEEP 0x18
  83. #define PTYPE_FAT32_HIDDEN 0x1B
  84. #define PTYPE_FAT32_LBAH 0x1C
  85. #define PTYPE_FAT16_LBAH 0x1E
  86. #define PTYPE_DOS33_NEC 0x24
  87. #define PTYPE_JFS 0x35
  88. #define PTYPE_MINIX 0x41
  89. #define PTYPE_DYN 0x42
  90. #define PTYPE_UNIX_SYSV 0x63
  91. #define PTYPE_LINUX_SWAP 0x82
  92. #define PTYPE_LINUX 0x83
  93. #define PTYPE_PM_HIBERNATE 0x84
  94. #define PTYPE_LINUX_EXT 0x85
  95. #define PTYPE_FAT16_MULTI 0x86
  96. #define PTYPE_NTFS_MULTI 0x87
  97. #define PTYPE_LT_HIBERNATE 0xA0
  98. #define PTYPE_BSD 0xA5
  99. #define PTYPE_OPENBSD 0xA6
  100. #define PTYPE_MACOSX 0xA8
  101. #define PTYPE_NETBSD 0xA9
  102. #define PTYPE_MACOSX_BOOT 0xAB
  103. #define PTYPE_BSD_SWAP 0xB8
  104. #define PTYPE_CPM86 0xD8
  105. #define PTYPE_DATA 0xDA
  106. #define PTYPE_DRCPM 0xDB
  107. #define PTYPE_OEM_DELL 0xDE
  108. #define PTYPE_GPT 0xEE
  109. #define PTYPE_EFI 0xEF
  110. #define PTYPE_OEM_IBM 0xFE
  111. /*@}*/
  112. /*!
  113. * \brief Position of the type specifier in the partition boot record.
  114. *
  115. * We expect the letters 'F', 'A' and 'T' at this position.
  116. */
  117. #define DOSPART_TYPEPOS 54
  118. /*!
  119. * \brief Position of the partition table in the master boot record.
  120. */
  121. #define DOSPART_SECTORPOS 446
  122. /*!
  123. * \brief Position of the cookie in the boot sector.
  124. *
  125. * We expect the byte values 0x55 and 0xAA at this position.
  126. */
  127. #define DOSPART_MAGICPOS 510
  128. /*!
  129. * \brief Partition table entry.
  130. *
  131. * Multibyte values are little endian.
  132. */
  133. typedef struct NUT_PACKED_TYPE _DOSPART {
  134. /*! \brief Boot descriptor. */
  135. uint8_t part_state;
  136. /*! \brief Partition start. */
  137. uint8_t part_start[3];
  138. /*! \brief Partition type. See PTYPE_ definitions. */
  139. uint8_t part_type;
  140. /*! \brief Partition end. */
  141. uint8_t part_end[3];
  142. /*! \brief First linear block address of this partition. */
  143. uint32_t part_sect_offs;
  144. /*! \brief Partition size in sectors. */
  145. uint32_t part_sects;
  146. } DOSPART;
  147. /*@}*/
  148. #endif