mirror of https://gitee.com/openkylin/qemu.git
hw/block/nvme: enum style fix
Align with existing style and use a typedef for header-file enums. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Tested-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com>
This commit is contained in:
parent
5720669605
commit
b05fde2881
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue