Blame src/internal/toksvc_driver_impl.h

c0069e
#ifndef TOKSVC_DRIVER_IMPL_H
c0069e
#define TOKSVC_DRIVER_IMPL_H
c0069e
c0069e
#include <psxtypes/psxtypes.h>
c0069e
#include <ntapi/ntapi.h>
c0069e
c0069e
#include <stdint.h>
c0069e
#include <stdio.h>
c0069e
c0069e
#include <toksvc/toksvc.h>
c0069e
#include "argv/argv.h"
c0069e
c0069e
#define TOKS_OPTV_ELEMENTS 64
c0069e
c0069e
extern   const struct argv_option toks_default_options[];
c0069e
extern   const ntapi_vtbl * toks_ntapi;
c0069e
c0069e
#define  ntapi toks_ntapi
c0069e
c0069e
enum app_tags {
c0069e
	TAG_HELP,
c0069e
	TAG_VERSION,
c0069e
	TAG_DAEMON,
c0069e
	TAG_SYSROOT,
618937
	TAG_UUID,
c0069e
};
c0069e
c0069e
struct toks_client_ctx {
c0069e
	void *			hprocess;
c0069e
	void *			hthread;
c0069e
	nt_cid			cid;
c0069e
	nt_pty_client_info	clinfo;
c0069e
};
c0069e
c0069e
struct toks_driver_ctx_impl {
c0069e
	nt_rtdata *		rtdata;
c0069e
	struct toks_client_ctx	clctx;
c0069e
	struct toks_common_ctx	cctx;
c0069e
	struct toks_driver_ctx	ctx;
618937
	nt_guid			uuid;
c0069e
};
c0069e
c0069e
static inline struct toks_driver_ctx_impl * toks_get_driver_ictx(const struct toks_driver_ctx * dctx)
c0069e
{
c0069e
	uintptr_t addr;
c0069e
c0069e
	if (dctx) {
c0069e
		addr = (uintptr_t)dctx - offsetof(struct toks_driver_ctx_impl,ctx);
c0069e
		return (struct toks_driver_ctx_impl *)addr;
c0069e
	}
c0069e
c0069e
	return 0;
c0069e
}
c0069e
618937
static inline nt_rtdata * toks_get_driver_rtdata(const struct toks_driver_ctx * dctx)
618937
{
618937
	struct toks_driver_ctx_impl * ictx;
618937
	ictx = toks_get_driver_ictx(dctx);
618937
	return ictx->rtdata;
618937
}
618937
618937
static inline const nt_guid * toks_get_driver_uuid(const struct toks_driver_ctx * dctx)
618937
{
618937
	struct toks_driver_ctx_impl * ictx;
618937
	ictx = toks_get_driver_ictx(dctx);
618937
	return &ictx->uuid;
618937
}
618937
2a7aec
int32_t toks_open_file(void ** hfile, void * hat, const char * arg, bool fprivate);
2a7aec
int32_t toks_open_dir(void ** hfile, void * hat, const char * arg, bool fprivate);
2a7aec
c0069e
#endif