linux/include/uapi/linux/target_core_user.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __TARGET_CORE_USER_H
#define __TARGET_CORE_USER_H

/* This header will be used by application too */

#include <linux/types.h>
#include <linux/uio.h>

#define TCMU_VERSION

/**
 * DOC: Ring Design
 * Ring Design
 * -----------
 *
 * The mmaped area is divided into three parts:
 * 1) The mailbox (struct tcmu_mailbox, below);
 * 2) The command ring;
 * 3) Everything beyond the command ring (data).
 *
 * The mailbox tells userspace the offset of the command ring from the
 * start of the shared memory region, and how big the command ring is.
 *
 * The kernel passes SCSI commands to userspace by putting a struct
 * tcmu_cmd_entry in the ring, updating mailbox->cmd_head, and poking
 * userspace via UIO's interrupt mechanism.
 *
 * tcmu_cmd_entry contains a header. If the header type is PAD,
 * userspace should skip hdr->length bytes (mod cmdr_size) to find the
 * next cmd_entry.
 *
 * Otherwise, the entry will contain offsets into the mmaped area that
 * contain the cdb and data buffers -- the latter accessible via the
 * iov array. iov addresses are also offsets into the shared area.
 *
 * When userspace is completed handling the command, set
 * entry->rsp.scsi_status, fill in rsp.sense_buffer if appropriate,
 * and also set mailbox->cmd_tail equal to the old cmd_tail plus
 * hdr->length, mod cmdr_size. If cmd_tail doesn't equal cmd_head, it
 * should process the next packet the same way, and so on.
 */

#define TCMU_MAILBOX_VERSION
#define ALIGN_SIZE
#define TCMU_MAILBOX_FLAG_CAP_OOOC
#define TCMU_MAILBOX_FLAG_CAP_READ_LEN
#define TCMU_MAILBOX_FLAG_CAP_TMR
#define TCMU_MAILBOX_FLAG_CAP_KEEP_BUF

struct tcmu_mailbox {} __packed;

enum tcmu_opcode {};

/*
 * Only a few opcodes, and length is 8-byte aligned, so use low bits for opcode.
 */
struct tcmu_cmd_entry_hdr {} __packed;

#define TCMU_OP_MASK

static inline enum tcmu_opcode tcmu_hdr_get_op(__u32 len_op)
{}

static inline void tcmu_hdr_set_op(__u32 *len_op, enum tcmu_opcode op)
{}

static inline __u32 tcmu_hdr_get_len(__u32 len_op)
{}

static inline void tcmu_hdr_set_len(__u32 *len_op, __u32 len)
{}

/* Currently the same as SCSI_SENSE_BUFFERSIZE */
#define TCMU_SENSE_BUFFERSIZE

struct tcmu_cmd_entry {} __packed;

struct tcmu_tmr_entry {} __packed;

#define TCMU_OP_ALIGN_SIZE

enum tcmu_genl_cmd {};
#define TCMU_CMD_MAX

enum tcmu_genl_attr {};
#define TCMU_ATTR_MAX

#endif