diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2018-04-10 22:35:41 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-11 10:54:06 -0400 |
commit | ddd3d4081ffa806ffef28eaeefde757ba2b6812a (patch) | |
tree | e55d8ec43f5c5ce6d42a3af79d69361113819d7b /drivers/vhost/vhost.h | |
parent | d14d2b78090c7de0557362b26a4ca591aa6a9faa (diff) |
vhost: return bool from *_access_ok() functions
Currently vhost *_access_ok() functions return int. This is error-prone
because there are two popular conventions:
1. 0 means failure, 1 means success
2. -errno means failure, 0 means success
Although vhost mostly uses #1, it does not do so consistently.
umem_access_ok() uses #2.
This patch changes the return type from int to bool so that false means
failure and true means success. This eliminates a potential source of
errors.
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/vhost/vhost.h')
-rw-r--r-- | drivers/vhost/vhost.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index d8ee85ae8fdc..6c844b90a168 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -178,8 +178,8 @@ void vhost_dev_cleanup(struct vhost_dev *); | |||
178 | void vhost_dev_stop(struct vhost_dev *); | 178 | void vhost_dev_stop(struct vhost_dev *); |
179 | long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp); | 179 | long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp); |
180 | long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp); | 180 | long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp); |
181 | int vhost_vq_access_ok(struct vhost_virtqueue *vq); | 181 | bool vhost_vq_access_ok(struct vhost_virtqueue *vq); |
182 | int vhost_log_access_ok(struct vhost_dev *); | 182 | bool vhost_log_access_ok(struct vhost_dev *); |
183 | 183 | ||
184 | int vhost_get_vq_desc(struct vhost_virtqueue *, | 184 | int vhost_get_vq_desc(struct vhost_virtqueue *, |
185 | struct iovec iov[], unsigned int iov_count, | 185 | struct iovec iov[], unsigned int iov_count, |