@@ -600,6 +600,34 @@ vbdev_crypto_delete_name(struct bdev_names *name)
600
600
free (name );
601
601
}
602
602
603
+ /* For the named crypto vbdev and the named base bdev, create the crypto opts */
604
+ struct vbdev_crypto_opts *
605
+ create_crypto_opts_by_name (char * name , char * base_bdev_name , struct spdk_accel_crypto_key * key ,
606
+ bool key_owner )
607
+ {
608
+ struct vbdev_crypto_opts * opts = calloc (1 , sizeof (* opts ));
609
+
610
+ if (!opts ) {
611
+ return NULL ;
612
+ }
613
+
614
+ opts -> bdev_name = strdup (base_bdev_name );
615
+ if (!opts -> bdev_name ) {
616
+ free_crypto_opts (opts );
617
+ return NULL ;
618
+ }
619
+ opts -> vbdev_name = strdup (name );
620
+ if (!opts -> vbdev_name ) {
621
+ free_crypto_opts (opts );
622
+ return NULL ;
623
+ }
624
+
625
+ opts -> key = key ;
626
+ opts -> key_owner = key_owner ;
627
+
628
+ return opts ;
629
+ }
630
+
603
631
/* RPC entry point for crypto creation. */
604
632
int
605
633
create_crypto_disk (struct vbdev_crypto_opts * opts )
@@ -929,6 +957,21 @@ delete_crypto_disk(const char *bdev_name, spdk_delete_crypto_complete cb_fn,
929
957
}
930
958
}
931
959
960
+ /* Get the base bdev corresponding to the given vbdev name. */
961
+ struct spdk_bdev *
962
+ vbdev_crypto_disk_get_base_bdev (const char * vbdev_name )
963
+ {
964
+ struct vbdev_crypto * crypto_vbdev ;
965
+
966
+ TAILQ_FOREACH (crypto_vbdev , & g_vbdev_crypto , link ) {
967
+ if (strcmp (crypto_vbdev -> crypto_bdev .name , vbdev_name ) == 0 ) {
968
+ return crypto_vbdev -> base_bdev ;
969
+ }
970
+ }
971
+
972
+ return NULL ;
973
+ }
974
+
932
975
/* Because we specified this function in our crypto bdev function table when we
933
976
* registered our crypto bdev, we'll get this call anytime a new bdev shows up.
934
977
* Here we need to decide if we care about it and if so what to do. We
0 commit comments