linux/lib/kunit/static_stub.c

// SPDX-License-Identifier: GPL-2.0
/*
 * KUnit function redirection (static stubbing) API.
 *
 * Copyright (C) 2022, Google LLC.
 * Author: David Gow <[email protected]>
 */

#include <kunit/test.h>
#include <kunit/static_stub.h>
#include "hooks-impl.h"


/* Context for a static stub. This is stored in the resource data. */
struct kunit_static_stub_ctx {};

static void __kunit_static_stub_resource_free(struct kunit_resource *res)
{}

/* Matching function for kunit_find_resource(). match_data is real_fn_addr. */
static bool __kunit_static_stub_resource_match(struct kunit *test,
						struct kunit_resource *res,
						void *match_real_fn_addr)
{}

/* Hook to return the address of the replacement function. */
void *__kunit_get_static_stub_address_impl(struct kunit *test, void *real_fn_addr)
{}

void kunit_deactivate_static_stub(struct kunit *test, void *real_fn_addr)
{}
EXPORT_SYMBOL_GPL();

/* Helper function for kunit_activate_static_stub(). The macro does
 * typechecking, so use it instead.
 */
void __kunit_activate_static_stub(struct kunit *test,
				  void *real_fn_addr,
				  void *replacement_addr)
{}
EXPORT_SYMBOL_GPL();