Whamcloud - gitweb
libext2fs: add threading support to the I/O manager abstraction
[tools/e2fsprogs.git] / lib / ext2fs / test_io.c
index ee828be..480e68f 100644 (file)
@@ -197,6 +197,7 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel)
        io->read_error = 0;
        io->write_error = 0;
        io->refcount = 1;
+       io->flags = 0;
 
        memset(data, 0, sizeof(struct test_private_data));
        data->magic = EXT2_ET_MAGIC_TEST_IO_CHANNEL;
@@ -237,8 +238,11 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel)
        if ((value = safe_getenv("TEST_IO_WRITE_ABORT")) != NULL)
                data->write_abort_count = strtoul(value, NULL, 0);
 
-       if (data->real)
+       if (data->real) {
                io->align = data->real->align;
+               if (data->real->flags & CHANNEL_FLAGS_THREADS)
+                       io->flags |= CHANNEL_FLAGS_THREADS;
+       }
 
        *channel = io;
        return 0;