[libvirt] [PATCH] conf: nodedev: Remove inverted match logic

Commit c1276177f832 simplified the match logic; this commit gets rid of the inverted logic to make the code even more straightforward. --- src/conf/node_device_conf.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 0c9c348..b9b9dfa 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1806,22 +1806,22 @@ virNodeDeviceMatch(virNodeDeviceObjPtr devobj, { /* filter by cap type */ if (flags & VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP) { - if (!(MATCH(SYSTEM) || - MATCH(PCI_DEV) || - MATCH(USB_DEV) || - MATCH(USB_INTERFACE) || - MATCH(NET) || - MATCH(SCSI_HOST) || - MATCH(SCSI_TARGET) || - MATCH(SCSI) || - MATCH(STORAGE) || - MATCH(FC_HOST) || - MATCH(VPORTS) || - MATCH(SCSI_GENERIC))) - return false; + if (MATCH(SYSTEM) || + MATCH(PCI_DEV) || + MATCH(USB_DEV) || + MATCH(USB_INTERFACE) || + MATCH(NET) || + MATCH(SCSI_HOST) || + MATCH(SCSI_TARGET) || + MATCH(SCSI) || + MATCH(STORAGE) || + MATCH(FC_HOST) || + MATCH(VPORTS) || + MATCH(SCSI_GENERIC)) + return true; } - return true; + return false; } #undef MATCH -- 2.5.0

On Wed, Mar 16, 2016 at 13:09:39 +0100, Andrea Bolognani wrote:
Commit c1276177f832 simplified the match logic; this commit gets rid of the inverted logic to make the code even more straightforward. --- src/conf/node_device_conf.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 0c9c348..b9b9dfa 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1806,22 +1806,22 @@ virNodeDeviceMatch(virNodeDeviceObjPtr devobj, { /* filter by cap type */ if (flags & VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP) { ... }
- return true; + return false; }
Looks like your patch changes the return value in case VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP flag is not set Jirka

On Wed, 2016-03-16 at 13:18 +0100, Jiri Denemark wrote:
On Wed, Mar 16, 2016 at 13:09:39 +0100, Andrea Bolognani wrote:
Commit c1276177f832 simplified the match logic; this commit gets rid of the inverted logic to make the code even more straightforward. --- src/conf/node_device_conf.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 0c9c348..b9b9dfa 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1806,22 +1806,22 @@ virNodeDeviceMatch(virNodeDeviceObjPtr devobj, { /* filter by cap type */ if (flags & VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP) {
...
} - return true; + return false; }
Looks like your patch changes the return value in case VIR_CONNECT_LIST_NODE_DEVICES_FILTERS_CAP flag is not set
Right. Never mind then, all other (correct) ways that I can think of actually make the code more confusing. Let's just leave it as it is :) Cheers. -- Andrea Bolognani Software Engineer - Virtualization Team
participants (2)
-
Andrea Bolognani
-
Jiri Denemark