virtio_pci: better macro exported in uapi
Subsystems (2)
Michael S. Tsirkin
maintainerPATCH v2 1/1 virtio_pci: better macro exported in uapi
Macro VIRTIO_PCI_CONFIG assumes that userspace actually has a structure with a field named msix_enabled. Add VIRTIO_PCI_CONFIG_OFF that gets the msix_enabled by value instead, to make it useful for userspace. We still keep VIRTIO_PCI_CONFIG around for now, in case some userspace uses it.
---
Changes from v1:
- rename macro to VIRTIO_PCI_CONFIG_OFF so preprocessor can be used to check for its presence, as suggested by Rusty
- keep old macro around as suggested by David Howells
include/uapi/linux/virtio_pci.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
include/uapi/linux/virtio_pci.h +3 -1
@@ -80,7 +80,9 @@/* The remaining space is defined by each driver as the per-driver * configuration space */ -#define VIRTIO_PCI_CONFIG (dev) ((dev)->msix_enabled ? 24 : 20) +#define VIRTIO_PCI_CONFIG_OFF (msix_enabled) ((msix_enabled) ? 24 : 20) +/* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */ +#define VIRTIO_PCI_CONFIG (dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled)/* Virtio ABI version, this must match exactly */ #define VIRTIO_PCI_ABI_VERSION 0
Signature · 1 line
MST
Rusty Russell
AppliedQuoted 7 lines · Michael S. Tsirkin
Macro
VIRTIO_PCI_CONFIGassumes that userspace actually has a structure with a field namedmsix_enabled. AddVIRTIO_PCI_CONFIG_OFFthat gets themsix_enabledby value instead, to make it useful for userspace. We still keepVIRTIO_PCI_CONFIGaround for now, in case some userspace uses it.Signed-off-by Michael S. Tsirkin <[email protected]>
Applied.
Thanks,
Rusty.
Quoted 28 lines
---
Changes from v1:
- rename macro toVIRTIO_PCI_CONFIG_OFFso preprocessor can be used to check for its presence, as suggested by Rusty
- keep old macro around as suggested by David Howellsinclude/uapi/linux/virtio_pci.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)include/uapi/linux/virtio_pci.h +3
-1@@ -80,7 +80,9 @@/* The remaining space is defined by each driver as the per-driver * configuration space */ -#define VIRTIO_PCI_CONFIG (dev) ((dev)->msix_enabled ? 24 : 20) +#define VIRTIO_PCI_CONFIG_OFF (msix_enabled) ((msix_enabled) ? 24 : 20) +/* Deprecated: please use VIRTIO_PCI_CONFIG_OFF instead */ +#define VIRTIO_PCI_CONFIG (dev) VIRTIO_PCI_CONFIG_OFF((dev)->msix_enabled)/* Virtio ABI version, this must match exactly */ #define VIRTIO_PCI_ABI_VERSION 0Signature · 1 line
MST