/* * Procfs support for lockd * * Copyright (c) 2014 Jeff Layton */ #include #include #include #include #include #include "netns.h" #include "procfs.h" /* * We only allow strings that start with 'Y', 'y', or '1'. */ static ssize_t nlm_end_grace_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) { char *data; struct lockd_net *ln = net_generic(current->nsproxy->net_ns, lockd_net_id); if (size < 1) return -EINVAL; data = simple_transaction_get(file, buf, size); if (IS_ERR(data)) return PTR_ERR(data); switch(data[0]) { case 'Y': case 'y': case '1': locks_end_grace(&ln->lockd_manager); break; default: return -EINVAL; } return size; } static ssize_t nlm_end_grace_read(struct file *file, char __user *buf, size_t size, loff_t *pos) { struct lockd_net *ln = net_generic(current->nsproxy->net_ns, lockd_net_id); char resp[3]; resp[0] = list_empty(&ln->lockd_manager.list) ? 'Y' : 'N'; resp[1] = '\n'; resp[2] = '\0'; return simple_read_from_buffer(buf, size, pos, resp, sizeof(resp)); } static const struct file_operations lockd_end_grace_operations = { .write = nlm_end_grace_write, .read = nlm_end_grace_read, .llseek = default_llseek, .release = simple_transaction_release, }; int __init lockd_create_procfs(void) { struct proc_dir_entry *entry; entry = proc_mkdir("fs/lockd", NULL); if (!entry) return -ENOMEM; entry = proc_create("nlm_end_grace", S_IRUGO|S_IWUSR, entry, &lockd_end_grace_operations); if (!entry) { remove_proc_entry("fs/lockd", NULL); return -ENOMEM; } return 0; } void __exit lockd_remove_procfs(void) { remove_proc_entry("fs/lockd/nlm_end_grace", NULL); remove_proc_entry("fs/lockd", NULL); } -emu/op-1.h?h=nds-private-remove'>logtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-24 12:38:43 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-24 12:38:43 -0800
commit0263d4ebd94b36280608e296cba39b924b6e832b (patch)
tree6e21b4b3d8e8fb12cdfcfd185d46992487265a9b /include/math-emu/op-1.h
parent19ca2c8fecb1592d623fe5e82d6796f8d446268d (diff)
parent7b9e1d89e1b6a3b99a8fdd949aa0f98dd5bf2f6b (diff)
Merge tag 'platform-drivers-x86-v4.10-4' of git://git.infradead.org/linux-platform-drivers-x86
Pull x86 platform-driver fixes from Andy Shevchenko: "This is my first pull request since I become a co-maintainer of Platform Drivers x86 subsystem. It's a bit bigger than usual due to material collected for almost two weeks in a row. MAINTAINERS: - Add myself to X86 PLATFORM DRIVERS as a co-maintainer ideapad-laptop: - handle ACPI event 1 intel_mid_powerbtn: - Set IRQ_ONESHOT surface3-wmi: - fix uninitialized symbol - Shut up unused-function warning mlx-platform: - free first dev on error" * tag 'platform-drivers-x86-v4.10-4' of git://git.infradead.org/linux-platform-drivers-x86: MAINTAINERS: Add myself to X86 PLATFORM DRIVERS as a co-maintainer platform/x86: ideapad-laptop: handle ACPI event 1 platform/x86: intel_mid_powerbtn: Set IRQ_ONESHOT platform/x86: surface3-wmi: fix uninitialized symbol platform/x86: surface3-wmi: Shut up unused-function warning platform/x86: mlx-platform: free first dev on error
Diffstat (limited to 'include/math-emu/op-1.h')