linux/drivers/md/dm-flakey.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2003 Sistina Software (UK) Limited.
 * Copyright (C) 2004, 2010-2011 Red Hat, Inc. All rights reserved.
 *
 * This file is released under the GPL.
 */

#include <linux/device-mapper.h>

#include <linux/module.h>
#include <linux/init.h>
#include <linux/blkdev.h>
#include <linux/bio.h>
#include <linux/slab.h>

#define DM_MSG_PREFIX

#define PROBABILITY_BASE

#define all_corrupt_bio_flags_match(bio, fc)

/*
 * Flakey: Used for testing only, simulates intermittent,
 * catastrophic device failure.
 */
struct flakey_c {};

enum feature_flag_bits {};

struct per_bio_data {};

static int parse_features(struct dm_arg_set *as, struct flakey_c *fc,
			  struct dm_target *ti)
{}

/*
 * Construct a flakey mapping:
 * <dev_path> <offset> <up interval> <down interval> [<#feature args> [<arg>]*]
 *
 *   Feature args:
 *     [drop_writes]
 *     [corrupt_bio_byte <Nth_byte> <direction> <value> <bio_flags>]
 *
 *   Nth_byte starts from 1 for the first byte.
 *   Direction is r for READ or w for WRITE.
 *   bio_flags is ignored if 0.
 */
static int flakey_ctr(struct dm_target *ti, unsigned int argc, char **argv)
{}

static void flakey_dtr(struct dm_target *ti)
{}

static sector_t flakey_map_sector(struct dm_target *ti, sector_t bi_sector)
{}

static void flakey_map_bio(struct dm_target *ti, struct bio *bio)
{}

static void corrupt_bio_common(struct bio *bio, unsigned int corrupt_bio_byte,
			       unsigned char corrupt_bio_value)
{}

static void corrupt_bio_data(struct bio *bio, struct flakey_c *fc)
{}

static void corrupt_bio_random(struct bio *bio)
{}

static void clone_free(struct bio *clone)
{}

static void clone_endio(struct bio *clone)
{}

static struct bio *clone_bio(struct dm_target *ti, struct flakey_c *fc, struct bio *bio)
{}

static int flakey_map(struct dm_target *ti, struct bio *bio)
{}

static int flakey_end_io(struct dm_target *ti, struct bio *bio,
			 blk_status_t *error)
{}

static void flakey_status(struct dm_target *ti, status_type_t type,
			  unsigned int status_flags, char *result, unsigned int maxlen)
{}

static int flakey_prepare_ioctl(struct dm_target *ti, struct block_device **bdev)
{}

#ifdef CONFIG_BLK_DEV_ZONED
static int flakey_report_zones(struct dm_target *ti,
		struct dm_report_zones_args *args, unsigned int nr_zones)
{}
#else
#define flakey_report_zones
#endif

static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_fn fn, void *data)
{}

static struct target_type flakey_target =;
module_dm(flakey);

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