1717static const char dash [101 ] = {[0 ... 99 ] = '-' };
1818int main ()
1919{
20- struct nvme_global_ctx * ctx ;
21- nvme_host_t h ;
22- nvme_subsystem_t s ;
23- nvme_ctrl_t c ;
24- nvme_path_t p ;
25- nvme_ns_t n ;
20+ struct libnvme_global_ctx * ctx ;
21+ libnvme_host_t h ;
22+ libnvme_subsystem_t s ;
23+ libnvme_ctrl_t c ;
24+ libnvme_path_t p ;
25+ libnvme_ns_t n ;
2626 int err ;
2727
28- ctx = nvme_create_global_ctx (stdout , DEFAULT_LOGLEVEL );
28+ ctx = libnvme_create_global_ctx (stdout , DEFAULT_LOGLEVEL );
2929 if (!ctx )
3030 return 1 ;
3131
32- err = nvme_scan_topology (ctx , NULL , NULL );
32+ err = libnvme_scan_topology (ctx , NULL , NULL );
3333 if (err ) {
34- nvme_free_global_ctx (ctx );
34+ libnvme_free_global_ctx (ctx );
3535 return 1 ;
3636 }
3737
3838 printf ("%-16s %-96s %-.16s\n" , "Subsystem" , "Subsystem-NQN" , "Controllers" );
3939 printf ("%-.16s %-.96s %-.16s\n" , dash , dash , dash );
4040
41- nvme_for_each_host (ctx , h ) {
42- nvme_for_each_subsystem (h , s ) {
41+ libnvme_for_each_host (ctx , h ) {
42+ libnvme_for_each_subsystem (h , s ) {
4343 bool first = true;
44- printf ("%-16s %-96s " , nvme_subsystem_get_name (s ),
45- nvme_subsystem_get_subsysnqn (s ));
44+ printf ("%-16s %-96s " , libnvme_subsystem_get_name (s ),
45+ libnvme_subsystem_get_subsysnqn (s ));
4646
47- nvme_subsystem_for_each_ctrl (s , c ) {
47+ libnvme_subsystem_for_each_ctrl (s , c ) {
4848 printf ("%s%s" , first ? "" : ", " ,
49- nvme_ctrl_get_name (c ));
49+ libnvme_ctrl_get_name (c ));
5050 first = false;
5151 }
5252 printf ("\n" );
@@ -59,29 +59,29 @@ int main()
5959 printf ("%-.8s %-.20s %-.40s %-.8s %-.6s %-.14s %-.12s %-.16s\n" , dash , dash ,
6060 dash , dash , dash , dash , dash , dash );
6161
62- nvme_for_each_host (ctx , h ) {
63- nvme_for_each_subsystem (h , s ) {
64- nvme_subsystem_for_each_ctrl (s , c ) {
62+ libnvme_for_each_host (ctx , h ) {
63+ libnvme_for_each_subsystem (h , s ) {
64+ libnvme_subsystem_for_each_ctrl (s , c ) {
6565 bool first = true;
6666
6767 printf ("%-8s %-20s %-40s %-8s %-6s %-14s %-12s " ,
68- nvme_ctrl_get_name (c ),
69- nvme_ctrl_get_serial (c ),
70- nvme_ctrl_get_model (c ),
71- nvme_ctrl_get_firmware (c ),
72- nvme_ctrl_get_transport (c ),
73- nvme_ctrl_get_traddr (c ),
74- nvme_subsystem_get_name (s ));
75-
76- nvme_ctrl_for_each_ns (c , n ) {
68+ libnvme_ctrl_get_name (c ),
69+ libnvme_ctrl_get_serial (c ),
70+ libnvme_ctrl_get_model (c ),
71+ libnvme_ctrl_get_firmware (c ),
72+ libnvme_ctrl_get_transport (c ),
73+ libnvme_ctrl_get_traddr (c ),
74+ libnvme_subsystem_get_name (s ));
75+
76+ libnvme_ctrl_for_each_ns (c , n ) {
7777 printf ("%s%s" , first ? "" : ", " ,
78- nvme_ns_get_name (n ));
78+ libnvme_ns_get_name (n ));
7979 first = false;
8080 }
8181
82- nvme_ctrl_for_each_path (c , p ) {
82+ libnvme_ctrl_for_each_path (c , p ) {
8383 printf ("%s%s" , first ? "" : ", " ,
84- nvme_ns_get_name ( nvme_path_get_ns (p )));
84+ libnvme_ns_get_name ( libnvme_path_get_ns (p )));
8585 first = false;
8686 }
8787 printf ("\n" );
@@ -93,29 +93,29 @@ int main()
9393 printf ("%-12s %-8s %-16s %-8s %-16s\n" , "Device" , "NSID" , "Sectors" , "Format" , "Controllers" );
9494 printf ("%-.12s %-.8s %-.16s %-.8s %-.16s\n" , dash , dash , dash , dash , dash );
9595
96- nvme_for_each_host (ctx , h ) {
97- nvme_for_each_subsystem (h , s ) {
98- nvme_subsystem_for_each_ctrl (s , c ) {
99- nvme_ctrl_for_each_ns (c , n )
96+ libnvme_for_each_host (ctx , h ) {
97+ libnvme_for_each_subsystem (h , s ) {
98+ libnvme_subsystem_for_each_ctrl (s , c ) {
99+ libnvme_ctrl_for_each_ns (c , n )
100100 printf ("%-12s %-8d %-16" PRIu64 " %-8d %s\n" ,
101- nvme_ns_get_name (n ),
102- nvme_ns_get_nsid (n ),
103- nvme_ns_get_lba_count (n ),
104- nvme_ns_get_lba_size (n ),
105- nvme_ctrl_get_name (c ));
101+ libnvme_ns_get_name (n ),
102+ libnvme_ns_get_nsid (n ),
103+ libnvme_ns_get_lba_count (n ),
104+ libnvme_ns_get_lba_size (n ),
105+ libnvme_ctrl_get_name (c ));
106106 }
107107
108- nvme_subsystem_for_each_ns (s , n ) {
108+ libnvme_subsystem_for_each_ns (s , n ) {
109109 bool first = true;
110110
111111 printf ("%-12s %-8d %-16" PRIu64 " %-8d " ,
112- nvme_ns_get_name (n ),
113- nvme_ns_get_nsid (n ),
114- nvme_ns_get_lba_count (n ),
115- nvme_ns_get_lba_size (n ));
116- nvme_subsystem_for_each_ctrl (s , c ) {
112+ libnvme_ns_get_name (n ),
113+ libnvme_ns_get_nsid (n ),
114+ libnvme_ns_get_lba_count (n ),
115+ libnvme_ns_get_lba_size (n ));
116+ libnvme_subsystem_for_each_ctrl (s , c ) {
117117 printf ("%s%s" , first ? "" : ", " ,
118- nvme_ctrl_get_name (c ));
118+ libnvme_ctrl_get_name (c ));
119119 first = false;
120120 }
121121 printf ("\n" );
0 commit comments