// SPDX-License-Identifier: GPL-2.0-or-later /* * inftlmount.c -- INFTL mount code with extensive checks. * * Author: Greg Ungerer ([email protected]) * Copyright © 2002-2003, Greg Ungerer ([email protected]) * * Based heavily on the nftlmount.c code which is: * Author: Fabrice Bellard ([email protected]) * Copyright © 2000 Netgem S.A. */ #include <linux/kernel.h> #include <linux/module.h> #include <asm/errno.h> #include <asm/io.h> #include <linux/uaccess.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/mtd/mtd.h> #include <linux/mtd/nftl.h> #include <linux/mtd/inftl.h> /* * find_boot_record: Find the INFTL Media Header and its Spare copy which * contains the various device information of the INFTL partition and * Bad Unit Table. Update the PUtable[] table according to the Bad * Unit Table. PUtable[] is used for management of Erase Unit in * other routines in inftlcore.c and inftlmount.c. */ static int find_boot_record(struct INFTLrecord *inftl) { … } static int memcmpb(void *a, int c, int n) { … } /* * check_free_sector: check if a free sector is actually FREE, * i.e. All 0xff in data and oob area. */ static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address, int len, int check_oob) { … } /* * INFTL_format: format a Erase Unit by erasing ALL Erase Zones in the Erase * Unit and Update INFTL metadata. Each erase operation is * checked with check_free_sectors. * * Return: 0 when succeed, -1 on error. * * ToDo: 1. Is it necessary to check_free_sector after erasing ?? */ int INFTL_formatblock(struct INFTLrecord *inftl, int block) { … } /* * format_chain: Format an invalid Virtual Unit chain. It frees all the Erase * Units in a Virtual Unit Chain, i.e. all the units are disconnected. * * Since the chain is invalid then we will have to erase it from its * head (normally for INFTL we go from the oldest). But if it has a * loop then there is no oldest... */ static void format_chain(struct INFTLrecord *inftl, unsigned int first_block) { … } void INFTL_dumptables(struct INFTLrecord *s) { … } void INFTL_dumpVUchains(struct INFTLrecord *s) { … } int INFTL_mount(struct INFTLrecord *s) { … }