@@ -7888,32 +7888,33 @@ static int resv_report(int argc, char **argv, struct command *acmd, struct plugi
78887888 const char * numd = "number of dwords to transfer" ;
78897889 const char * eds = "request extended data structure" ;
78907890
7891+ _cleanup_nvme_transport_handle_ struct nvme_transport_handle * hdl = NULL ;
7892+ _cleanup_nvme_global_ctx_ struct nvme_global_ctx * ctx = NULL ;
78917893 _cleanup_free_ struct nvme_resv_status * status = NULL ;
78927894 _cleanup_free_ struct nvme_id_ctrl * ctrl = NULL ;
7893- _cleanup_nvme_global_ctx_ struct nvme_global_ctx * ctx = NULL ;
7894- _cleanup_nvme_transport_handle_ struct nvme_transport_handle * hdl = NULL ;
7895+ struct nvme_passthru_cmd cmd ;
78957896 nvme_print_flags_t flags ;
78967897 int err , size ;
78977898
78987899 struct config {
7899- __u32 namespace_id ;
7900+ __u32 nsid ;
79007901 __u32 numd ;
79017902 __u8 eds ;
79027903 bool raw_binary ;
79037904 };
79047905
79057906 struct config cfg = {
7906- .namespace_id = 0 ,
7907+ .nsid = 0 ,
79077908 .numd = 0 ,
79087909 .eds = false,
79097910 .raw_binary = false,
79107911 };
79117912
79127913 NVME_ARGS (opts ,
7913- OPT_UINT ("namespace-id" , 'n' , & cfg .namespace_id , namespace_id_desired ),
7914- OPT_UINT ("numd" , 'd' , & cfg .numd , numd ),
7915- OPT_FLAG ("eds" , 'e' , & cfg .eds , eds ),
7916- OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw_dump ));
7914+ OPT_UINT ("namespace-id" , 'n' , & cfg .nsid , namespace_id_desired ),
7915+ OPT_UINT ("numd" , 'd' , & cfg .numd , numd ),
7916+ OPT_FLAG ("eds" , 'e' , & cfg .eds , eds ),
7917+ OPT_FLAG ("raw-binary" , 'b' , & cfg .raw_binary , raw_dump ));
79177918
79187919 err = parse_and_open (& ctx , & hdl , argc , argv , desc , opts );
79197920 if (err )
@@ -7928,8 +7929,8 @@ static int resv_report(int argc, char **argv, struct command *acmd, struct plugi
79287929 if (cfg .raw_binary )
79297930 flags = BINARY ;
79307931
7931- if (!cfg .namespace_id ) {
7932- err = nvme_get_nsid (hdl , & cfg .namespace_id );
7932+ if (!cfg .nsid ) {
7933+ err = nvme_get_nsid (hdl , & cfg .nsid );
79337934 if (err < 0 ) {
79347935 nvme_show_error ("get-namespace-id: %s" , nvme_strerror (- err ));
79357936 return err ;
@@ -7960,16 +7961,8 @@ static int resv_report(int argc, char **argv, struct command *acmd, struct plugi
79607961 if (!status )
79617962 return - ENOMEM ;
79627963
7963- struct nvme_resv_report_args args = {
7964- .args_size = sizeof (args ),
7965- .nsid = cfg .namespace_id ,
7966- .eds = cfg .eds ,
7967- .len = size ,
7968- .report = status ,
7969- .timeout = nvme_cfg .timeout ,
7970- .result = NULL ,
7971- };
7972- err = nvme_resv_report (hdl , & args );
7964+ nvme_init_resv_report (& cmd , cfg .nsid , cfg .eds , false, status , size );
7965+ err = nvme_submit_io_passthru (hdl , & cmd , NULL );
79737966 if (!err )
79747967 nvme_show_resv_report (status , size , cfg .eds , flags );
79757968 else if (err > 0 )
0 commit comments