aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/kvm_main.c
diff options
context:
space:
mode:
authorLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-05-19 01:09:05 -0400
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-05-19 01:09:05 -0400
commitc203e45f069af47ca7623e4dcd8c00bfba2722e4 (patch)
tree4563115b6565dcfd97015c1c9366fb3d07cabf19 /virt/kvm/kvm_main.c
parenta94477da38e0b261a7ecea71f4c95a3bcd5be69c (diff)
parentb8291ad07a7f3b5b990900f0001198ac23ba893e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r--virt/kvm/kvm_main.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c82cf15730a1..f7ba099049ea 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -522,6 +522,7 @@ unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn)
522 return bad_hva(); 522 return bad_hva();
523 return (slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE); 523 return (slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE);
524} 524}
525EXPORT_SYMBOL_GPL(gfn_to_hva);
525 526
526/* 527/*
527 * Requires current->mm->mmap_sem to be held 528 * Requires current->mm->mmap_sem to be held
@@ -834,16 +835,9 @@ static const struct file_operations kvm_vcpu_fops = {
834 */ 835 */
835static int create_vcpu_fd(struct kvm_vcpu *vcpu) 836static int create_vcpu_fd(struct kvm_vcpu *vcpu)
836{ 837{
837 int fd, r; 838 int fd = anon_inode_getfd("kvm-vcpu", &kvm_vcpu_fops, vcpu);
838 struct inode *inode; 839 if (fd < 0)
839 struct file *file;
840
841 r = anon_inode_getfd(&fd, &inode, &file,
842 "kvm-vcpu", &kvm_vcpu_fops, vcpu);
843 if (r) {
844 kvm_put_kvm(vcpu->kvm); 840 kvm_put_kvm(vcpu->kvm);
845 return r;
846 }
847 return fd; 841 return fd;
848} 842}
849 843
@@ -1168,19 +1162,15 @@ static const struct file_operations kvm_vm_fops = {
1168 1162
1169static int kvm_dev_ioctl_create_vm(void) 1163static int kvm_dev_ioctl_create_vm(void)
1170{ 1164{
1171 int fd, r; 1165 int fd;
1172 struct inode *inode;
1173 struct file *file;
1174 struct kvm *kvm; 1166 struct kvm *kvm;
1175 1167
1176 kvm = kvm_create_vm(); 1168 kvm = kvm_create_vm();
1177 if (IS_ERR(kvm)) 1169 if (IS_ERR(kvm))
1178 return PTR_ERR(kvm); 1170 return PTR_ERR(kvm);
1179 r = anon_inode_getfd(&fd, &inode, &file, "kvm-vm", &kvm_vm_fops, kvm); 1171 fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm);
1180 if (r) { 1172 if (fd < 0)
1181 kvm_put_kvm(kvm); 1173 kvm_put_kvm(kvm);
1182 return r;
1183 }
1184 1174
1185 return fd; 1175 return fd;
1186} 1176}