linux/drivers/md/dm-core.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Internal header file _only_ for device mapper core
 *
 * Copyright (C) 2016 Red Hat, Inc. All rights reserved.
 *
 * This file is released under the LGPL.
 */

#ifndef DM_CORE_INTERNAL_H
#define DM_CORE_INTERNAL_H

#include <linux/kthread.h>
#include <linux/ktime.h>
#include <linux/blk-mq.h>
#include <linux/blk-crypto-profile.h>
#include <linux/jump_label.h>

#include <trace/events/block.h>

#include "dm.h"
#include "dm-ima.h"

#define DM_RESERVED_MAX_IOS
#define DM_MAX_TARGETS
#define DM_MAX_TARGET_PARAMS

struct dm_io;

struct dm_kobject_holder {};

/*
 * DM core internal structures used directly by dm.c, dm-rq.c and dm-table.c.
 * DM targets must _not_ deference a mapped_device or dm_table to directly
 * access their members!
 */

/*
 * For mempools pre-allocation at the table loading time.
 */
struct dm_md_mempools {};

struct mapped_device {};

/*
 * Bits for the flags field of struct mapped_device.
 */
#define DMF_BLOCK_IO_FOR_SUSPEND
#define DMF_SUSPENDED
#define DMF_FROZEN
#define DMF_FREEING
#define DMF_DELETING
#define DMF_NOFLUSH_SUSPENDING
#define DMF_DEFERRED_REMOVE
#define DMF_SUSPENDED_INTERNALLY
#define DMF_POST_SUSPENDING
#define DMF_EMULATE_ZONE_APPEND

void disable_discard(struct mapped_device *md);
void disable_write_zeroes(struct mapped_device *md);

static inline sector_t dm_get_size(struct mapped_device *md)
{}

static inline struct dm_stats *dm_get_stats(struct mapped_device *md)
{}

DECLARE_STATIC_KEY_FALSE(stats_enabled);
DECLARE_STATIC_KEY_FALSE(swap_bios_enabled);
DECLARE_STATIC_KEY_FALSE(zoned_enabled);

static inline bool dm_emulate_zone_append(struct mapped_device *md)
{}

#define DM_TABLE_MAX_DEPTH

struct dm_table {};

static inline struct dm_target *dm_table_get_target(struct dm_table *t,
						    unsigned int index)
{}

/*
 * One of these is allocated per clone bio.
 */
#define DM_TIO_MAGIC
struct dm_target_io {};
#define DM_TARGET_IO_BIO_OFFSET
#define DM_IO_BIO_OFFSET

/*
 * dm_target_io flags
 */
enum {};

static inline bool dm_tio_flagged(struct dm_target_io *tio, unsigned int bit)
{}

static inline void dm_tio_set_flag(struct dm_target_io *tio, unsigned int bit)
{}

static inline bool dm_tio_is_normal(struct dm_target_io *tio)
{}

/*
 * One of these is allocated per original bio.
 * It contains the first clone used for that original.
 */
#define DM_IO_MAGIC
struct dm_io {};

/*
 * dm_io flags
 */
enum {};

static inline bool dm_io_flagged(struct dm_io *io, unsigned int bit)
{}

static inline void dm_io_set_flag(struct dm_io *io, unsigned int bit)
{}

void dm_io_rewind(struct dm_io *io, struct bio_set *bs);

static inline struct completion *dm_get_completion_from_kobject(struct kobject *kobj)
{}

unsigned int __dm_get_module_param(unsigned int *module_param, unsigned int def, unsigned int max);

static inline bool dm_message_test_buffer_overflow(char *result, unsigned int maxlen)
{}

extern atomic_t dm_global_event_nr;
extern wait_queue_head_t dm_global_eventq;
void dm_issue_global_event(void);

#endif