From b6f827d6939397e99d72b1dc8480c72364d8905c Mon Sep 17 00:00:00 2001 From: midipix Date: Tue, 1 Jan 2019 05:30:34 -0500 Subject: sofort: split-up: keep build-system elements, move extras to sofortex. --- src/driver/sfrt_unit_ctx.c | 61 ---------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/driver/sfrt_unit_ctx.c (limited to 'src/driver/sfrt_unit_ctx.c') diff --git a/src/driver/sfrt_unit_ctx.c b/src/driver/sfrt_unit_ctx.c deleted file mode 100644 index 630fdba..0000000 --- a/src/driver/sfrt_unit_ctx.c +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include "sofort_driver_impl.h" -#include "sofort_errinfo_impl.h" - -static int sfrt_free_unit_ctx_impl(struct sfrt_unit_ctx_impl * ctx, int ret) -{ - if (ctx) { - sfrt_unmap_input(&ctx->map); - free(ctx); - } - - return ret; -} - -int sfrt_get_unit_ctx( - const struct sfrt_driver_ctx * dctx, - const char * path, - struct sfrt_unit_ctx ** pctx) -{ - struct sfrt_unit_ctx_impl * ctx; - - if (!dctx) - return SFRT_CUSTOM_ERROR( - dctx,SFRT_ERR_NULL_CONTEXT); - - else if (!(ctx = calloc(1,sizeof(*ctx)))) - return SFRT_BUFFER_ERROR(dctx); - - sfrt_driver_set_ectx( - dctx,0,path); - - if (sfrt_map_input(dctx,-1,path,PROT_READ,&ctx->map)) - return sfrt_free_unit_ctx_impl(ctx, - SFRT_NESTED_ERROR(dctx)); - - ctx->path = path; - - ctx->uctx.path = &ctx->path; - ctx->uctx.map = &ctx->map; - - *pctx = &ctx->uctx; - return 0; -} - -void sfrt_free_unit_ctx(struct sfrt_unit_ctx * ctx) -{ - struct sfrt_unit_ctx_impl * ictx; - uintptr_t addr; - - if (ctx) { - addr = (uintptr_t)ctx - offsetof(struct sfrt_unit_ctx_impl,uctx); - ictx = (struct sfrt_unit_ctx_impl *)addr; - sfrt_free_unit_ctx_impl(ictx,0); - } -} -- cgit v1.2.3