/*
 * dm_services.h — userspace harness stub for the DragonFly DRM kernel build.
 * The kernel's real dm_services.h drags in the entire DRM/linux-compat stack;
 * the DML arithmetic under test only needs these symbols (see
 * dml_common_defs.h / dml_inline_defs.h / dml_logger.h usage):
 *   - DC_LOG_DML  (DTRACE logging sink)
 *   - ASSERT / BREAK_TO_DEBUGGER / ASSERT_CRITICAL (os_types.h semantics on a
 *     non-DEBUG_KERNEL_DC build: WARN_ON, i.e. NON-FATAL)
 */
#ifndef __HARNESS_DM_SERVICES_H__
#define __HARNESS_DM_SERVICES_H__

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <stdint.h>

struct dal_logger;		/* opaque; display_mode_lib.h only stores it */

extern unsigned long g_assert_count;
extern unsigned long g_dtrace_count;

#define DC_LOG_DML(str, ...) do { g_dtrace_count++; } while (0)

/* os_types.h, non-CONFIG_DEBUG_KERNEL_DC build: ASSERT is WARN_ON => the
 * kernel keeps running; only a console warning. Harness mirrors that. */
#define ASSERT(expr) do { \
	if (!(expr)) { \
		g_assert_count++; \
		fprintf(stderr, "ASSERT-WARN (%s:%d): %s\n", __FILE__, __LINE__, #expr); \
	} \
} while (0)

#define ASSERT_CRITICAL(expr) ASSERT(expr)
#define BREAK_TO_DEBUGGER() ASSERT(0)

#endif
