mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
vfio: add strread/writeerror()
Add simple helpers to correctly report failures from read/write routines using the return -errno style. Signed-off-by: John Levon <john.levon@nutanix.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/20250507152020.1254632-7-john.levon@nutanix.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
2e27becf17
commit
5363a1a117
1 changed files with 14 additions and 0 deletions
|
@ -115,6 +115,20 @@ struct VFIODeviceOps {
|
|||
int (*vfio_load_config)(VFIODevice *vdev, QEMUFile *f);
|
||||
};
|
||||
|
||||
/*
|
||||
* Given a return value of either a short number of bytes read or -errno,
|
||||
* construct a meaningful error message.
|
||||
*/
|
||||
#define strreaderror(ret) \
|
||||
(ret < 0 ? strerror(-ret) : "short read")
|
||||
|
||||
/*
|
||||
* Given a return value of either a short number of bytes written or -errno,
|
||||
* construct a meaningful error message.
|
||||
*/
|
||||
#define strwriteerror(ret) \
|
||||
(ret < 0 ? strerror(-ret) : "short write")
|
||||
|
||||
void vfio_device_irq_disable(VFIODevice *vbasedev, int index);
|
||||
void vfio_device_irq_unmask(VFIODevice *vbasedev, int index);
|
||||
void vfio_device_irq_mask(VFIODevice *vbasedev, int index);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue