linux/drivers/md/dm-dust.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2018 Red Hat, Inc.
 *
 * This is a test "dust" device, which fails reads on specified
 * sectors, emulating the behavior of a hard disk drive sending
 * a "Read Medium Error" sense.
 *
 */

#include <linux/device-mapper.h>
#include <linux/module.h>
#include <linux/rbtree.h>

#define DM_MSG_PREFIX

struct badblock {};

struct dust_device {};

static struct badblock *dust_rb_search(struct rb_root *root, sector_t blk)
{}

static bool dust_rb_insert(struct rb_root *root, struct badblock *new)
{}

static int dust_remove_block(struct dust_device *dd, unsigned long long block)
{}

static int dust_add_block(struct dust_device *dd, unsigned long long block,
			  unsigned char wr_fail_cnt)
{}

static int dust_query_block(struct dust_device *dd, unsigned long long block, char *result,
			    unsigned int maxlen, unsigned int *sz_ptr)
{}

static int __dust_map_read(struct dust_device *dd, sector_t thisblock)
{}

static int dust_map_read(struct dust_device *dd, sector_t thisblock,
			 bool fail_read_on_bb)
{}

static int __dust_map_write(struct dust_device *dd, sector_t thisblock)
{}

static int dust_map_write(struct dust_device *dd, sector_t thisblock,
			  bool fail_read_on_bb)
{}

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

static bool __dust_clear_badblocks(struct rb_root *tree,
				   unsigned long long count)
{}

static int dust_clear_badblocks(struct dust_device *dd, char *result, unsigned int maxlen,
				unsigned int *sz_ptr)
{}

static int dust_list_badblocks(struct dust_device *dd, char *result, unsigned int maxlen,
				unsigned int *sz_ptr)
{}

/*
 * Target parameters:
 *
 * <device_path> <offset> <blksz>
 *
 * device_path: path to the block device
 * offset: offset to data area from start of device_path
 * blksz: block size (minimum 512, maximum 1073741824, must be a power of 2)
 */
static int dust_ctr(struct dm_target *ti, unsigned int argc, char **argv)
{}

static void dust_dtr(struct dm_target *ti)
{}

static int dust_message(struct dm_target *ti, unsigned int argc, char **argv,
			char *result, unsigned int maxlen)
{}

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

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

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

static struct target_type dust_target =;
module_dm(dust);

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