drivers/block/rnbd/rnbd-proto.h

Source file repositories/reference/linux-study-clean/drivers/block/rnbd/rnbd-proto.h

File Facts

System
Linux kernel
Corpus path
drivers/block/rnbd/rnbd-proto.h
Extension
.h
Size
7973 bytes
Lines
322
Domain
Driver Families
Bucket
drivers/block
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct rnbd_msg_hdr {
	__le16		type;
	/* private: */
	__le16		__padding;
};

/*
 * We allow to map RO many times and RW only once. We allow to map yet another
 * time RW, if MIGRATION is provided (second RW export can be required for
 * example for VM migration)
 */
enum rnbd_access_mode {
	RNBD_ACCESS_RO,
	RNBD_ACCESS_RW,
	RNBD_ACCESS_MIGRATION,
};

static const __maybe_unused struct {
	enum rnbd_access_mode mode;
	const char *str;
} rnbd_access_modes[] = {
	[RNBD_ACCESS_RO] = {RNBD_ACCESS_RO, "ro"},
	[RNBD_ACCESS_RW] = {RNBD_ACCESS_RW, "rw"},
	[RNBD_ACCESS_MIGRATION] = {RNBD_ACCESS_MIGRATION, "migration"},
};

/**
 * struct rnbd_msg_sess_info - initial session info from client to server
 * @hdr:		message header
 * @ver:		RNBD protocol version
 */
struct rnbd_msg_sess_info {
	struct rnbd_msg_hdr hdr;
	u8		ver;
	/* private: */
	u8		reserved[31];
};

/**
 * struct rnbd_msg_sess_info_rsp - initial session info from server to client
 * @hdr:		message header
 * @ver:		RNBD protocol version
 */
struct rnbd_msg_sess_info_rsp {
	struct rnbd_msg_hdr hdr;
	u8		ver;
	/* private: */
	u8		reserved[31];
};

/**
 * struct rnbd_msg_open - request to open a remote device.
 * @hdr:		message header
 * @access_mode:	the mode to open remote device, valid values see:
 *			enum rnbd_access_mode
 * @dev_name:		device path on remote side
 */
struct rnbd_msg_open {
	struct rnbd_msg_hdr hdr;
	u8		access_mode;
	/* private: */
	u8		resv1;
	/* public: */
	s8		dev_name[NAME_MAX];
	/* private: */
	u8		reserved[3];
};

/**
 * struct rnbd_msg_close - request to close a remote device.
 * @hdr:	message header
 * @device_id:	device_id on server side to identify the device
 */
struct rnbd_msg_close {
	struct rnbd_msg_hdr hdr;
	__le32		device_id;
};

enum rnbd_cache_policy {
	RNBD_FUA = 1 << 0,
	RNBD_WRITEBACK = 1 << 1,
};

/**
 * struct rnbd_msg_open_rsp - response message to RNBD_MSG_OPEN
 * @hdr:		message header
 * @device_id:		device_id on server side to identify the device
 * @nsectors:		number of sectors in the usual 512b unit
 * @max_hw_sectors:	max hardware sectors in the usual 512b unit
 * @max_write_zeroes_sectors: max sectors for WRITE ZEROES in the 512b unit

Annotation

Implementation Notes