vhost.c (dd0a11815a339d6deeea8357574f8126a8404c92) | vhost.c (59566b6e8cc8f8a05022e0f01a1b90974003f092) |
---|---|
1/* Copyright (C) 2009 Red Hat, Inc. 2 * Copyright (C) 2006 Rusty Russell IBM Corporation 3 * 4 * Author: Michael S. Tsirkin <mst@redhat.com> 5 * 6 * Inspiration, some code, and most witty comments come from 7 * Documentation/virtual/lguest/lguest.c, by Rusty Russell 8 * --- 276 unchanged lines hidden (view full) --- 285static void vhost_dev_free_iovecs(struct vhost_dev *dev) 286{ 287 int i; 288 289 for (i = 0; i < dev->nvqs; ++i) 290 vhost_vq_free_iovecs(dev->vqs[i]); 291} 292 | 1/* Copyright (C) 2009 Red Hat, Inc. 2 * Copyright (C) 2006 Rusty Russell IBM Corporation 3 * 4 * Author: Michael S. Tsirkin <mst@redhat.com> 5 * 6 * Inspiration, some code, and most witty comments come from 7 * Documentation/virtual/lguest/lguest.c, by Rusty Russell 8 * --- 276 unchanged lines hidden (view full) --- 285static void vhost_dev_free_iovecs(struct vhost_dev *dev) 286{ 287 int i; 288 289 for (i = 0; i < dev->nvqs; ++i) 290 vhost_vq_free_iovecs(dev->vqs[i]); 291} 292 |
293long vhost_dev_init(struct vhost_dev *dev, | 293void vhost_dev_init(struct vhost_dev *dev, |
294 struct vhost_virtqueue **vqs, int nvqs) 295{ 296 struct vhost_virtqueue *vq; 297 int i; 298 299 dev->vqs = vqs; 300 dev->nvqs = nvqs; 301 mutex_init(&dev->mutex); --- 12 unchanged lines hidden (view full) --- 314 vq->heads = NULL; 315 vq->dev = dev; 316 mutex_init(&vq->mutex); 317 vhost_vq_reset(dev, vq); 318 if (vq->handle_kick) 319 vhost_poll_init(&vq->poll, vq->handle_kick, 320 POLLIN, dev); 321 } | 294 struct vhost_virtqueue **vqs, int nvqs) 295{ 296 struct vhost_virtqueue *vq; 297 int i; 298 299 dev->vqs = vqs; 300 dev->nvqs = nvqs; 301 mutex_init(&dev->mutex); --- 12 unchanged lines hidden (view full) --- 314 vq->heads = NULL; 315 vq->dev = dev; 316 mutex_init(&vq->mutex); 317 vhost_vq_reset(dev, vq); 318 if (vq->handle_kick) 319 vhost_poll_init(&vq->poll, vq->handle_kick, 320 POLLIN, dev); 321 } |
322 323 return 0; | |
324} 325EXPORT_SYMBOL_GPL(vhost_dev_init); 326 327/* Caller should have device mutex */ 328long vhost_dev_check_owner(struct vhost_dev *dev) 329{ 330 /* Are you the owner? If not, I don't think you mean to do that */ 331 return dev->mm == current->mm ? 0 : -EPERM; --- 1226 unchanged lines hidden --- | 322} 323EXPORT_SYMBOL_GPL(vhost_dev_init); 324 325/* Caller should have device mutex */ 326long vhost_dev_check_owner(struct vhost_dev *dev) 327{ 328 /* Are you the owner? If not, I don't think you mean to do that */ 329 return dev->mm == current->mm ? 0 : -EPERM; --- 1226 unchanged lines hidden --- |