diff options
Diffstat (limited to 'src/driver/sfrt_driver_ctx.c')
-rw-r--r-- | src/driver/sfrt_driver_ctx.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/driver/sfrt_driver_ctx.c b/src/driver/sfrt_driver_ctx.c index bec02f6..58ea3ce 100644 --- a/src/driver/sfrt_driver_ctx.c +++ b/src/driver/sfrt_driver_ctx.c @@ -142,6 +142,26 @@ int sfrt_get_driver_ctx( return SFRT_OK; } +int sfrt_create_driver_ctx( + const struct sfrt_common_ctx * cctx, + struct sfrt_driver_ctx ** pctx) +{ + struct argv_meta * meta; + struct sfrt_driver_ctx_impl * ctx; + const char * argv[] = {"sofort_driver",0}; + + if (!(meta = argv_get(argv,sfrt_default_options,0))) + return -1; + + if (!(ctx = sfrt_driver_ctx_alloc(meta,0))) + return sfrt_get_driver_ctx_fail(0); + + ctx->ctx.cctx = &ctx->cctx; + memcpy(&ctx->cctx,cctx,sizeof(*cctx)); + *pctx = &ctx->ctx; + return SFRT_OK; +} + static void sfrt_free_driver_ctx_impl(struct sfrt_driver_ctx_alloc * ictx) { argv_free(ictx->meta); |