@@ -204,6 +204,7 @@ static const char *doper = "directive operation";
204204static const char * dry = "show command instead of sending" ;
205205static const char * dspec_w_dtype = "directive specification associated with directive type" ;
206206static const char * dtype = "directive type" ;
207+ static const char * endgid = "Endurance Group Identifier (ENDGID)" ;
207208static const char * force_unit_access = "force device to commit data before command completes" ;
208209static const char * human_readable_directive = "show directive in readable format" ;
209210static const char * human_readable_identify = "show identify in readable format" ;
@@ -3096,7 +3097,6 @@ static int create_ns(int argc, char **argv, struct command *cmd, struct plugin *
30963097 const char * nmic = "multipath and sharing capabilities (NMIC)" ;
30973098 const char * anagrpid = "ANA Group Identifier (ANAGRPID)" ;
30983099 const char * nvmsetid = "NVM Set Identifier (NVMSETID)" ;
3099- const char * endgid = "Endurance Group Identifier (ENDGID)" ;
31003100 const char * csi = "command set identifier (CSI)" ;
31013101 const char * lbstm = "logical block storage tag mask (LBSTM)" ;
31023102 const char * nphndls = "Number of Placement Handles (NPHNDLS)" ;
@@ -10091,6 +10091,53 @@ static int get_mgmt_addr_list_log(int argc, char **argv, struct command *cmd, st
1009110091 return err ;
1009210092}
1009310093
10094+ static int get_rotational_media_info_log (int argc , char * * argv , struct command * cmd ,
10095+ struct plugin * plugin )
10096+ {
10097+ const char * desc = "Retrieve Rotational Media Information Log, show it" ;
10098+ nvme_print_flags_t flags ;
10099+ int err = -1 ;
10100+
10101+ _cleanup_free_ struct nvme_rotational_media_info_log * info = NULL ;
10102+
10103+ _cleanup_nvme_dev_ struct nvme_dev * dev = NULL ;
10104+
10105+ struct config {
10106+ __u16 endgid ;
10107+ };
10108+
10109+ struct config cfg = {
10110+ .endgid = 0 ,
10111+ };
10112+
10113+ NVME_ARGS (opts ,
10114+ OPT_UINT ("endg-id" , 'e' , & cfg .endgid , endgid ));
10115+
10116+ err = parse_and_open (& dev , argc , argv , desc , opts );
10117+ if (err )
10118+ return err ;
10119+
10120+ err = validate_output_format (nvme_cfg .output_format , & flags );
10121+ if (err < 0 ) {
10122+ nvme_show_error ("Invalid output format" );
10123+ return err ;
10124+ }
10125+
10126+ info = nvme_alloc (sizeof (* info ));
10127+ if (!info )
10128+ return - ENOMEM ;
10129+
10130+ err = nvme_cli_get_log_rotational_media_info (dev , cfg .endgid , sizeof (* info ), info );
10131+ if (!err )
10132+ nvme_show_rotational_media_info_log (info , flags );
10133+ else if (err > 0 )
10134+ nvme_show_status (err );
10135+ else
10136+ nvme_show_perror ("rotational media info log" );
10137+
10138+ return err ;
10139+ }
10140+
1009410141void register_extension (struct plugin * plugin )
1009510142{
1009610143 plugin -> parent = & nvme ;
0 commit comments