aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorKlaus Jensen <k.jensen@samsung.com>2021-04-15 08:37:36 +0200
committerKlaus Jensen <k.jensen@samsung.com>2021-05-17 09:15:13 +0200
commitc6dfa9d6b4b460a7dcf033478606fb17f8c5b0fa (patch)
tree652ada53c2bc0efe039705f769a5a28f20d02162 /hw
parent312c3531bba416e589f106db8c8241fc6e7e6332 (diff)
downloadqemu-c6dfa9d6b4b460a7dcf033478606fb17f8c5b0fa.zip
qemu-c6dfa9d6b4b460a7dcf033478606fb17f8c5b0fa.tar.gz
qemu-c6dfa9d6b4b460a7dcf033478606fb17f8c5b0fa.tar.bz2
hw/block/nvme: rename __nvme_zrm_open
Get rid of the (reserved) double underscore use. Rename the "generic" zone open function to nvme_zrm_open_flags() and add a generic `int flags` argument instead which allows more flags to be easily added in the future. There is at least one TP under standardization that would add an additional flag. Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Cc: Thomas Huth <thuth@redhat.com> Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/block/nvme.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index baba949..9e5ab4c 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -1694,8 +1694,12 @@ static void nvme_zrm_auto_transition_zone(NvmeNamespace *ns)
}
}
-static uint16_t __nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone,
- bool implicit)
+enum {
+ NVME_ZRM_AUTO = 1 << 0,
+};
+
+static uint16_t nvme_zrm_open_flags(NvmeNamespace *ns, NvmeZone *zone,
+ int flags)
{
int act = 0;
uint16_t status;
@@ -1719,7 +1723,7 @@ static uint16_t __nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone,
nvme_aor_inc_open(ns);
- if (implicit) {
+ if (flags & NVME_ZRM_AUTO) {
nvme_assign_zone_state(ns, zone, NVME_ZONE_STATE_IMPLICITLY_OPEN);
return NVME_SUCCESS;
}
@@ -1727,7 +1731,7 @@ static uint16_t __nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone,
/* fallthrough */
case NVME_ZONE_STATE_IMPLICITLY_OPEN:
- if (implicit) {
+ if (flags & NVME_ZRM_AUTO) {
return NVME_SUCCESS;
}
@@ -1745,12 +1749,12 @@ static uint16_t __nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone,
static inline uint16_t nvme_zrm_auto(NvmeNamespace *ns, NvmeZone *zone)
{
- return __nvme_zrm_open(ns, zone, true);
+ return nvme_zrm_open_flags(ns, zone, NVME_ZRM_AUTO);
}
static inline uint16_t nvme_zrm_open(NvmeNamespace *ns, NvmeZone *zone)
{
- return __nvme_zrm_open(ns, zone, false);
+ return nvme_zrm_open_flags(ns, zone, 0);
}
static void __nvme_advance_zone_wp(NvmeNamespace *ns, NvmeZone *zone,