@@ -31,6 +31,8 @@ static struct argp_option options[] = {
3131 {"owner" , 'o' , "int" , 0 , "owner of the destination files" },
3232 {"group" , 'g' , "int" , 0 , "group of the destination files" },
3333 {"selinux" , 's' , "string" , 0 , "selinux attributes for destination" },
34+ {"mb" , 'm' , "int" , 0 ,
35+ "amount of memory to allocate in MB (default: 100)" },
3436 {0 },
3537};
3638
@@ -44,6 +46,7 @@ static struct cl_args {
4446 const char * selinux ;
4547 uid_t owner ;
4648 gid_t group ;
49+ int mb ;
4750} cla ;
4851
4952static int cptofs ;
@@ -74,6 +77,9 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
7477 case 'g' :
7578 cla -> group = atoi (arg );
7679 break ;
80+ case 'm' :
81+ cla -> mb = atoi (arg );
82+ break ;
7783 case ARGP_KEY_ARG :
7884 // Capture all remaining arguments in our paths array and stop
7985 // parsing here. We treat the last one as the destination and
@@ -627,6 +633,7 @@ int main(int argc, char **argv)
627633
628634 cla .owner = (uid_t )- 1 ;
629635 cla .group = (gid_t )- 1 ;
636+ cla .mb = 100 ;
630637
631638 if (strstr (argv [0 ], "cptofs" )) {
632639 cptofs = 1 ;
@@ -664,7 +671,7 @@ int main(int argc, char **argv)
664671 }
665672 disk_id = ret ;
666673
667- ret = lkl_start_kernel ("mem=100M" );
674+ ret = lkl_start_kernel ("mem=%dM" , cla . mb );
668675 if (ret < 0 ) {
669676 fprintf (stderr , "failed to start kernel: %s\n" ,
670677 lkl_strerror (ret ));
0 commit comments