aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
authorRoland Dreier <rdreier@cisco.com>2009-12-18 12:41:24 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-22 12:27:34 -0500
commit628ff7c1d8d8466a5ad8078bd0206a130f8b8a51 (patch)
treecc7ab0c90849be38e200fc6ff6a3a09e3caf0405 /virt
parented2617585f39dd12fae38c657bba68b9779ea10d (diff)
anonfd: Allow making anon files read-only
It seems a couple places such as arch/ia64/kernel/perfmon.c and drivers/infiniband/core/uverbs_main.c could use anon_inode_getfile() instead of a private pseudo-fs + alloc_file(), if only there were a way to get a read-only file. So provide this by having anon_inode_getfile() create a read-only file if we pass O_RDONLY in flags. Signed-off-by: Roland Dreier <rolandd@cisco.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e1f2bf8d7b1e..b5af88167613 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1177,7 +1177,7 @@ static struct file_operations kvm_vcpu_fops = {
1177 */ 1177 */
1178static int create_vcpu_fd(struct kvm_vcpu *vcpu) 1178static int create_vcpu_fd(struct kvm_vcpu *vcpu)
1179{ 1179{
1180 return anon_inode_getfd("kvm-vcpu", &kvm_vcpu_fops, vcpu, 0); 1180 return anon_inode_getfd("kvm-vcpu", &kvm_vcpu_fops, vcpu, O_RDWR);
1181} 1181}
1182 1182
1183/* 1183/*
@@ -1638,7 +1638,7 @@ static int kvm_dev_ioctl_create_vm(void)
1638 kvm = kvm_create_vm(); 1638 kvm = kvm_create_vm();
1639 if (IS_ERR(kvm)) 1639 if (IS_ERR(kvm))
1640 return PTR_ERR(kvm); 1640 return PTR_ERR(kvm);
1641 fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, 0); 1641 fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, O_RDWR);
1642 if (fd < 0) 1642 if (fd < 0)
1643 kvm_put_kvm(kvm); 1643 kvm_put_kvm(kvm);
1644 1644