Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
0004  */
0005 
0006 #ifndef __MTD_NFTL_H__
0007 #define __MTD_NFTL_H__
0008 
0009 #include <linux/mtd/mtd.h>
0010 #include <linux/mtd/blktrans.h>
0011 
0012 #include <mtd/nftl-user.h>
0013 
0014 /* these info are used in ReplUnitTable */
0015 #define BLOCK_NIL          0xffff /* last block of a chain */
0016 #define BLOCK_FREE         0xfffe /* free block */
0017 #define BLOCK_NOTEXPLORED  0xfffd /* non explored block, only used during mounting */
0018 #define BLOCK_RESERVED     0xfffc /* bios block or bad block */
0019 
0020 struct NFTLrecord {
0021     struct mtd_blktrans_dev mbd;
0022     __u16 MediaUnit, SpareMediaUnit;
0023     __u32 EraseSize;
0024     struct NFTLMediaHeader MediaHdr;
0025     int usecount;
0026     unsigned char heads;
0027     unsigned char sectors;
0028     unsigned short cylinders;
0029     __u16 numvunits;
0030     __u16 lastEUN;                  /* should be suppressed */
0031     __u16 numfreeEUNs;
0032     __u16 LastFreeEUN;      /* To speed up finding a free EUN */
0033     int head,sect,cyl;
0034     __u16 *EUNtable;        /* [numvunits]: First EUN for each virtual unit  */
0035     __u16 *ReplUnitTable;       /* [numEUNs]: ReplUnitNumber for each */
0036         unsigned int nb_blocks;     /* number of physical blocks */
0037         unsigned int nb_boot_blocks;    /* number of blocks used by the bios */
0038         struct erase_info instr;
0039 };
0040 
0041 int NFTL_mount(struct NFTLrecord *s);
0042 int NFTL_formatblock(struct NFTLrecord *s, int block);
0043 
0044 int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
0045           size_t *retlen, uint8_t *buf);
0046 int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
0047            size_t *retlen, uint8_t *buf);
0048 
0049 #ifndef NFTL_MAJOR
0050 #define NFTL_MAJOR 93
0051 #endif
0052 
0053 #define MAX_NFTLS 16
0054 #define MAX_SECTORS_PER_UNIT 64
0055 #define NFTL_PARTN_BITS 4
0056 
0057 #endif /* __MTD_NFTL_H__ */