return nvme_submit_admin_passthru64(args->fd, &cmd, args->value);
}
-int nvme_sanitize_nvm(int fd, enum nvme_sanitize_sanact sanact, bool ause,
- __u8 owpass, bool oipbp, bool nodas, __u32 ovrpat,
- __u32 timeout, __u32 *result)
+int nvme_sanitize_nvm(struct nvme_sanitize_nvm_args *args)
{
- __u32 cdw10 = NVME_SET(sanact, SANITIZE_CDW10_SANACT) |
- NVME_SET(!!ause, SANITIZE_CDW10_AUSE) |
- NVME_SET(owpass, SANITIZE_CDW10_OWPASS) |
- NVME_SET(!!oipbp, SANITIZE_CDW10_OIPBP) |
- NVME_SET(!!nodas, SANITIZE_CDW10_NODAS);
- __u32 cdw11 = ovrpat;
+ __u32 cdw10 = NVME_SET(args->sanact, SANITIZE_CDW10_SANACT) |
+ NVME_SET(!!args->ause, SANITIZE_CDW10_AUSE) |
+ NVME_SET(args->owpass, SANITIZE_CDW10_OWPASS) |
+ NVME_SET(!!args->oipbp, SANITIZE_CDW10_OIPBP) |
+ NVME_SET(!!args->nodas, SANITIZE_CDW10_NODAS);
+ __u32 cdw11 = args->ovrpat;
struct nvme_passthru_cmd cmd = {
.opcode = nvme_admin_sanitize_nvm,
.cdw10 = cdw10,
.cdw11 = cdw11,
- .timeout_ms = timeout,
+ .timeout_ms = args->timeout,
};
- return nvme_submit_admin_passthru(fd, &cmd, result);
+ if (args->args_size < sizeof(*args))
+ return -EINVAL;
+ return nvme_submit_admin_passthru(args->fd, &cmd, args->result);
}
int nvme_dev_self_test(int fd, __u32 nsid, enum nvme_dst_stc stc)
int nvme_get_property(struct nvme_get_property_args *args);
/**
- * nvme_sanitize_nvm() - Start a sanitize operation
+ * nvme_sanitize_nvm_args - Arguments for the NVMe Sanitize NVM command
* @fd: File descriptor of nvme device
* @sanact: Sanitize action, see &enum nvme_sanitize_sanact
* @ause: Set to allow unrestriced sanitize exit
* @ovrpat: Overwrite pattern
* @timeout: Timeout in ms
* @result: The command completion result from CQE dword0
+ */
+struct nvme_sanitize_nvm_args {
+ int args_size;
+ int fd;
+ enum nvme_sanitize_sanact sanact;
+ bool ause;
+ __u8 owpass;
+ bool oipbp;
+ bool nodas;
+ __u32 ovrpat;
+ __u32 timeout;
+ __u32 *result;
+};
+
+/**
+ * nvme_sanitize_nvm() - Start a sanitize operation
+ * @args: &struct nvme_sanitize_nvm_args argument structure
*
* A sanitize operation alters all user data in the NVM subsystem such that
* recovery of any previous user data from any cache, the non-volatile media,
* Return: The nvme command status if a response was received (see
* &enum nvme_status_field) or -1 with errno set otherwise.
*/
-int nvme_sanitize_nvm(int fd, enum nvme_sanitize_sanact sanact, bool ause,
- __u8 owpass, bool oipbp, bool nodas, __u32 ovrpat,
- __u32 timeout, __u32 *result);
+int nvme_sanitize_nvm(struct nvme_sanitize_nvm_args *args);
/**
* nvme_dev_self_test() - Start or abort a self test