nftl-user.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  17. *
  18. */
  19. #ifndef __MTD_NFTL_USER_H__
  20. #define __MTD_NFTL_USER_H__
  21. #include <linux/types.h>
  22. /* Block Control Information */
  23. struct nftl_bci {
  24. unsigned char ECCSig[6];
  25. __u8 Status;
  26. __u8 Status1;
  27. }__attribute__((packed));
  28. /* Unit Control Information */
  29. struct nftl_uci0 {
  30. __u16 VirtUnitNum;
  31. __u16 ReplUnitNum;
  32. __u16 SpareVirtUnitNum;
  33. __u16 SpareReplUnitNum;
  34. } __attribute__((packed));
  35. struct nftl_uci1 {
  36. __u32 WearInfo;
  37. __u16 EraseMark;
  38. __u16 EraseMark1;
  39. } __attribute__((packed));
  40. struct nftl_uci2 {
  41. __u16 FoldMark;
  42. __u16 FoldMark1;
  43. __u32 unused;
  44. } __attribute__((packed));
  45. union nftl_uci {
  46. struct nftl_uci0 a;
  47. struct nftl_uci1 b;
  48. struct nftl_uci2 c;
  49. };
  50. struct nftl_oob {
  51. struct nftl_bci b;
  52. union nftl_uci u;
  53. };
  54. /* NFTL Media Header */
  55. struct NFTLMediaHeader {
  56. char DataOrgID[6];
  57. __u16 NumEraseUnits;
  58. __u16 FirstPhysicalEUN;
  59. __u32 FormattedSize;
  60. unsigned char UnitSizeFactor;
  61. } __attribute__((packed));
  62. #define MAX_ERASE_ZONES (8192 - 512)
  63. #define ERASE_MARK 0x3c69
  64. #define SECTOR_FREE 0xff
  65. #define SECTOR_USED 0x55
  66. #define SECTOR_IGNORE 0x11
  67. #define SECTOR_DELETED 0x00
  68. #define FOLD_MARK_IN_PROGRESS 0x5555
  69. #define ZONE_GOOD 0xff
  70. #define ZONE_BAD_ORIGINAL 0
  71. #define ZONE_BAD_MARKED 7
  72. #endif /* __MTD_NFTL_USER_H__ */