Skip to content

Commit

Permalink
nvme-print: Move nvme_is_fabrics_reg() to nvme-print.c from nvme.c
Browse files Browse the repository at this point in the history
The function used in nvme-print.c and nvme-print-stdout.c not in nvme.c.

Signed-off-by: Tokunori Ikegami <[email protected]>
  • Loading branch information
ikegami-t committed Feb 4, 2024
1 parent 8a750e2 commit b78600a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
17 changes: 17 additions & 0 deletions nvme-print.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,23 @@ const char *nvme_register_pmr_pmrszu_to_string(__u8 pmrszu)
return nvme_register_unit_to_string(pmrszu);
}

bool nvme_is_fabrics_reg(int offset)
{
switch (offset) {
case NVME_REG_CAP:
case NVME_REG_VS:
case NVME_REG_CC:
case NVME_REG_CSTS:
case NVME_REG_NSSR:
case NVME_REG_CRTO:
return true;
default:
break;
}

return false;
}

void nvme_show_ctrl_register(void *bar, bool fabrics, int offset, enum nvme_print_flags flags)
{
uint64_t value;
Expand Down
1 change: 1 addition & 0 deletions nvme-print.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,5 @@ void nvme_show_perror(const char *msg);
void nvme_show_error_status(int status, const char *msg, ...);
void nvme_show_init(void);
void nvme_show_finish(void);
bool nvme_is_fabrics_reg(int offset);
#endif /* NVME_PRINT_H */
17 changes: 0 additions & 17 deletions nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -5391,23 +5391,6 @@ static int show_registers(int argc, char **argv, struct command *cmd, struct plu
return err;
}

bool nvme_is_fabrics_reg(int offset)
{
switch (offset) {
case NVME_REG_CAP:
case NVME_REG_VS:
case NVME_REG_CC:
case NVME_REG_CSTS:
case NVME_REG_NSSR:
case NVME_REG_CRTO:
return true;
default:
break;
}

return false;
}

static int get_register_property(int fd, void **pbar, int offset)
{
int err;
Expand Down
1 change: 0 additions & 1 deletion nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ unsigned long long elapsed_utime(struct timeval start_time,

/* nvme-print.c */
const char *nvme_select_to_string(int sel);
bool nvme_is_fabrics_reg(int offset);

void d(unsigned char *buf, int len, int width, int group);
void d_raw(unsigned char *buf, unsigned len);
Expand Down

0 comments on commit b78600a

Please sign in to comment.