|
17 | 17 | * libnvme utility functions |
18 | 18 | */ |
19 | 19 |
|
| 20 | +#if __has_attribute(__fallthrough__) |
| 21 | +# define fallthrough __attribute__((__fallthrough__)) |
| 22 | +#else |
| 23 | +# define fallthrough do {} while (0) /* fallthrough */ |
| 24 | +#endif |
| 25 | + |
20 | 26 | /** |
21 | 27 | * enum nvme_connect_err - nvme connect error codes |
22 | 28 | * @ENVME_CONNECT_RESOLVE: failed to resolve host |
@@ -155,6 +161,37 @@ void nvme_init_copy_range_f1(struct nvme_copy_range_f1 *copy, __u16 *nlbs, |
155 | 161 | */ |
156 | 162 | int nvme_get_feature_length(int fid, __u32 cdw11, __u32 *len); |
157 | 163 |
|
| 164 | +/** |
| 165 | + * enum nvme_data_tfr - Data transfer direction of the command |
| 166 | + * @NVME_DATA_TFR_NO_DATA_TFR: No data transfer |
| 167 | + * @NVME_DATA_TFR_HOST_TO_CTRL: Host to controller |
| 168 | + * @NVME_DATA_TFR_CTRL_TO_HOST: Controller to host |
| 169 | + * @NVME_DATA_TFR_BIDIRECTIONAL: Bidirectional |
| 170 | + */ |
| 171 | +enum nvme_data_tfr { |
| 172 | + NVME_DATA_TFR_NO_DATA_TFR, |
| 173 | + NVME_DATA_TFR_HOST_TO_CTRL, |
| 174 | + NVME_DATA_TFR_CTRL_TO_HOST, |
| 175 | + NVME_DATA_TFR_BIDIRECTIONAL |
| 176 | +}; |
| 177 | + |
| 178 | +/** |
| 179 | + * nvme_get_feature_length2() - Retreive the command payload length for a |
| 180 | + * specific feature identifier |
| 181 | + * @fid: Feature identifier, see &enum nvme_features_id. |
| 182 | + * @cdw11: The cdw11 value may affect the transfer (only known fid is |
| 183 | + * %NVME_FEAT_FID_HOST_ID) |
| 184 | + * @dir: Data transfer direction: false - host to controller, true - |
| 185 | + * controller to host may affect the transfer (only known fid is |
| 186 | + * %NVME_FEAT_FID_HOST_MEM_BUF). |
| 187 | + * @len: On success, set to this features payload length in bytes. |
| 188 | + * |
| 189 | + * Return: 0 on success, -1 with errno set to EINVAL if the function did not |
| 190 | + * recognize &fid. |
| 191 | + */ |
| 192 | +int nvme_get_feature_length2(int fid, __u32 cdw11, enum nvme_data_tfr dir, |
| 193 | + __u32 *len); |
| 194 | + |
158 | 195 | /** |
159 | 196 | * nvme_get_directive_receive_length() - Get directive receive length |
160 | 197 | * @dtype: Directive type, see &enum nvme_directive_dtype |
|
0 commit comments