Skip to content

Commit 693a644

Browse files
committed
cmds: group all nvme_init_* functions
Separate the nvme_init_* inline functions from the rest. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 37fcf57 commit 693a644

1 file changed

Lines changed: 106 additions & 105 deletions

File tree

libnvme/src/nvme/cmds.h

Lines changed: 106 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -890,20 +890,6 @@ nvme_init_zns_identify_ctrl(struct nvme_passthru_cmd *cmd,
890890
id, sizeof(*id));
891891
}
892892

893-
/**
894-
* nvme_get_log() - Get log page data
895-
* @hdl: Transport handle
896-
* @cmd: Passthru command
897-
* @rae: Retain asynchronous events
898-
* @xfer_len: Max log transfer size per request to split the total.
899-
*
900-
* Return: 0 on success, the nvme command status if a response was
901-
* received (see &enum nvme_status_field) or a negative error otherwise.
902-
*/
903-
int nvme_get_log(struct nvme_transport_handle *hdl,
904-
struct nvme_passthru_cmd *cmd, bool rae,
905-
__u32 xfer_len);
906-
907893
/**
908894
* nvme_init_get_log_lpo() - Initializes passthru command with a
909895
* Log Page Offset
@@ -5227,6 +5213,112 @@ nvme_init_mi_cmd_flags(struct nvme_passthru_cmd *cmd, bool ish)
52275213
NVME_MI_ADMIN_CFLAGS_ISH_MASK);
52285214
}
52295215

5216+
/**
5217+
* nvme_init_ctrl_list() - Initialize an nvme_ctrl_list structure from an array.
5218+
* @cntlist: The controller list structure to initialize
5219+
* @num_ctrls: The number of controllers in the array, &ctrlist.
5220+
* @ctrlist: An array of controller identifiers in CPU native endian.
5221+
*
5222+
* This is intended to be used with any command that takes a controller list
5223+
* argument. See nvme_ns_attach_ctrls() and nvme_ns_detach().
5224+
*/
5225+
void nvme_init_ctrl_list(struct nvme_ctrl_list *cntlist, __u16 num_ctrls,
5226+
__u16 *ctrlist);
5227+
5228+
/**
5229+
* nvme_init_dsm_range() - Constructs a data set range structure
5230+
* @dsm: DSM range array
5231+
* @ctx_attrs: Array of context attributes
5232+
* @llbas: Array of length in logical blocks
5233+
* @slbas: Array of starting logical blocks
5234+
* @nr_ranges: The size of the dsm arrays
5235+
*
5236+
* Each array must be the same size of size 'nr_ranges'. This is intended to be
5237+
* used with constructing a payload for nvme_dsm().
5238+
*
5239+
* Return: The nvme command status if a response was received or -errno
5240+
* otherwise.
5241+
*/
5242+
void nvme_init_dsm_range(struct nvme_dsm_range *dsm, __u32 *ctx_attrs,
5243+
__u32 *llbas, __u64 *slbas, __u16 nr_ranges);
5244+
5245+
/**
5246+
* nvme_init_copy_range() - Constructs a copy range structure
5247+
* @copy: Copy range array
5248+
* @nlbs: Number of logical blocks
5249+
* @slbas: Starting LBA
5250+
* @eilbrts: Expected initial logical block reference tag
5251+
* @elbatms: Expected logical block application tag mask
5252+
* @elbats: Expected logical block application tag
5253+
* @nr: Number of descriptors to construct
5254+
*/
5255+
void nvme_init_copy_range(struct nvme_copy_range *copy, __u16 *nlbs,
5256+
__u64 *slbas, __u32 *eilbrts, __u32 *elbatms,
5257+
__u32 *elbats, __u16 nr);
5258+
5259+
/**
5260+
* nvme_init_copy_range_f1() - Constructs a copy range f1 structure
5261+
* @copy: Copy range array
5262+
* @nlbs: Number of logical blocks
5263+
* @slbas: Starting LBA
5264+
* @eilbrts: Expected initial logical block reference tag
5265+
* @elbatms: Expected logical block application tag mask
5266+
* @elbats: Expected logical block application tag
5267+
* @nr: Number of descriptors to construct
5268+
*/
5269+
void nvme_init_copy_range_f1(struct nvme_copy_range_f1 *copy, __u16 *nlbs,
5270+
__u64 *slbas, __u64 *eilbrts, __u32 *elbatms,
5271+
__u32 *elbats, __u16 nr);
5272+
5273+
/**
5274+
* nvme_init_copy_range_f2() - Constructs a copy range f2 structure
5275+
* @copy: Copy range array
5276+
* @snsids: Source namespace identifier
5277+
* @nlbs: Number of logical blocks
5278+
* @slbas: Starting LBA
5279+
* @sopts: Source options
5280+
* @eilbrts: Expected initial logical block reference tag
5281+
* @elbatms: Expected logical block application tag mask
5282+
* @elbats: Expected logical block application tag
5283+
* @nr: Number of descriptors to construct
5284+
*/
5285+
void nvme_init_copy_range_f2(struct nvme_copy_range_f2 *copy, __u32 *snsids,
5286+
__u16 *nlbs, __u64 *slbas, __u16 *sopts,
5287+
__u32 *eilbrts, __u32 *elbatms, __u32 *elbats,
5288+
__u16 nr);
5289+
5290+
/**
5291+
* nvme_init_copy_range_f3() - Constructs a copy range f3 structure
5292+
* @copy: Copy range array
5293+
* @snsids: Source namespace identifier
5294+
* @nlbs: Number of logical blocks
5295+
* @slbas: Starting LBA
5296+
* @sopts: Source options
5297+
* @eilbrts: Expected initial logical block reference tag
5298+
* @elbatms: Expected logical block application tag mask
5299+
* @elbats: Expected logical block application tag
5300+
* @nr: Number of descriptors to construct
5301+
*/
5302+
void nvme_init_copy_range_f3(struct nvme_copy_range_f3 *copy, __u32 *snsids,
5303+
__u16 *nlbs, __u64 *slbas, __u16 *sopts,
5304+
__u64 *eilbrts, __u32 *elbatms, __u32 *elbats,
5305+
__u16 nr);
5306+
5307+
5308+
/**
5309+
* nvme_get_log() - Get log page data
5310+
* @hdl: Transport handle
5311+
* @cmd: Passthru command
5312+
* @rae: Retain asynchronous events
5313+
* @xfer_len: Max log transfer size per request to split the total.
5314+
*
5315+
* Return: 0 on success, the nvme command status if a response was
5316+
* received (see &enum nvme_status_field) or a negative error otherwise.
5317+
*/
5318+
int nvme_get_log(struct nvme_transport_handle *hdl,
5319+
struct nvme_passthru_cmd *cmd, bool rae,
5320+
__u32 xfer_len);
5321+
52305322
/**
52315323
* nvme_set_etdas() - Set the Extended Telemetry Data Area 4 Supported bit
52325324
* @hdl: Transport handle
@@ -5419,97 +5511,6 @@ int nvme_namespace_attach_ctrls(struct nvme_transport_handle *hdl, bool ish,
54195511
int nvme_namespace_detach_ctrls(struct nvme_transport_handle *hdl, bool ish,
54205512
__u32 nsid, __u16 num_ctrls, __u16 *ctrlist);
54215513

5422-
/**
5423-
* nvme_init_ctrl_list() - Initialize an nvme_ctrl_list structure from an array.
5424-
* @cntlist: The controller list structure to initialize
5425-
* @num_ctrls: The number of controllers in the array, &ctrlist.
5426-
* @ctrlist: An array of controller identifiers in CPU native endian.
5427-
*
5428-
* This is intended to be used with any command that takes a controller list
5429-
* argument. See nvme_ns_attach_ctrls() and nvme_ns_detach().
5430-
*/
5431-
void nvme_init_ctrl_list(struct nvme_ctrl_list *cntlist, __u16 num_ctrls,
5432-
__u16 *ctrlist);
5433-
5434-
/**
5435-
* nvme_init_dsm_range() - Constructs a data set range structure
5436-
* @dsm: DSM range array
5437-
* @ctx_attrs: Array of context attributes
5438-
* @llbas: Array of length in logical blocks
5439-
* @slbas: Array of starting logical blocks
5440-
* @nr_ranges: The size of the dsm arrays
5441-
*
5442-
* Each array must be the same size of size 'nr_ranges'. This is intended to be
5443-
* used with constructing a payload for nvme_dsm().
5444-
*
5445-
* Return: The nvme command status if a response was received or -errno
5446-
* otherwise.
5447-
*/
5448-
void nvme_init_dsm_range(struct nvme_dsm_range *dsm, __u32 *ctx_attrs,
5449-
__u32 *llbas, __u64 *slbas, __u16 nr_ranges);
5450-
5451-
/**
5452-
* nvme_init_copy_range() - Constructs a copy range structure
5453-
* @copy: Copy range array
5454-
* @nlbs: Number of logical blocks
5455-
* @slbas: Starting LBA
5456-
* @eilbrts: Expected initial logical block reference tag
5457-
* @elbatms: Expected logical block application tag mask
5458-
* @elbats: Expected logical block application tag
5459-
* @nr: Number of descriptors to construct
5460-
*/
5461-
void nvme_init_copy_range(struct nvme_copy_range *copy, __u16 *nlbs,
5462-
__u64 *slbas, __u32 *eilbrts, __u32 *elbatms,
5463-
__u32 *elbats, __u16 nr);
5464-
5465-
/**
5466-
* nvme_init_copy_range_f1() - Constructs a copy range f1 structure
5467-
* @copy: Copy range array
5468-
* @nlbs: Number of logical blocks
5469-
* @slbas: Starting LBA
5470-
* @eilbrts: Expected initial logical block reference tag
5471-
* @elbatms: Expected logical block application tag mask
5472-
* @elbats: Expected logical block application tag
5473-
* @nr: Number of descriptors to construct
5474-
*/
5475-
void nvme_init_copy_range_f1(struct nvme_copy_range_f1 *copy, __u16 *nlbs,
5476-
__u64 *slbas, __u64 *eilbrts, __u32 *elbatms,
5477-
__u32 *elbats, __u16 nr);
5478-
5479-
/**
5480-
* nvme_init_copy_range_f2() - Constructs a copy range f2 structure
5481-
* @copy: Copy range array
5482-
* @snsids: Source namespace identifier
5483-
* @nlbs: Number of logical blocks
5484-
* @slbas: Starting LBA
5485-
* @sopts: Source options
5486-
* @eilbrts: Expected initial logical block reference tag
5487-
* @elbatms: Expected logical block application tag mask
5488-
* @elbats: Expected logical block application tag
5489-
* @nr: Number of descriptors to construct
5490-
*/
5491-
void nvme_init_copy_range_f2(struct nvme_copy_range_f2 *copy, __u32 *snsids,
5492-
__u16 *nlbs, __u64 *slbas, __u16 *sopts,
5493-
__u32 *eilbrts, __u32 *elbatms, __u32 *elbats,
5494-
__u16 nr);
5495-
5496-
/**
5497-
* nvme_init_copy_range_f3() - Constructs a copy range f3 structure
5498-
* @copy: Copy range array
5499-
* @snsids: Source namespace identifier
5500-
* @nlbs: Number of logical blocks
5501-
* @slbas: Starting LBA
5502-
* @sopts: Source options
5503-
* @eilbrts: Expected initial logical block reference tag
5504-
* @elbatms: Expected logical block application tag mask
5505-
* @elbats: Expected logical block application tag
5506-
* @nr: Number of descriptors to construct
5507-
*/
5508-
void nvme_init_copy_range_f3(struct nvme_copy_range_f3 *copy, __u32 *snsids,
5509-
__u16 *nlbs, __u64 *slbas, __u16 *sopts,
5510-
__u64 *eilbrts, __u32 *elbatms, __u32 *elbats,
5511-
__u16 nr);
5512-
55135514
/**
55145515
* nvme_get_feature_length() - Retrieve the command payload length for a
55155516
* specific feature identifier

0 commit comments

Comments
 (0)