tools/testing/selftests/powerpc/papr_sysparm/papr_sysparm.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/powerpc/papr_sysparm/papr_sysparm.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/powerpc/papr_sysparm/papr_sysparm.c
Extension
.c
Size
4265 bytes
Lines
197
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

struct sysparm_test {
	int (*function)(void);
	const char *description;
};

static const struct sysparm_test sysparm_tests[] = {
	{
		.function = open_close,
		.description = "open and close " DEVPATH " without issuing commands",
	},
	{
		.function = get_splpar,
		.description = "retrieve SPLPAR characteristics",
	},
	{
		.function = get_bad_parameter,
		.description = "verify EOPNOTSUPP for known-bad parameter",
	},
	{
		.function = check_efault_get,
		.description = "PAPR_SYSPARM_IOC_GET returns EFAULT on bad address",
	},
	{
		.function = check_efault_set,
		.description = "PAPR_SYSPARM_IOC_SET returns EFAULT on bad address",
	},
	{
		.function = set_hmc0,
		.description = "ensure EPERM on attempt to update HMC0",
	},
	{
		.function = set_with_ro_fd,
		.description = "PAPR_IOC_SYSPARM_SET returns EACCES on read-only fd",
	},
};

int main(void)
{
	size_t fails = 0;

	for (size_t i = 0; i < ARRAY_SIZE(sysparm_tests); ++i) {
		const struct sysparm_test *t = &sysparm_tests[i];

		if (test_harness(t->function, t->description))
			++fails;
	}

	return fails == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}

Annotation

Implementation Notes