diff options
author | midipix <writeonce@midipix.org> | 2015-12-16 05:13:07 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2015-12-16 05:13:07 -0500 |
commit | 333bf0f71734c6e8f3c0d6e419f282c968efc7ae (patch) | |
tree | 123b377eb7b7f3b5a1e4e994c12ee9ef51bc8e43 /src/driver/sfrt_driver_ctx.c | |
parent | e17a99b6b1c16b2c5ab2c23d4c51ea335a707474 (diff) | |
download | sofort-333bf0f71734c6e8f3c0d6e419f282c968efc7ae.tar.bz2 sofort-333bf0f71734c6e8f3c0d6e419f282c968efc7ae.tar.xz |
driver: added sfrt_create_driver_ctx().
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); |