linux/drivers/mtd/tests/torturetest.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2006-2008 Artem Bityutskiy
 * Copyright (C) 2006-2008 Jarkko Lavinen
 * Copyright (C) 2006-2008 Adrian Hunter
 *
 * Authors: Artem Bityutskiy, Jarkko Lavinen, Adria Hunter
 *
 * WARNING: this test program may kill your flash and your device. Do not
 * use it unless you know what you do. Authors are not responsible for any
 * damage caused by this program.
 */

#define pr_fmt(fmt)

#include <linux/init.h>
#include <linux/ktime.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/err.h>
#include <linux/mtd/mtd.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include "mtd_test.h"

#define RETRIES

static int eb =;
module_param(eb, int, S_IRUGO);
MODULE_PARM_DESC();

static int ebcnt =;
module_param(ebcnt, int, S_IRUGO);
MODULE_PARM_DESC();

static int pgcnt;
module_param(pgcnt, int, S_IRUGO);
MODULE_PARM_DESC();

static int dev =;
module_param(dev, int, S_IRUGO);
MODULE_PARM_DESC();

static int gran =;
module_param(gran, int, S_IRUGO);
MODULE_PARM_DESC();

static int check =;
module_param(check, int, S_IRUGO);
MODULE_PARM_DESC();

static unsigned int cycles_count;
module_param(cycles_count, uint, S_IRUGO);
MODULE_PARM_DESC();

static struct mtd_info *mtd;

/* This buffer contains 0x555555...0xAAAAAA... pattern */
static unsigned char *patt_5A5;
/* This buffer contains 0xAAAAAA...0x555555... pattern */
static unsigned char *patt_A5A;
/* This buffer contains all 0xFF bytes */
static unsigned char *patt_FF;
/* This a temporary buffer is use when checking data */
static unsigned char *check_buf;
/* How many erase cycles were done */
static unsigned int erase_cycles;

static int pgsize;
static ktime_t start, finish;

static void report_corrupt(unsigned char *read, unsigned char *written);

static inline void start_timing(void)
{}

static inline void stop_timing(void)
{}

/*
 * Check that the contents of eraseblock number @enbum is equivalent to the
 * @buf buffer.
 */
static inline int check_eraseblock(int ebnum, unsigned char *buf)
{}

static inline int write_pattern(int ebnum, void *buf)
{}

static int __init tort_init(void)
{}
module_init(tort_init);

static void __exit tort_exit(void)
{}
module_exit(tort_exit);

static int countdiffs(unsigned char *buf, unsigned char *check_buf,
		      unsigned offset, unsigned len, unsigned *bytesp,
		      unsigned *bitsp);
static void print_bufs(unsigned char *read, unsigned char *written, int start,
		       int len);

/*
 * Report the detailed information about how the read EB differs from what was
 * written.
 */
static void report_corrupt(unsigned char *read, unsigned char *written)
{}

static void print_bufs(unsigned char *read, unsigned char *written, int start,
		       int len)
{}

/*
 * Count the number of differing bytes and bits and return the first differing
 * offset.
 */
static int countdiffs(unsigned char *buf, unsigned char *check_buf,
		      unsigned offset, unsigned len, unsigned *bytesp,
		      unsigned *bitsp)
{}

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