qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PULL 05/42] block/raw-posix: refactor handle_aiocb_wri


From: Denis V. Lunev
Subject: Re: [Qemu-devel] [PULL 05/42] block/raw-posix: refactor handle_aiocb_write_zeroes a bit
Date: Thu, 12 Feb 2015 07:44:36 +0300
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 12/02/15 05:29, Peter Maydell wrote:
On 6 February 2015 at 16:40, Kevin Wolf <address@hidden> wrote:
From: "Denis V. Lunev" <address@hidden>

move code dealing with a block device to a separate function. This will
allow to implement additional processing for ordinary files.
+static ssize_t handle_aiocb_write_zeroes(RawPosixAIOData *aiocb)
+{
+    BDRVRawState *s = aiocb->bs->opaque;
+
+    if (aiocb->aio_type & QEMU_AIO_BLKDEV) {
+        return handle_aiocb_write_zeroes_block(aiocb);
+    }
+
+#ifdef CONFIG_XFS
+    if (s->is_xfs) {
+        return xfs_write_zeroes(s, aiocb->aio_offset, aiocb->aio_nbytes);
+    }
+#endif
+
+    return -ENOTSUP;
+}
Hi. This patch has introduced a new compiler warning on OSX:
block/raw-posix.c:947:19: warning: unused variable 's' [-Wunused-variable]
     BDRVRawState *s = aiocb->bs->opaque;
                   ^

and indeed on any host which doesn't define any of CONFIG_XFS,
CONFIG_FALLOCATE, CONFIG_FALLOCATE_PUNCH_HOLE or
CONFIG_FALLOCATE_ZERO_RANGE.

What's your preferred fix? Surrounding the variable declaration
with #if defined(CONFIG_XFS) || defined(CONFIG_FALLOCATE)
would work but I dunno if some less ugly approach is possible.

[I don't yet build OSX with -Werror because we haven't fixed
some of the deprecation warnings about the audio APIs, but
I would like to eventually...]

thanks
-- PMM
we can just add
  (void)s;
immediately after the declaration.

On the other hand, CONFIG_FALLOCATE_PUNCH_HOLE and CONFIG_FALLOCATE_ZERO_RANGE
are completely impossible without CONFIG_FALLOCATE thus

#if defined(CONFIG_FALLOCATE) or defined(CONFIG_XFS)
would be enough.

Regards,
    Den



reply via email to

[Prev in Thread] Current Thread [Next in Thread]