From: Klaus Jensen <its@irrelevant.dk>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-block@nongnu.org, Dmitry Fomichev <dmitry.fomichev@wdc.com>,
Klaus Jensen <k.jensen@samsung.com>,
Max Reitz <mreitz@redhat.com>, Klaus Jensen <its@irrelevant.dk>,
Keith Busch <kbusch@kernel.org>
Subject: [PATCH 3/6] hw/block/nvme: enum style fix
Date: Mon, 11 Jan 2021 13:32:20 +0100 [thread overview]
Message-ID: <20210111123223.76248-4-its@irrelevant.dk> (raw)
In-Reply-To: <20210111123223.76248-1-its@irrelevant.dk>
From: Klaus Jensen <k.jensen@samsung.com>
Align with existing style and use a typedef for header-file enums.
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
hw/block/nvme-ns.h | 4 ++--
include/block/nvme.h | 4 ++--
hw/block/nvme.c | 19 +++++++++----------
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/hw/block/nvme-ns.h b/hw/block/nvme-ns.h
index f8f3c28c360b..a0baa5f6d44c 100644
--- a/hw/block/nvme-ns.h
+++ b/hw/block/nvme-ns.h
@@ -102,12 +102,12 @@ static inline size_t nvme_l2b(NvmeNamespace *ns, uint64_t lba)
typedef struct NvmeCtrl NvmeCtrl;
-static inline enum NvmeZoneState nvme_get_zone_state(NvmeZone *zone)
+static inline NvmeZoneState nvme_get_zone_state(NvmeZone *zone)
{
return zone->d.zs >> 4;
}
-static inline void nvme_set_zone_state(NvmeZone *zone, enum NvmeZoneState state)
+static inline void nvme_set_zone_state(NvmeZone *zone, NvmeZoneState state)
{
zone->d.zs = state << 4;
}
diff --git a/include/block/nvme.h b/include/block/nvme.h
index 9494246f1f59..45b2678db1f0 100644
--- a/include/block/nvme.h
+++ b/include/block/nvme.h
@@ -1212,7 +1212,7 @@ typedef struct QEMU_PACKED NvmeZoneDescr {
uint8_t rsvd32[32];
} NvmeZoneDescr;
-enum NvmeZoneState {
+typedef enum NvmeZoneState {
NVME_ZONE_STATE_RESERVED = 0x00,
NVME_ZONE_STATE_EMPTY = 0x01,
NVME_ZONE_STATE_IMPLICITLY_OPEN = 0x02,
@@ -1221,7 +1221,7 @@ enum NvmeZoneState {
NVME_ZONE_STATE_READ_ONLY = 0x0D,
NVME_ZONE_STATE_FULL = 0x0E,
NVME_ZONE_STATE_OFFLINE = 0x0F,
-};
+} NvmeZoneState;
static inline void _nvme_check_size(void)
{
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 8b25c509c6b5..7c2ec17ad7d9 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -198,7 +198,7 @@ static uint16_t nvme_sqid(NvmeRequest *req)
}
static void nvme_assign_zone_state(NvmeNamespace *ns, NvmeZone *zone,
- enum NvmeZoneState state)
+ NvmeZoneState state)
{
if (QTAILQ_IN_USE(zone, entry)) {
switch (nvme_get_zone_state(zone)) {
@@ -1735,8 +1735,7 @@ static uint16_t nvme_get_mgmt_zone_slba_idx(NvmeNamespace *ns, NvmeCmd *c,
return NVME_SUCCESS;
}
-typedef uint16_t (*op_handler_t)(NvmeNamespace *, NvmeZone *,
- enum NvmeZoneState);
+typedef uint16_t (*op_handler_t)(NvmeNamespace *, NvmeZone *, NvmeZoneState);
enum NvmeZoneProcessingMask {
NVME_PROC_CURRENT_ZONE = 0,
@@ -1747,7 +1746,7 @@ enum NvmeZoneProcessingMask {
};
static uint16_t nvme_open_zone(NvmeNamespace *ns, NvmeZone *zone,
- enum NvmeZoneState state)
+ NvmeZoneState state)
{
uint16_t status;
@@ -1780,7 +1779,7 @@ static uint16_t nvme_open_zone(NvmeNamespace *ns, NvmeZone *zone,
}
static uint16_t nvme_close_zone(NvmeNamespace *ns, NvmeZone *zone,
- enum NvmeZoneState state)
+ NvmeZoneState state)
{
switch (state) {
case NVME_ZONE_STATE_EXPLICITLY_OPEN:
@@ -1796,7 +1795,7 @@ static uint16_t nvme_close_zone(NvmeNamespace *ns, NvmeZone *zone,
}
static uint16_t nvme_finish_zone(NvmeNamespace *ns, NvmeZone *zone,
- enum NvmeZoneState state)
+ NvmeZoneState state)
{
switch (state) {
case NVME_ZONE_STATE_EXPLICITLY_OPEN:
@@ -1819,7 +1818,7 @@ static uint16_t nvme_finish_zone(NvmeNamespace *ns, NvmeZone *zone,
}
static uint16_t nvme_reset_zone(NvmeNamespace *ns, NvmeZone *zone,
- enum NvmeZoneState state)
+ NvmeZoneState state)
{
switch (state) {
case NVME_ZONE_STATE_EXPLICITLY_OPEN:
@@ -1842,7 +1841,7 @@ static uint16_t nvme_reset_zone(NvmeNamespace *ns, NvmeZone *zone,
}
static uint16_t nvme_offline_zone(NvmeNamespace *ns, NvmeZone *zone,
- enum NvmeZoneState state)
+ NvmeZoneState state)
{
switch (state) {
case NVME_ZONE_STATE_READ_ONLY:
@@ -1879,7 +1878,7 @@ static uint16_t nvme_bulk_proc_zone(NvmeNamespace *ns, NvmeZone *zone,
op_handler_t op_hndlr)
{
uint16_t status = NVME_SUCCESS;
- enum NvmeZoneState zs = nvme_get_zone_state(zone);
+ NvmeZoneState zs = nvme_get_zone_state(zone);
bool proc_zone;
switch (zs) {
@@ -2077,7 +2076,7 @@ static uint16_t nvme_zone_mgmt_send(NvmeCtrl *n, NvmeRequest *req)
static bool nvme_zone_matches_filter(uint32_t zafs, NvmeZone *zl)
{
- enum NvmeZoneState zs = nvme_get_zone_state(zl);
+ NvmeZoneState zs = nvme_get_zone_state(zl);
switch (zafs) {
case NVME_ZONE_REPORT_ALL:
--
2.30.0
next prev parent reply other threads:[~2021-01-11 12:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 12:32 [PATCH 0/6] hw/block/nvme: zoned misc fixes Klaus Jensen
2021-01-11 12:32 ` [PATCH 1/6] hw/block/nvme: fix shutdown/reset logic Klaus Jensen
2021-01-14 23:49 ` Keith Busch
2021-01-11 12:32 ` [PATCH 2/6] hw/block/nvme: merge implicitly/explicitly opened processing masks Klaus Jensen
2021-01-11 12:32 ` Klaus Jensen [this message]
2021-01-11 12:32 ` [PATCH 4/6] hw/block/nvme: zero out zones on reset Klaus Jensen
2021-01-18 3:35 ` Dmitry Fomichev
2021-01-11 12:32 ` [PATCH 5/6] hw/block/nvme: add missing string representations for commands Klaus Jensen
2021-01-11 12:32 ` [PATCH 6/6] hw/block/nvme: remove unnecessary check for append Klaus Jensen
2021-01-18 3:35 ` [PATCH 0/6] hw/block/nvme: zoned misc fixes Dmitry Fomichev
2021-01-18 5:58 ` Klaus Jensen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210111123223.76248-4-its@irrelevant.dk \
--to=its@irrelevant.dk \
--cc=dmitry.fomichev@wdc.com \
--cc=k.jensen@samsung.com \
--cc=kbusch@kernel.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).