Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ntsync: Introduce the ntsync driver and character device.

ntsync uses a misc device as the simplest and least intrusive uAPI interface.

Each file description on the device represents an isolated NT instance, intended
to correspond to a single NT virtual machine.

Signed-off-by: Elizabeth Figura <zfigura@codeweavers.com>
Link: https://lore.kernel.org/r/20240329000621.148791-2-zfigura@codeweavers.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Elizabeth Figura and committed by
Greg Kroah-Hartman
25b9cadb 26f0d3b1

+64
+11
drivers/misc/Kconfig
··· 506 506 507 507 If unsure, say N. 508 508 509 + config NTSYNC 510 + tristate "NT synchronization primitive emulation" 511 + help 512 + This module provides kernel support for emulation of Windows NT 513 + synchronization primitives. It is not a hardware driver. 514 + 515 + To compile this driver as a module, choose M here: the 516 + module will be called ntsync. 517 + 518 + If unsure, say N. 519 + 509 520 config VCPU_STALL_DETECTOR 510 521 tristate "Guest vCPU stall detector" 511 522 depends on OF && HAS_IOMEM
+1
drivers/misc/Makefile
··· 59 59 obj-$(CONFIG_UACCE) += uacce/ 60 60 obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o 61 61 obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o 62 + obj-$(CONFIG_NTSYNC) += ntsync.o 62 63 obj-$(CONFIG_HI6421V600_IRQ) += hi6421v600-irq.o 63 64 obj-$(CONFIG_OPEN_DICE) += open-dice.o 64 65 obj-$(CONFIG_GP_PCI1XXXX) += mchp_pci1xxxx/
+52
drivers/misc/ntsync.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * ntsync.c - Kernel driver for NT synchronization primitives 4 + * 5 + * Copyright (C) 2024 Elizabeth Figura <zfigura@codeweavers.com> 6 + */ 7 + 8 + #include <linux/fs.h> 9 + #include <linux/miscdevice.h> 10 + #include <linux/module.h> 11 + 12 + #define NTSYNC_NAME "ntsync" 13 + 14 + static int ntsync_char_open(struct inode *inode, struct file *file) 15 + { 16 + return nonseekable_open(inode, file); 17 + } 18 + 19 + static int ntsync_char_release(struct inode *inode, struct file *file) 20 + { 21 + return 0; 22 + } 23 + 24 + static long ntsync_char_ioctl(struct file *file, unsigned int cmd, 25 + unsigned long parm) 26 + { 27 + switch (cmd) { 28 + default: 29 + return -ENOIOCTLCMD; 30 + } 31 + } 32 + 33 + static const struct file_operations ntsync_fops = { 34 + .owner = THIS_MODULE, 35 + .open = ntsync_char_open, 36 + .release = ntsync_char_release, 37 + .unlocked_ioctl = ntsync_char_ioctl, 38 + .compat_ioctl = compat_ptr_ioctl, 39 + .llseek = no_llseek, 40 + }; 41 + 42 + static struct miscdevice ntsync_misc = { 43 + .minor = MISC_DYNAMIC_MINOR, 44 + .name = NTSYNC_NAME, 45 + .fops = &ntsync_fops, 46 + }; 47 + 48 + module_misc_device(ntsync_misc); 49 + 50 + MODULE_AUTHOR("Elizabeth Figura <zfigura@codeweavers.com>"); 51 + MODULE_DESCRIPTION("Kernel driver for NT synchronization primitives"); 52 + MODULE_LICENSE("GPL");