File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
tools/testing/selftests/ublk Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,12 @@ static const struct ublk_tgt_ops *tgt_ops_list[] = {
14
14
15
15
static const struct ublk_tgt_ops * ublk_find_tgt (const char * name )
16
16
{
17
- const struct ublk_tgt_ops * ops ;
18
17
int i ;
19
18
20
19
if (name == NULL )
21
20
return NULL ;
22
21
23
- for (i = 0 ; sizeof ( tgt_ops_list ) / sizeof ( ops ); i ++ )
22
+ for (i = 0 ; i < ARRAY_SIZE ( tgt_ops_list ); i ++ )
24
23
if (strcmp (tgt_ops_list [i ]-> name , name ) == 0 )
25
24
return tgt_ops_list [i ];
26
25
return NULL ;
Original file line number Diff line number Diff line change 30
30
#define min (a , b ) ((a) < (b) ? (a) : (b))
31
31
#endif
32
32
33
+ #define ARRAY_SIZE (x ) (sizeof(x) / sizeof(x[0]))
34
+
33
35
/****************** part 1: libublk ********************/
34
36
35
37
#define CTRL_DEV "/dev/ublk-control"
You can’t perform that action at this time.
0 commit comments