@@ -14,6 +14,7 @@ pub struct CmdlineOptions {
1414 pub nfsroot : Option < String > ,
1515 pub init : String ,
1616 pub cleanup : bool ,
17+ pub bind_mount : Option < String > ,
1718}
1819
1920const SBIN_INIT : & str = "/sbin/init" ;
@@ -28,6 +29,7 @@ impl Default for CmdlineOptions {
2829 nfsroot : None ,
2930 init : SBIN_INIT . into ( ) ,
3031 cleanup : true ,
32+ bind_mount : None ,
3133 }
3234 }
3335}
@@ -45,6 +47,7 @@ fn parse_option(key: &str, value: Option<&str>, options: &mut CmdlineOptions) ->
4547 "rw" => options. rootfsflags . remove ( MsFlags :: MS_RDONLY ) ,
4648 "nfsroot" => options. nfsroot = Some ( ensure_value ( key, value) ?. to_string ( ) ) ,
4749 "init" => options. init = ensure_value ( key, value) ?. into ( ) ,
50+ "rsinit.bind" => options. bind_mount = Some ( ensure_value ( key, value) ?. to_string ( ) ) ,
4851 _ => ( ) ,
4952 }
5053 Ok ( ( ) )
@@ -236,4 +239,19 @@ mod tests {
236239
237240 assert_eq ! ( options, expected) ;
238241 }
242+
243+ #[ test]
244+ fn test_rsinit_bind ( ) {
245+ let cmdline = "root=/dev/root rsinit.bind=/lib/modules\n " ;
246+
247+ let expected = CmdlineOptions {
248+ root : Some ( "/dev/root" . into ( ) ) ,
249+ bind_mount : Some ( "/lib/modules" . into ( ) ) ,
250+ ..Default :: default ( )
251+ } ;
252+
253+ let options = parse_cmdline ( cmdline) . expect ( "failed" ) ;
254+
255+ assert_eq ! ( options, expected) ;
256+ }
239257}
0 commit comments