ftl.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * Derived from (and probably identical to):
  3. * ftl.h 1.7 1999/10/25 20:23:17
  4. *
  5. * The contents of this file are subject to the Mozilla Public License
  6. * Version 1.1 (the "License"); you may not use this file except in
  7. * compliance with the License. You may obtain a copy of the License
  8. * at http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS"
  11. * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
  12. * the License for the specific language governing rights and
  13. * limitations under the License.
  14. *
  15. * The initial developer of the original code is David A. Hinds
  16. * <[email protected]>. Portions created by David A. Hinds
  17. * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
  18. *
  19. * Alternatively, the contents of this file may be used under the
  20. * terms of the GNU General Public License version 2 (the "GPL"), in
  21. * which case the provisions of the GPL are applicable instead of the
  22. * above. If you wish to allow the use of your version of this file
  23. * only under the terms of the GPL and not to allow others to use
  24. * your version of this file under the MPL, indicate your decision by
  25. * deleting the provisions above and replace them with the notice and
  26. * other provisions required by the GPL. If you do not delete the
  27. * provisions above, a recipient may use your version of this file
  28. * under either the MPL or the GPL.
  29. */
  30. #ifndef _LINUX_FTL_H
  31. #define _LINUX_FTL_H
  32. typedef struct erase_unit_header_t {
  33. uint8_t LinkTargetTuple[5];
  34. uint8_t DataOrgTuple[10];
  35. uint8_t NumTransferUnits;
  36. uint32_t EraseCount;
  37. uint16_t LogicalEUN;
  38. uint8_t BlockSize;
  39. uint8_t EraseUnitSize;
  40. uint16_t FirstPhysicalEUN;
  41. uint16_t NumEraseUnits;
  42. uint32_t FormattedSize;
  43. uint32_t FirstVMAddress;
  44. uint16_t NumVMPages;
  45. uint8_t Flags;
  46. uint8_t Code;
  47. uint32_t SerialNumber;
  48. uint32_t AltEUHOffset;
  49. uint32_t BAMOffset;
  50. uint8_t Reserved[12];
  51. uint8_t EndTuple[2];
  52. } erase_unit_header_t;
  53. /* Flags in erase_unit_header_t */
  54. #define HIDDEN_AREA 0x01
  55. #define REVERSE_POLARITY 0x02
  56. #define DOUBLE_BAI 0x04
  57. /* Definitions for block allocation information */
  58. #define BLOCK_FREE(b) ((b) == 0xffffffff)
  59. #define BLOCK_DELETED(b) (((b) == 0) || ((b) == 0xfffffffe))
  60. #define BLOCK_TYPE(b) ((b) & 0x7f)
  61. #define BLOCK_ADDRESS(b) ((b) & ~0x7f)
  62. #define BLOCK_NUMBER(b) ((b) >> 9)
  63. #define BLOCK_CONTROL 0x30
  64. #define BLOCK_DATA 0x40
  65. #define BLOCK_REPLACEMENT 0x60
  66. #define BLOCK_BAD 0x70
  67. #endif /* _LINUX_FTL_H */