mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-19 01:37:22 +07:00
332f791dc9
The xenbus driver has an awful mixture of internally and globally visible headers: some of the internally used only stuff is defined in the global header include/xen/xenbus.h while some stuff defined in internal headers is used by other drivers, too. Clean this up by moving the externally used symbols to include/xen/xenbus.h and the symbols used internally only to a new header drivers/xen/xenbus/xenbus.h replacing xenbus_comms.h and xenbus_probe.h Signed-off-by: Juergen Gross <jgross@suse.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
69 lines
1.5 KiB
C
69 lines
1.5 KiB
C
#include <linux/slab.h>
|
|
#include <linux/types.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/fs.h>
|
|
|
|
#include <xen/page.h>
|
|
#include <xen/xenbus.h>
|
|
|
|
#include "xenfs.h"
|
|
|
|
static ssize_t xsd_read(struct file *file, char __user *buf,
|
|
size_t size, loff_t *off)
|
|
{
|
|
const char *str = (const char *)file->private_data;
|
|
return simple_read_from_buffer(buf, size, off, str, strlen(str));
|
|
}
|
|
|
|
static int xsd_release(struct inode *inode, struct file *file)
|
|
{
|
|
kfree(file->private_data);
|
|
return 0;
|
|
}
|
|
|
|
static int xsd_kva_open(struct inode *inode, struct file *file)
|
|
{
|
|
file->private_data = (void *)kasprintf(GFP_KERNEL, "0x%p",
|
|
xen_store_interface);
|
|
if (!file->private_data)
|
|
return -ENOMEM;
|
|
return 0;
|
|
}
|
|
|
|
static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
|
|
{
|
|
size_t size = vma->vm_end - vma->vm_start;
|
|
|
|
if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
|
|
return -EINVAL;
|
|
|
|
if (remap_pfn_range(vma, vma->vm_start,
|
|
virt_to_pfn(xen_store_interface),
|
|
size, vma->vm_page_prot))
|
|
return -EAGAIN;
|
|
|
|
return 0;
|
|
}
|
|
|
|
const struct file_operations xsd_kva_file_ops = {
|
|
.open = xsd_kva_open,
|
|
.mmap = xsd_kva_mmap,
|
|
.read = xsd_read,
|
|
.release = xsd_release,
|
|
};
|
|
|
|
static int xsd_port_open(struct inode *inode, struct file *file)
|
|
{
|
|
file->private_data = (void *)kasprintf(GFP_KERNEL, "%d",
|
|
xen_store_evtchn);
|
|
if (!file->private_data)
|
|
return -ENOMEM;
|
|
return 0;
|
|
}
|
|
|
|
const struct file_operations xsd_port_file_ops = {
|
|
.open = xsd_port_open,
|
|
.read = xsd_read,
|
|
.release = xsd_release,
|
|
};
|