nvme: take const cmd pointer in read-only helpers

JIRA: https://issues.redhat.com/browse/RHEL-25547

nvme_is_fabrics() and nvme_is_write() only read struct nvme_command,
so take it by const pointer. This allows callers to pass a const pointer
and communicates that these functions don't modify the command.

Signed-off-by: Caleb Sander <csander@purestorage.com>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
(cherry picked from commit f9e9115d0c014dec3278d68823eaff159f98f4d6)
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
This commit is contained in:
Maurizio Lombardi 2024-03-13 16:24:51 +01:00
parent 9afc6976c0
commit b88b437ef5
1 changed files with 2 additions and 2 deletions

View File

@ -1798,7 +1798,7 @@ struct nvme_command {
};
};
static inline bool nvme_is_fabrics(struct nvme_command *cmd)
static inline bool nvme_is_fabrics(const struct nvme_command *cmd)
{
return cmd->common.opcode == nvme_fabrics_command;
}
@ -1817,7 +1817,7 @@ struct nvme_error_slot {
__u8 resv2[24];
};
static inline bool nvme_is_write(struct nvme_command *cmd)
static inline bool nvme_is_write(const struct nvme_command *cmd)
{
/*
* What a mess...