From 333bf0f71734c6e8f3c0d6e419f282c968efc7ae Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 16 Dec 2015 05:13:07 -0500 Subject: driver: added sfrt_create_driver_ctx(). --- src/driver/sfrt_driver_ctx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') 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); -- cgit v1.2.3