@@ -72,14 +72,14 @@ struct krun_config
7272{
7373 void * handle ;
7474 void * handle_sev ;
75- void * handle_nitro ;
75+ void * handle_awsnitro ;
7676 bool sev ;
77- bool nitro ;
77+ bool awsnitro ;
7878 int32_t ctx_id ;
7979 int32_t ctx_id_sev ;
80- int32_t ctx_id_nitro ;
80+ int32_t ctx_id_awsnitro ;
8181 bool has_kvm ;
82- bool has_nitro ;
82+ bool has_awsnitro ;
8383};
8484
8585/* libkrun handler. */
@@ -312,31 +312,31 @@ libkrun_configure_flavor (void *cookie, yajl_val *config_tree, libcrun_container
312312 error (EXIT_FAILURE , 0 , "the container requires libkrun-sev but it's not available" );
313313
314314 close_handles [0 ] = kconf -> handle ;
315- close_handles [1 ] = kconf -> handle_nitro ;
315+ close_handles [1 ] = kconf -> handle_awsnitro ;
316316
317317 kconf -> handle = kconf -> handle_sev ;
318318 kconf -> ctx_id = kconf -> ctx_id_sev ;
319319 kconf -> sev = true;
320320 }
321321 else if (nitro_indicated )
322322 {
323- if (kconf -> handle_nitro == NULL )
324- error (EXIT_FAILURE , 0 , "the container requires libkrun-nitro but it's not available" );
323+ if (kconf -> handle_awsnitro == NULL )
324+ error (EXIT_FAILURE , 0 , "the container requires libkrun-awsnitro but it's not available" );
325325
326326 close_handles [0 ] = kconf -> handle ;
327327 close_handles [1 ] = kconf -> handle_sev ;
328328
329- kconf -> handle = kconf -> handle_nitro ;
330- kconf -> ctx_id = kconf -> ctx_id_nitro ;
331- kconf -> nitro = true;
329+ kconf -> handle = kconf -> handle_awsnitro ;
330+ kconf -> ctx_id = kconf -> ctx_id_awsnitro ;
331+ kconf -> awsnitro = true;
332332 }
333333 else
334334 {
335335 if (kconf -> handle == NULL )
336336 error (EXIT_FAILURE , 0 , "the container requires libkrun but it's not available" );
337337
338338 close_handles [0 ] = kconf -> handle_sev ;
339- close_handles [1 ] = kconf -> handle_nitro ;
339+ close_handles [1 ] = kconf -> handle_awsnitro ;
340340 }
341341
342342 // We no longer need the other two libkrun handles.
@@ -392,7 +392,7 @@ libkrun_exec (void *cookie, libcrun_container_t *container, const char *pathname
392392 }
393393
394394 // /dev/kvm is required for all non-nitro workloads.
395- if (! kconf -> nitro && ! kconf -> has_kvm )
395+ if (! kconf -> awsnitro && ! kconf -> has_kvm )
396396 error (EXIT_FAILURE , 0 , "`/dev/kvm` unavailable" );
397397
398398 handle = kconf -> handle ;
@@ -444,12 +444,12 @@ libkrun_exec (void *cookie, libcrun_container_t *container, const char *pathname
444444 error (EXIT_FAILURE , - ret , "could not set krun root" );
445445 }
446446
447- if (kconf -> nitro )
447+ if (kconf -> awsnitro )
448448 {
449449 krun_set_console_output = dlsym (handle , "krun_set_console_output" );
450450 krun_set_exec = dlsym (handle , "krun_set_exec" );
451451 if (krun_set_console_output == NULL || krun_set_exec == NULL )
452- error (EXIT_FAILURE , 0 , "could not find symbol in `libkrun-nitro .so`" );
452+ error (EXIT_FAILURE , 0 , "could not find symbol in `libkrun-awsnitro .so`" );
453453
454454 // Redirect all enclave output (read from vsock) to stdout.
455455 ret = krun_set_console_output (ctx_id , "/dev/stdout" );
@@ -530,7 +530,7 @@ libkrun_configure_container (void *cookie, enum handler_configure_phase phase,
530530 cleanup_close int devfd = -1 ;
531531 cleanup_close int rootfsfd_cleanup = -1 ;
532532 runtime_spec_schema_config_schema * def = container -> container_def ;
533- bool create_sev = false, create_nitro = false;
533+ bool create_sev = false, create_awsnitro = false;
534534 bool is_user_ns ;
535535
536536 if (rootfs == NULL )
@@ -596,14 +596,14 @@ libkrun_configure_container (void *cookie, enum handler_configure_phase phase,
596596 }
597597 }
598598
599- if (kconf -> handle_nitro != NULL )
599+ if (kconf -> handle_awsnitro != NULL )
600600 {
601- create_nitro = true;
601+ create_awsnitro = true;
602602 for (i = 0 ; i < def -> linux -> devices_len ; i ++ )
603603 {
604604 if (strcmp (def -> linux -> devices [i ]-> path , "/dev/nitro_enclaves" ) == 0 )
605605 {
606- create_nitro = false;
606+ create_awsnitro = false;
607607 break ;
608608 }
609609 }
@@ -637,15 +637,15 @@ libkrun_configure_container (void *cookie, enum handler_configure_phase phase,
637637 }
638638 }
639639
640- if (create_nitro )
640+ if (create_awsnitro )
641641 {
642642 ret = libcrun_create_dev (container , devfd , -1 , & nitro_device , is_user_ns , true, err );
643643 if (UNLIKELY (ret < 0 ))
644644 {
645- ret = dlclose (kconf -> handle_nitro );
645+ ret = dlclose (kconf -> handle_awsnitro );
646646 if (UNLIKELY (ret < 0 ))
647647 return ret ;
648- kconf -> handle_nitro = NULL ;
648+ kconf -> handle_awsnitro = NULL ;
649649 }
650650 }
651651
@@ -659,24 +659,24 @@ libkrun_load (void **cookie, libcrun_error_t *err)
659659 struct krun_config * kconf ;
660660 const char * libkrun_so = "libkrun.so.1" ;
661661 const char * libkrun_sev_so = "libkrun-sev.so.1" ;
662- const char * libkrun_nitro_so = "libkrun-nitro .so.1" ;
662+ const char * libkrun_awsnitro_so = "libkrun-awsnitro .so.1" ;
663663
664664 kconf = malloc (sizeof (struct krun_config ));
665665 if (kconf == NULL )
666666 return crun_make_error (err , 0 , "could not allocate memory for krun_config" );
667667
668668 kconf -> handle = dlopen (libkrun_so , RTLD_NOW );
669669 kconf -> handle_sev = dlopen (libkrun_sev_so , RTLD_NOW );
670- kconf -> handle_nitro = dlopen (libkrun_nitro_so , RTLD_NOW );
670+ kconf -> handle_awsnitro = dlopen (libkrun_awsnitro_so , RTLD_NOW );
671671
672- if (kconf -> handle == NULL && kconf -> handle_sev == NULL && kconf -> handle_nitro == NULL )
672+ if (kconf -> handle == NULL && kconf -> handle_sev == NULL && kconf -> handle_awsnitro == NULL )
673673 {
674674 free (kconf );
675- return crun_make_error (err , 0 , "failed to open `%s`, `%s`, and `%s` for krun_config: %s" , libkrun_so , libkrun_sev_so , libkrun_nitro_so , dlerror ());
675+ return crun_make_error (err , 0 , "failed to open `%s`, `%s`, and `%s` for krun_config: %s" , libkrun_so , libkrun_sev_so , libkrun_awsnitro_so , dlerror ());
676676 }
677677
678678 kconf -> sev = false;
679- kconf -> nitro = false;
679+ kconf -> awsnitro = false;
680680
681681 /* Newer versions of libkrun no longer link against libkrunfw and
682682 instead they open it when creating the context. This implies
@@ -697,12 +697,12 @@ libkrun_load (void **cookie, libcrun_error_t *err)
697697 goto error ;
698698 kconf -> ctx_id_sev = ret ;
699699 }
700- if (kconf -> handle_nitro )
700+ if (kconf -> handle_awsnitro )
701701 {
702- ret = libkrun_create_context (kconf -> handle_nitro , err );
702+ ret = libkrun_create_context (kconf -> handle_awsnitro , err );
703703 if (UNLIKELY (ret < 0 ))
704704 goto error ;
705- kconf -> ctx_id_nitro = ret ;
705+ kconf -> ctx_id_awsnitro = ret ;
706706 }
707707
708708 * cookie = kconf ;
@@ -714,8 +714,8 @@ libkrun_load (void **cookie, libcrun_error_t *err)
714714 dlclose (kconf -> handle );
715715 if (kconf -> handle_sev )
716716 dlclose (kconf -> handle_sev );
717- if (kconf -> handle_nitro )
718- dlclose (kconf -> handle_nitro );
717+ if (kconf -> handle_awsnitro )
718+ dlclose (kconf -> handle_awsnitro );
719719 free (kconf );
720720 return ret ;
721721}
@@ -740,11 +740,11 @@ libkrun_unload (void *cookie, libcrun_error_t *err)
740740 if (UNLIKELY (r != 0 ))
741741 return crun_make_error (err , 0 , "could not unload handle_sev: `%s`" , dlerror ());
742742 }
743- if (kconf -> handle_nitro != NULL )
743+ if (kconf -> handle_awsnitro != NULL )
744744 {
745- r = dlclose (kconf -> handle_nitro );
745+ r = dlclose (kconf -> handle_awsnitro );
746746 if (UNLIKELY (r != 0 ))
747- return crun_make_error (err , 0 , "could not unload handle_nitro : `%s`" , dlerror ());
747+ return crun_make_error (err , 0 , "could not unload handle_awsnitro : `%s`" , dlerror ());
748748 }
749749 free (kconf );
750750 }
@@ -779,8 +779,8 @@ libkrun_modify_oci_configuration (void *cookie arg_unused, libcrun_context_t *co
779779{
780780 const size_t device_size = sizeof (runtime_spec_schema_defs_linux_device_cgroup );
781781 struct krun_config * kconf = (struct krun_config * ) cookie ;
782- struct stat st_kvm , st_sev , st_nitro ;
783- bool has_kvm = true, has_sev = true, has_nitro = true;
782+ struct stat st_kvm , st_sev , st_awsnitro ;
783+ bool has_kvm = true, has_sev = true, has_awsnitro = true;
784784 size_t old_len , new_len ;
785785 int ret ;
786786
@@ -802,18 +802,18 @@ libkrun_modify_oci_configuration (void *cookie arg_unused, libcrun_context_t *co
802802 has_sev = false;
803803 }
804804
805- ret = stat ("/dev/nitro_enclaves" , & st_nitro );
805+ ret = stat ("/dev/nitro_enclaves" , & st_awsnitro );
806806 if (UNLIKELY (ret < 0 ))
807807 {
808808 if (errno != ENOENT )
809809 return crun_make_error (err , errno , "stat `/dev/nitro_enclaves`" );
810- has_nitro = false;
810+ has_awsnitro = false;
811811 }
812812
813813 kconf -> has_kvm = has_kvm ;
814- kconf -> has_nitro = has_nitro ;
814+ kconf -> has_awsnitro = has_awsnitro ;
815815
816- if (! has_kvm && ! has_nitro )
816+ if (! has_kvm && ! has_awsnitro )
817817 return 0 ;
818818
819819 /* spec says these are optional, ensure they exist so we can add our devices */
@@ -827,7 +827,7 @@ libkrun_modify_oci_configuration (void *cookie arg_unused, libcrun_context_t *co
827827 new_len = old_len ;
828828 if (has_kvm )
829829 new_len += has_sev ? 2 : 1 ;
830- if (has_nitro )
830+ if (has_awsnitro )
831831 new_len += 1 ;
832832
833833 def -> linux -> resources -> devices = xrealloc (def -> linux -> resources -> devices , device_size * (new_len + 1 ));
@@ -840,8 +840,8 @@ libkrun_modify_oci_configuration (void *cookie arg_unused, libcrun_context_t *co
840840 def -> linux -> resources -> devices [old_len ++ ] = make_oci_spec_dev ("a" , st_sev .st_rdev , true, "rwm" );
841841 }
842842
843- if (has_nitro )
844- def -> linux -> resources -> devices [old_len ++ ] = make_oci_spec_dev ("a" , st_nitro .st_rdev , true, "rwm" );
843+ if (has_awsnitro )
844+ def -> linux -> resources -> devices [old_len ++ ] = make_oci_spec_dev ("a" , st_awsnitro .st_rdev , true, "rwm" );
845845
846846 return 0 ;
847847}
0 commit comments