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_PRETTY,
cd4ace
	TAG_CATEGORY,
9d75af
	TAG_SECTIONS,
016925
	TAG_SYMBOLS,
ecf121
	TAG_STRINGS,
249590
	TAG_EXPSYMS,
249590
	TAG_IMPLIBS,
249590
	TAG_IMPSYMS,
249590
};
249590
eb4c04
struct pe_driver_ctx_impl {
df5be5
	struct pe_common_ctx        cctx;
df5be5
	struct pe_driver_ctx        ctx;
df5be5
	const struct pe_unit_ctx *  euctx;
df5be5
	const char *                eunit;
df5be5
	struct pe_error_info **     errinfp;
df5be5
	struct pe_error_info **     erricap;
df5be5
	struct pe_error_info *      erriptr[64];
df5be5
	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_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