nftl.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Copyright © 1999-2010 David Woodhouse <[email protected]>
  4. */
  5. #ifndef __MTD_NFTL_H__
  6. #define __MTD_NFTL_H__
  7. #include <linux/mtd/mtd.h>
  8. #include <linux/mtd/blktrans.h>
  9. #include <mtd/nftl-user.h>
  10. /* these info are used in ReplUnitTable */
  11. #define BLOCK_NIL 0xffff /* last block of a chain */
  12. #define BLOCK_FREE 0xfffe /* free block */
  13. #define BLOCK_NOTEXPLORED 0xfffd /* non explored block, only used during mounting */
  14. #define BLOCK_RESERVED 0xfffc /* bios block or bad block */
  15. struct NFTLrecord {
  16. struct mtd_blktrans_dev mbd;
  17. __u16 MediaUnit, SpareMediaUnit;
  18. __u32 EraseSize;
  19. struct NFTLMediaHeader MediaHdr;
  20. int usecount;
  21. unsigned char heads;
  22. unsigned char sectors;
  23. unsigned short cylinders;
  24. __u16 numvunits;
  25. __u16 lastEUN; /* should be suppressed */
  26. __u16 numfreeEUNs;
  27. __u16 LastFreeEUN; /* To speed up finding a free EUN */
  28. int head,sect,cyl;
  29. __u16 *EUNtable; /* [numvunits]: First EUN for each virtual unit */
  30. __u16 *ReplUnitTable; /* [numEUNs]: ReplUnitNumber for each */
  31. unsigned int nb_blocks; /* number of physical blocks */
  32. unsigned int nb_boot_blocks; /* number of blocks used by the bios */
  33. struct erase_info instr;
  34. };
  35. int NFTL_mount(struct NFTLrecord *s);
  36. int NFTL_formatblock(struct NFTLrecord *s, int block);
  37. int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
  38. size_t *retlen, uint8_t *buf);
  39. int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
  40. size_t *retlen, uint8_t *buf);
  41. #ifndef NFTL_MAJOR
  42. #define NFTL_MAJOR 93
  43. #endif
  44. #define MAX_NFTLS 16
  45. #define MAX_SECTORS_PER_UNIT 64
  46. #define NFTL_PARTN_BITS 4
  47. #endif /* __MTD_NFTL_H__ */