linux/drivers/firmware/efi/test/efi_test.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * EFI Test Driver for Runtime Services
 *
 * Copyright(C) 2012-2016 Canonical Ltd.
 *
 * This driver exports EFI runtime services interfaces into userspace, which
 * allow to use and test UEFI runtime services provided by firmware.
 *
 */

#include <linux/miscdevice.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/efi.h>
#include <linux/security.h>
#include <linux/slab.h>
#include <linux/uaccess.h>

#include "efi_test.h"

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

/*
 * Count the bytes in 'str', including the terminating NULL.
 *
 * Note this function returns the number of *bytes*, not the number of
 * ucs2 characters.
 */
static inline size_t user_ucs2_strsize(efi_char16_t  __user *str)
{}

/*
 * Allocate a buffer and copy a ucs2 string from user space into it.
 */
static inline int
copy_ucs2_from_user_len(efi_char16_t **dst, efi_char16_t __user *src,
			size_t len)
{}

/*
 * Count the bytes in 'str', including the terminating NULL.
 *
 * Just a wrap for user_ucs2_strsize
 */
static inline int
get_ucs2_strsize_from_user(efi_char16_t __user *src, size_t *len)
{}

/*
 * Calculate the required buffer allocation size and copy a ucs2 string
 * from user space into it.
 *
 * This function differs from copy_ucs2_from_user_len() because it
 * calculates the size of the buffer to allocate by taking the length of
 * the string 'src'.
 *
 * If a non-zero value is returned, the caller MUST NOT access 'dst'.
 *
 * It is the caller's responsibility to free 'dst'.
 */
static inline int
copy_ucs2_from_user(efi_char16_t **dst, efi_char16_t __user *src)
{}

/*
 * Copy a ucs2 string to a user buffer.
 *
 * This function is a simple wrapper around copy_to_user() that does
 * nothing if 'src' is NULL, which is useful for reducing the amount of
 * NULL checking the caller has to do.
 *
 * 'len' specifies the number of bytes to copy.
 */
static inline int
copy_ucs2_to_user_len(efi_char16_t __user *dst, efi_char16_t *src, size_t len)
{}

static long efi_runtime_get_variable(unsigned long arg)
{}

static long efi_runtime_set_variable(unsigned long arg)
{}

static long efi_runtime_get_time(unsigned long arg)
{}

static long efi_runtime_set_time(unsigned long arg)
{}

static long efi_runtime_get_waketime(unsigned long arg)
{}

static long efi_runtime_set_waketime(unsigned long arg)
{}

static long efi_runtime_get_nextvariablename(unsigned long arg)
{}

static long efi_runtime_get_nexthighmonocount(unsigned long arg)
{}

static long efi_runtime_reset_system(unsigned long arg)
{}

static long efi_runtime_query_variableinfo(unsigned long arg)
{}

static long efi_runtime_query_capsulecaps(unsigned long arg)
{}

static long efi_runtime_get_supported_mask(unsigned long arg)
{}

static long efi_test_ioctl(struct file *file, unsigned int cmd,
							unsigned long arg)
{}

static int efi_test_open(struct inode *inode, struct file *file)
{}

static int efi_test_close(struct inode *inode, struct file *file)
{}

/*
 *	The various file operations we support.
 */
static const struct file_operations efi_test_fops =;

static struct miscdevice efi_test_dev =;

static int __init efi_test_init(void)
{}

static void __exit efi_test_exit(void)
{}

module_init();
module_exit(efi_test_exit);