File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ LIBNVME_3 {
1414 libnvme_ctrl_get_subsysnqn;
1515 libnvme_ctrl_get_subsystem;
1616 libnvme_ctrl_get_transport_handle;
17+ libnvme_ctrl_get_command_error_count;
18+ libnvme_ctrl_get_reset_count;
19+ libnvme_ctrl_get_reconnect_count;
1720 libnvme_ctrl_identify;
1821 libnvme_ctrl_match_config;
1922 libnvme_ctrl_next_ns;
Original file line number Diff line number Diff line change @@ -298,6 +298,9 @@ struct libnvme_ctrl { // !generate-accessors
298298 bool unique_discovery_ctrl ;
299299 bool discovered ;
300300 bool persistent ;
301+ long command_error_count ; // !accessors:none
302+ long reset_count ; // !accessors:none
303+ long reconnect_count ; // !accessors:none
301304 struct libnvme_fabrics_config cfg ;
302305};
303306
Original file line number Diff line number Diff line change @@ -1458,6 +1458,39 @@ __public const char *libnvme_ctrl_get_state(libnvme_ctrl_t c)
14581458 return c -> state ;
14591459}
14601460
1461+ __public long libnvme_ctrl_get_command_error_count (libnvme_ctrl_t c )
1462+ {
1463+ __cleanup_free char * error_count = NULL ;
1464+
1465+ error_count = libnvme_get_ctrl_attr (c , "command_error_count" );
1466+ if (error_count )
1467+ sscanf (error_count , "%ld" , & c -> command_error_count );
1468+
1469+ return c -> command_error_count ;
1470+ }
1471+
1472+ __public long libnvme_ctrl_get_reset_count (libnvme_ctrl_t c )
1473+ {
1474+ __cleanup_free char * reset_count = NULL ;
1475+
1476+ reset_count = libnvme_get_ctrl_attr (c , "reset_count" );
1477+ if (reset_count )
1478+ sscanf (reset_count , "%ld" , & c -> reset_count );
1479+
1480+ return c -> reset_count ;
1481+ }
1482+
1483+ __public long libnvme_ctrl_get_reconnect_count (libnvme_ctrl_t c )
1484+ {
1485+ __cleanup_free char * reconnect_count = NULL ;
1486+
1487+ reconnect_count = libnvme_get_ctrl_attr (c , "reconnect_count" );
1488+ if (reconnect_count )
1489+ sscanf (reconnect_count , "%ld" , & c -> reconnect_count );
1490+
1491+ return c -> reconnect_count ;
1492+ }
1493+
14611494__public int libnvme_ctrl_identify (libnvme_ctrl_t c , struct nvme_id_ctrl * id )
14621495{
14631496 struct libnvme_transport_handle * hdl =
Original file line number Diff line number Diff line change @@ -1007,6 +1007,31 @@ unsigned long long libnvme_ns_get_read_sectors(libnvme_ns_t n);
10071007 */
10081008unsigned long long libnvme_ns_get_write_sectors (libnvme_ns_t n );
10091009
1010+ /**
1011+ * libnvme_ctrl_get_command_error_count() - Get admin command error count
1012+ * @c: Controller instance
1013+ *
1014+ * Return: Number of times admin command issued to controller @c failed or
1015+ * returned error status
1016+ */
1017+ long libnvme_ctrl_get_command_error_count (libnvme_ctrl_t c );
1018+
1019+ /**
1020+ * libnvme_ctrl_get_reset_count() - Get controller reset count
1021+ * @c: Controller instance
1022+ *
1023+ * Return: Number of timer controller @c is reset
1024+ */
1025+ long libnvme_ctrl_get_reset_count (libnvme_ctrl_t c );
1026+
1027+ /**
1028+ * libnvme_ctrl_get_reconnect_count() - Get controller reconnect count
1029+ * @c: Controller instance
1030+ *
1031+ * Return: Number of times controller has to reconnect to the target
1032+ */
1033+ long libnvme_ctrl_get_reconnect_count (libnvme_ctrl_t c );
1034+
10101035/**
10111036 * libnvme_ctrl_identify() - Issues an 'identify controller' command
10121037 * @c: Controller instance
You can’t perform that action at this time.
0 commit comments