Blame src/internal/sofort_driver_impl.h

8805b2
#ifndef SOFORT_DRIVER_IMPL_H
8805b2
#define SOFORT_DRIVER_IMPL_H
f46039
f46039
#include <stdint.h>
f46039
#include <stdio.h>
f46039
#include <sys/types.h>
f46039
f46039
#include <sofort/sofort.h>
0090d8
#include "argv/argv.h"
0090d8
a04059
#define SFRT_OPTV_ELEMENTS 64
a04059
0090d8
extern const struct argv_option sfrt_default_options[];
f46039
f46039
enum app_tags {
f46039
	TAG_HELP,
f46039
	TAG_VERSION,
bbc20f
	TAG_OUTPUT_DUMMY,	/* dummy */
bbc20f
	TAG_OUTPUT_PROPERTY,	/* dummy */
f46039
};
f46039
f46039
struct sfrt_driver_ctx_impl {
7a0b56
	struct sfrt_common_ctx          cctx;
7a0b56
	struct sfrt_driver_ctx	        ctx;
7a0b56
	const  struct sfrt_unit_ctx *   euctx;
7a0b56
	const  char *                   eunit;
7a0b56
	struct sfrt_error_info **       errinfp;
7a0b56
	struct sfrt_error_info **       erricap;
7a0b56
	struct sfrt_error_info *        erriptr[64];
7a0b56
	struct sfrt_error_info	        erribuf[64];
f46039
};
f46039
f46039
struct sfrt_unit_ctx_impl {
f46039
	const char *		path;
f46039
	struct sfrt_input	map;
f46039
	struct sfrt_unit_ctx	uctx;
f46039
};
f46039
39a81c
static inline struct sfrt_driver_ctx_impl * sfrt_get_driver_ictx(
39a81c
	const struct sfrt_driver_ctx * dctx)
39a81c
{
39a81c
        uintptr_t addr;
39a81c
39a81c
        if (dctx) {
39a81c
                addr = (uintptr_t)dctx - offsetof(struct sfrt_driver_ctx_impl,ctx);
39a81c
                return (struct sfrt_driver_ctx_impl *)addr;
39a81c
        }
39a81c
39a81c
        return 0;
39a81c
}
39a81c
7a168e
static inline void sfrt_driver_set_ectx(
7a168e
	const struct sfrt_driver_ctx * dctx,
7a168e
	const struct sfrt_unit_ctx *   uctx,
7a168e
	const char *                   unit)
7a168e
{
7a168e
	struct sfrt_driver_ctx_impl *  ictx;
7a168e
7a168e
	ictx        = sfrt_get_driver_ictx(dctx);
7a168e
	ictx->euctx = uctx;
7a168e
	ictx->eunit = unit;
7a168e
}
7a168e
f46039
#endif