From: Keith Busch Date: Tue, 7 Jun 2016 18:05:44 +0000 (-0600) Subject: Add vendor specific callback to id-ctrl print X-Git-Tag: v0.8~18 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=74a427402e5d2170cebe466858bc03aa602dfafe;p=users%2Fhch%2Fnvme-cli.git Add vendor specific callback to id-ctrl print Signed-off-by: Keith Busch --- diff --git a/nvme-print.c b/nvme-print.c index 1b9dc3f..3dd099a 100644 --- a/nvme-print.c +++ b/nvme-print.c @@ -574,7 +574,7 @@ static void show_nvme_id_ctrl_power(struct nvme_id_ctrl *ctrl) } } -void show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode) +void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*vendor_show)(__u8 *vs)) { int human = mode & HUMAN, vs = mode & VS; @@ -656,12 +656,19 @@ void show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode) show_nvme_id_ctrl_sgls(ctrl->sgls); show_nvme_id_ctrl_power(ctrl); - if (vs) { + if (vendor_show) + vendor_show(ctrl->vs); + else if (vs) { printf("vs[]:\n"); d(ctrl->vs, sizeof(ctrl->vs), 16, 1); } } +void show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode) +{ + __show_nvme_id_ctrl(ctrl, mode, NULL); +} + void show_error_log(struct nvme_error_log_page *err_log, int entries, const char *devname) { int i; diff --git a/nvme-print.h b/nvme-print.h index 22a760c..a38f15f 100644 --- a/nvme-print.h +++ b/nvme-print.h @@ -13,6 +13,7 @@ enum { void d(unsigned char *buf, int len, int width, int group); void d_raw(unsigned char *buf, unsigned len); +void __show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode, void (*vendor_show)(__u8 *vs)); void show_nvme_id_ctrl(struct nvme_id_ctrl *ctrl, unsigned int mode); void show_nvme_id_ns(struct nvme_id_ns *ns, unsigned int flags); void show_nvme_resv_report(struct nvme_reservation_status *status);