]> www.infradead.org Git - users/hch/nvme-cli.git/commitdiff
Add vendor specific callback to id-ctrl print
authorKeith Busch <keith.busch@intel.com>
Tue, 7 Jun 2016 18:05:44 +0000 (12:05 -0600)
committerKeith Busch <keith.busch@intel.com>
Wed, 8 Jun 2016 23:26:09 +0000 (17:26 -0600)
Signed-off-by: Keith Busch <keith.busch@intel.com>
nvme-print.c
nvme-print.h

index 1b9dc3fe11d6a237fb19ff50781d1cd8afb70c9d..3dd099ab93a507ee07c25c498770f7743d12721b 100644 (file)
@@ -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;
index 22a760ca80d460f31254ecd0eff22e0781306ddc..a38f15f859f0222cf56dd3819f91fa70c17461b6 100644 (file)
@@ -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);