Blame src/internal/perk_driver_impl.h

249590
#ifndef PE_DRIVER_IMPL_H
249590
#define PE_DRIVER_IMPL_H
249590
eb4c04
#include <stdint.h>
eb4c04
#include <stdio.h>
eb4c04
#include <sys/types.h>
eb4c04
eb4c04
#include <perk/perk.h>
eb4c04
#include <perk/perk_meta.h>
456cde
#include "argv/argv.h"
456cde
456cde
extern const struct argv_option pe_default_options[];
eb4c04
249590
enum app_tags {
249590
	TAG_HELP,
249590
	TAG_VERSION,
249590
	TAG_OUTPUT,
249590
	TAG_PRETTY,
249590
	TAG_EXPSYMS,
249590
	TAG_IMPLIBS,
249590
	TAG_IMPSYMS,
249590
};
249590
eb4c04
struct pe_driver_ctx_impl {
eb4c04
	struct pe_symbol_ctx	symctx;
eb4c04
	struct pe_output_ctx	outctx;
eb4c04
	struct pe_linker_ctx	lnkctx;
eb4c04
	struct pe_server_ctx	srvctx;
eb4c04
	struct pe_io_ctx	ioctx;
eb4c04
	struct pe_common_ctx	cctx;
eb4c04
	struct pe_driver_ctx	ctx;
9a382d
	const struct pe_unit_ctx * euctx;
9a382d
	const char *		eunit;
c9c5f7
	struct pe_error_info **	errinfp;
c9c5f7
	struct pe_error_info **	erricap;
c9c5f7
	struct pe_error_info *	erriptr[64];
c9c5f7
	struct pe_error_info	erribuf[64];
eb4c04
};
eb4c04
eb4c04
struct pe_unit_ctx_impl {
eb4c04
	const char *		path;
eb4c04
	struct pe_raw_image	map;
eb4c04
	struct pe_image_meta *	meta;
eb4c04
	struct pe_io_ctx	ioctx;
eb4c04
	struct pe_unit_ctx	uctx;
eb4c04
};
eb4c04
bc2468
bc2468
static inline struct pe_driver_ctx_impl * pe_get_driver_ictx(
bc2468
	const struct pe_driver_ctx * dctx)
bc2468
{
bc2468
        uintptr_t addr;
bc2468
bc2468
        if (dctx) {
bc2468
                addr = (uintptr_t)dctx - offsetof(struct pe_driver_ctx_impl,ctx);
bc2468
                return (struct pe_driver_ctx_impl *)addr;
bc2468
        }
bc2468
bc2468
        return 0;
bc2468
}
bc2468
9a382d
static inline void pe_driver_set_ectx(
9a382d
	const struct pe_driver_ctx * dctx,
9a382d
	const struct pe_unit_ctx *   uctx,
9a382d
	const char *                 unit)
9a382d
{
9a382d
	struct pe_driver_ctx_impl *  ictx;
9a382d
9a382d
	ictx        = pe_get_driver_ictx(dctx);
9a382d
	ictx->euctx = uctx;
9a382d
	ictx->eunit = unit;
9a382d
}
9a382d
249590
#endif