[PATCH RFC 6/8] fdstreamtest: switch from boolean array to @flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is no functional change, it just merely prepares
environment for next patch.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/fdstreamtest.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/tests/fdstreamtest.c b/tests/fdstreamtest.c
index 56ba5d9..f9caebf 100644
--- a/tests/fdstreamtest.c
+++ b/tests/fdstreamtest.c
@@ -40,7 +40,8 @@ VIR_LOG_INIT("tests.fdstreamtest");
 
 #define PATTERN_LEN 256
 
-static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
+static int
+testFDStreamReadCommon(const char *scratchdir, const unsigned int flags)
 {
     int fd = -1;
     char *file = NULL;
@@ -50,10 +51,9 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
     virStreamPtr st = NULL;
     size_t i;
     virConnectPtr conn = NULL;
-    int flags = 0;
+    bool blocking = !(flags & VIR_STREAM_NONBLOCK);
 
-    if (!blocking)
-        flags |= VIR_STREAM_NONBLOCK;
+    virCheckFlags(VIR_STREAM_NONBLOCK, -1);
 
     if (!(conn = virConnectOpen("test:///default")))
         goto cleanup;
@@ -164,15 +164,15 @@ static int testFDStreamReadCommon(const char *scratchdir, bool blocking)
 
 static int testFDStreamReadBlock(const void *data)
 {
-    return testFDStreamReadCommon(data, true);
+    return testFDStreamReadCommon(data, 0);
 }
 static int testFDStreamReadNonblock(const void *data)
 {
-    return testFDStreamReadCommon(data, false);
+    return testFDStreamReadCommon(data, VIR_STREAM_NONBLOCK);
 }
 
 
-static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
+static int testFDStreamWriteCommon(const char *scratchdir, const unsigned int flags)
 {
     int fd = -1;
     char *file = NULL;
@@ -182,10 +182,9 @@ static int testFDStreamWriteCommon(const char *scratchdir, bool blocking)
     virStreamPtr st = NULL;
     size_t i;
     virConnectPtr conn = NULL;
-    int flags = 0;
+    bool blocking = !(flags & VIR_STREAM_NONBLOCK);
 
-    if (!blocking)
-        flags |= VIR_STREAM_NONBLOCK;
+    virCheckFlags(VIR_STREAM_NONBLOCK, -1);
 
     if (!(conn = virConnectOpen("test:///default")))
         goto cleanup;
-- 
2.4.10

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]