@@ -31,7 +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- {"kernel-parameters" , 'k' , "string" , 0 , "kernel parameters when booting linux" },
34+ {"mb" , 'm' , "int" , 0 ,
35+ "amount of memory to allocate in MB (default: 100)" },
3536 {0 },
3637};
3738
@@ -45,7 +46,7 @@ static struct cl_args {
4546 const char * selinux ;
4647 uid_t owner ;
4748 gid_t group ;
48- const char * kernel_parameters ;
49+ const int memory ;
4950} cla ;
5051
5152static int cptofs ;
@@ -76,8 +77,8 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
7677 case 'g' :
7778 cla -> group = atoi (arg );
7879 break ;
79- case 'k ' :
80- cla -> kernel_parameters = arg ;
80+ case 'm ' :
81+ cla -> memory = atoi ( arg ) ;
8182 break ;
8283 case ARGP_KEY_ARG :
8384 // Capture all remaining arguments in our paths array and stop
@@ -629,10 +630,11 @@ int main(int argc, char **argv)
629630 int i ;
630631 char mpoint [32 ];
631632 unsigned int disk_id ;
633+ char memory [16 ];
632634
633635 cla .owner = (uid_t )- 1 ;
634636 cla .group = (gid_t )- 1 ;
635- cla .kernel_parameters = "mem=100M" ;
637+ cla .memory = 100 ;
636638
637639 if (strstr (argv [0 ], "cptofs" )) {
638640 cptofs = 1 ;
@@ -670,7 +672,8 @@ int main(int argc, char **argv)
670672 }
671673 disk_id = ret ;
672674
673- ret = lkl_start_kernel (cla .kernel_parameters );
675+ snprintf (memory , sizeof (memory ), "mem=%dM" , cla .memory );
676+ ret = lkl_start_kernel (memory );
674677 if (ret < 0 ) {
675678 fprintf (stderr , "failed to start kernel: %s\n" ,
676679 lkl_strerror (ret ));
0 commit comments