#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "xenbus_comms.h" static int xenbus_backend_open(struct inode *inode, struct file *filp) { if (!capable(CAP_SYS_ADMIN)) return -EPERM; return nonseekable_open(inode, filp); } static long xenbus_alloc(domid_t domid) { struct evtchn_alloc_unbound arg; int err = -EEXIST; xs_suspend(); /* If xenstored_ready is nonzero, that means we have already talked to * xenstore and set up watches. These watches will be restored by * xs_resume, but that requires communication over the port established * below that is not visible to anyone until the ioctl returns. * * This can be resolved by splitting the ioctl into two parts * (postponing the resume until xenstored is active) but this is * unnecessarily complex for the intended use where xenstored is only * started once - so return -EEXIST if it's already running. */ if (xenstored_ready) goto out_err; gnttab_grant_foreign_access_ref(GNTTAB_RESERVED_XENSTORE, domid, virt_to_gfn(xen_store_interface), 0 /* writable */); arg.dom = DOMID_SELF; arg.remote_dom = domid; err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &arg); if (err) goto out_err; if (xen_store_evtchn > 0) xb_deinit_comms(); xen_store_evtchn = arg.port; xs_resume(); return arg.port; out_err: xs_suspend_cancel(); return err; } static long xenbus_backend_ioctl(struct file *file, unsigned int cmd, unsigned long data) { if (!capable(CAP_SYS_ADMIN)) return -EPERM; switch (cmd) { case IOCTL_XENBUS_BACKEND_EVTCHN: if (xen_store_evtchn > 0) return xen_store_evtchn; return -ENODEV; case IOCTL_XENBUS_BACKEND_SETUP: return xenbus_alloc(data); default: return -ENOTTY; } } static int xenbus_backend_mmap(struct file *file, struct vm_area_struct *vma) { size_t size = vma->vm_end - vma->vm_start; if (!capable(CAP_SYS_ADMIN)) return -EPERM; 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; } static const struct file_operations xenbus_backend_fops = { .open = xenbus_backend_open, .mmap = xenbus_backend_mmap, .unlocked_ioctl = xenbus_backend_ioctl, }; static struct miscdevice xenbus_backend_dev = { .minor = MISC_DYNAMIC_MINOR, .name = "xen/xenbus_backend", .fops = &xenbus_backend_fops, }; static int __init xenbus_backend_init(void) { int err; if (!xen_initial_domain()) return -ENODEV; err = misc_register(&xenbus_backend_dev); if (err) pr_err("Could not register xenbus backend device\n"); return err; } device_initcall(xenbus_backend_init); nds-private-remove&id=075ad765ef7541b2860de8408c165a92b78aefa3&showmsg=1'>net/phonet
31'/>
AgeCommit message (Collapse)AuthorFilesLines
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 14:05:56 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 14:05:56 -0800
commitb272f732f888d4cf43c943a40c9aaa836f9b7431 (patch)
treeda9cac6b9d12b83592c16d3503c0e3f2f00f146f /net/ipv4/Makefile
parent10bbe7599e2755d3f3e100103967788b8b5a4bce (diff)
parent008b69e4d52f2cbee3ed0d0502edd78155000b1a (diff)
Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull SMP hotplug notifier removal from Thomas Gleixner: "This is the final cleanup of the hotplug notifier infrastructure. The series has been reintgrated in the last two days because there came a new driver using the old infrastructure via the SCSI tree. Summary: - convert the last leftover drivers utilizing notifiers - fixup for a completely broken hotplug user - prevent setup of already used states - removal of the notifiers - treewide cleanup of hotplug state names - consolidation of state space There is a sphinx based documentation pending, but that needs review from the documentation folks" * 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: irqchip/armada-xp: Consolidate hotplug state space irqchip/gic: Consolidate hotplug state space coresight/etm3/4x: Consolidate hotplug state space cpu/hotplug: Cleanup state names cpu/hotplug: Remove obsolete cpu hotplug register/unregister functions staging/lustre/libcfs: Convert to hotplug state machine scsi/bnx2i: Convert to hotplug state machine scsi/bnx2fc: Convert to hotplug state machine cpu/hotplug: Prevent overwriting of callbacks x86/msr: Remove bogus cleanup from the error path bus: arm-ccn: Prevent hotplug callback leak perf/x86/intel/cstate: Prevent hotplug callback leak ARM/imx/mmcd: Fix broken cpu hotplug handling scsi: qedi: Convert to hotplug state machine
Diffstat (limited to 'net/ipv4/Makefile')