@@ -236,13 +236,15 @@ typedef struct dev_info {
236236
237237static const stress_help_t help [] = {
238238 { NULL , "dev N" , "start N device entry thrashing stressors" },
239+ { NULL , "dev-alldev" , "exercise all devices (rather than just /dev/devname0)" },
239240 { NULL , "dev-file name" ,"specify the /dev/ file to exercise" },
240241 { NULL , "dev-ops N" , "stop after N device thrashing bogo ops" },
241242 { NULL , NULL , NULL }
242243};
243244
244245static const stress_opt_t opts [] = {
245- { OPT_dev_file , "dev-file" , TYPE_ID_STR , 0 , 0 , NULL },
246+ { OPT_dev_alldev , "dev-alldev" , TYPE_ID_BOOL , 0 , 1 , NULL },
247+ { OPT_dev_file , "dev-file" , TYPE_ID_STR , 0 , 0 , NULL },
246248 END_OPT ,
247249};
248250
@@ -4467,7 +4469,8 @@ static void stress_dev_infos_get(
44674469 const char * path ,
44684470 const char * tty_name ,
44694471 dev_info_t * * list ,
4470- size_t * list_len )
4472+ size_t * list_len ,
4473+ const bool dev_alldev )
44714474{
44724475 struct dirent * * dlist ;
44734476 int i ;
@@ -4498,10 +4501,10 @@ static void stress_dev_infos_get(
44984501 len = shim_strlen (d -> d_name );
44994502
45004503 /*
4501- * Exercise no more than 3 of the same device
4504+ * Exercise no more than 1 of the same device
45024505 * driver, e.g. ttyS0..ttyS1
45034506 */
4504- if (len > 1 ) {
4507+ if (! dev_alldev && ( len > 1 ) ) {
45054508 int dev_n ;
45064509 char * ptr = d -> d_name + len - 1 ;
45074510
@@ -4510,10 +4513,11 @@ static void stress_dev_infos_get(
45104513 ptr ++ ;
45114514 if (sscanf (ptr , "%d" , & dev_n ) != 1 )
45124515 continue ;
4513- if (dev_n > 2 )
4516+ if (dev_n > 1 )
45144517 continue ;
45154518 }
45164519
4520+
45174521 (void )stress_fs_make_filename (tmp , sizeof (tmp ), path , d -> d_name );
45184522
45194523 /* Don't exercise our tty */
@@ -4527,7 +4531,7 @@ static void stress_dev_infos_get(
45274531 continue ;
45284532 if ((statbuf .st_mode & flags ) == 0 )
45294533 continue ;
4530- stress_dev_infos_get (args , tmp , tty_name , list , list_len );
4534+ stress_dev_infos_get (args , tmp , tty_name , list , list_len , dev_alldev );
45314535 break ;
45324536 case SHIM_DT_BLK :
45334537 case SHIM_DT_CHR :
@@ -4766,6 +4770,7 @@ static int stress_dev(stress_args_t *args)
47664770 size_t dev_info_list_len = 0 ;
47674771 sys_dev_info_t * sys_dev_info_list = NULL ;
47684772 sys_dev_info_t * sys_dev_info_list_end = NULL ;
4773+ bool dev_alldev = false;
47694774
47704775 stress_dev_state_init (& dev_state_null );
47714776
@@ -4774,6 +4779,7 @@ static int stress_dev(stress_args_t *args)
47744779
47754780 (void )shim_memset (ret , 0 , sizeof (ret ));
47764781
4782+ (void )stress_setting_get ("dev-alldev" , & dev_alldev );
47774783 (void )stress_setting_get ("dev-file" , & dev_file );
47784784 if (dev_file ) {
47794785 mode_t mode ;
@@ -4793,7 +4799,7 @@ static int stress_dev(stress_args_t *args)
47934799
47944800 stress_dev_info_add (args , dev_file , & dev_info_list , & dev_info_list_len , true);
47954801 } else {
4796- stress_dev_infos_get (args , "/dev" , tty_name , & dev_info_list , & dev_info_list_len );
4802+ stress_dev_infos_get (args , "/dev" , tty_name , & dev_info_list , & dev_info_list_len , dev_alldev );
47974803 stress_sys_dev_infos_get (args , "/sys/dev" , & sys_dev_info_list , & sys_dev_info_list_end , 0 );
47984804 }
47994805
0 commit comments