linux/drivers/mtd/inftlcore.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * inftlcore.c -- Linux driver for Inverse Flash Translation Layer (INFTL)
 *
 * Copyright © 2002, Greg Ungerer ([email protected])
 *
 * Based heavily on the nftlcore.c code which is:
 * Copyright © 1999 Machine Vision Holdings, Inc.
 * Copyright © 1999 David Woodhouse <[email protected]>
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/kmod.h>
#include <linux/hdreg.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nftl.h>
#include <linux/mtd/inftl.h>
#include <linux/mtd/rawnand.h>
#include <linux/uaccess.h>
#include <asm/errno.h>
#include <asm/io.h>

/*
 * Maximum number of loops while examining next block, to have a
 * chance to detect consistency problems (they should never happen
 * because of the checks done in the mounting.
 */
#define MAX_LOOPS

static void inftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
{}

static void inftl_remove_dev(struct mtd_blktrans_dev *dev)
{}

/*
 * Actual INFTL access routines.
 */

/*
 * Read oob data from flash
 */
int inftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len,
		   size_t *retlen, uint8_t *buf)
{}

/*
 * Write oob data to flash
 */
int inftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len,
		    size_t *retlen, uint8_t *buf)
{}

/*
 * Write data and oob to flash
 */
static int inftl_write(struct mtd_info *mtd, loff_t offs, size_t len,
		       size_t *retlen, uint8_t *buf, uint8_t *oob)
{}

/*
 * INFTL_findfreeblock: Find a free Erase Unit on the INFTL partition.
 *	This function is used when the give Virtual Unit Chain.
 */
static u16 INFTL_findfreeblock(struct INFTLrecord *inftl, int desperate)
{}

static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned pendingblock)
{}

static u16 INFTL_makefreeblock(struct INFTLrecord *inftl, unsigned pendingblock)
{}

static int nrbits(unsigned int val, int bitcount)
{}

/*
 * INFTL_findwriteunit: Return the unit number into which we can write
 *                      for this block. Make it available if it isn't already.
 */
static inline u16 INFTL_findwriteunit(struct INFTLrecord *inftl, unsigned block)
{}

/*
 * Given a Virtual Unit Chain, see if it can be deleted, and if so do it.
 */
static void INFTL_trydeletechain(struct INFTLrecord *inftl, unsigned thisVUC)
{}

static int INFTL_deleteblock(struct INFTLrecord *inftl, unsigned block)
{}

static int inftl_writeblock(struct mtd_blktrans_dev *mbd, unsigned long block,
			    char *buffer)
{}

static int inftl_readblock(struct mtd_blktrans_dev *mbd, unsigned long block,
			   char *buffer)
{}

static int inftl_getgeo(struct mtd_blktrans_dev *dev, struct hd_geometry *geo)
{}

static struct mtd_blktrans_ops inftl_tr =;

module_mtd_blktrans();

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();