sched: Remove double_rq_lock() from __migrate_task()
[linux/fpc-iii.git] / drivers / xen / xenfs / xenstored.c
blobfef20dbc6a5c2dfada86792f4eea7e7a631085e8
1 #include <linux/slab.h>
2 #include <linux/types.h>
3 #include <linux/mm.h>
4 #include <linux/fs.h>
6 #include <xen/page.h>
8 #include "xenfs.h"
9 #include "../xenbus/xenbus_comms.h"
11 static ssize_t xsd_read(struct file *file, char __user *buf,
12 size_t size, loff_t *off)
14 const char *str = (const char *)file->private_data;
15 return simple_read_from_buffer(buf, size, off, str, strlen(str));
18 static int xsd_release(struct inode *inode, struct file *file)
20 kfree(file->private_data);
21 return 0;
24 static int xsd_kva_open(struct inode *inode, struct file *file)
26 file->private_data = (void *)kasprintf(GFP_KERNEL, "0x%p",
27 xen_store_interface);
28 if (!file->private_data)
29 return -ENOMEM;
30 return 0;
33 static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
35 size_t size = vma->vm_end - vma->vm_start;
37 if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
38 return -EINVAL;
40 if (remap_pfn_range(vma, vma->vm_start,
41 virt_to_pfn(xen_store_interface),
42 size, vma->vm_page_prot))
43 return -EAGAIN;
45 return 0;
48 const struct file_operations xsd_kva_file_ops = {
49 .open = xsd_kva_open,
50 .mmap = xsd_kva_mmap,
51 .read = xsd_read,
52 .release = xsd_release,
55 static int xsd_port_open(struct inode *inode, struct file *file)
57 file->private_data = (void *)kasprintf(GFP_KERNEL, "%d",
58 xen_store_evtchn);
59 if (!file->private_data)
60 return -ENOMEM;
61 return 0;
64 const struct file_operations xsd_port_file_ops = {
65 .open = xsd_port_open,
66 .read = xsd_read,
67 .release = xsd_release,