Skip to contentSkip to conversation

block/raw-posix: Make hdev_aio_discard() available outside Linux

PATCH Applied Andreas Färber 2 participants 2 messages Jan 18, 2013 – Jan 19, 2013 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block/raw-posix: Make hdev_aio_discard() available outside Linux

Fixes the build on OpenBSD among others.

---
 block/raw-posix.c |   26 +++++++++++++-------------

1 Datei geändert, 13 Zeilen hinzugefügt(+), 13 Zeilen entfernt(-)

block/raw-posix.c +13 -13
index 679fcc5..657af95 100644
@@ -1371,19 +1371,6 @@ static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs,
     return thread_pool_submit_aio(aio_worker, acb, cb, opaque);
 }
 
-static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs,
-    int64_t sector_num, int nb_sectors,
-    BlockDriverCompletionFunc *cb, void *opaque)
-{
-    BDRVRawState *s = bs->opaque;
-
-    if (fd_open(bs) < 0) {
-        return NULL;
-    }
-    return paio_submit(bs, s->fd, sector_num, NULL, nb_sectors,
-                       cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
-}
-
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 static int fd_open(BlockDriverState *bs)
 {
@@ -1403,6 +1390,19 @@ static int fd_open(BlockDriverState *bs)
 
 #endif /* !linux && !FreeBSD */
 
+static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs,
+    int64_t sector_num, int nb_sectors,
+    BlockDriverCompletionFunc *cb, void *opaque)
+{
+    BDRVRawState *s = bs->opaque;
+
+    if (fd_open(bs) < 0) {
+        return NULL;
+    }
+    return paio_submit(bs, s->fd, sector_num, NULL, nb_sectors,
+                       cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
+}
+
 static int hdev_create(const char *filename, QEMUOptionParameter *options)
 {
     int fd;
Signature · 1 line
1.7.10.4
Applied
#1 lore raw

Thanks, applied.

I must have deleted this by accident.

Quoted 61 lines · Andreas Färber

Fixes the build on OpenBSD among others.

---
 block/raw-posix.c |   26 +++++++++++++-------------

1 Datei geändert, 13 Zeilen hinzugefügt(+), 13 Zeilen entfernt(-)

block/raw-posix.c +0 -13
index 679fcc5..657af95 100644
@@ -1371,19 +1371,6 @@ static BlockDriverAIOCB
 *hdev_aio_ioctl(BlockDriverState *bs,
     return thread_pool_submit_aio(aio_worker, acb, cb, opaque);
 }
 
-static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState
 *bs,
-    int64_t sector_num, int nb_sectors,
-    BlockDriverCompletionFunc *cb, void *opaque)
-{
-    BDRVRawState *s = bs->opaque;
-
-    if (fd_open(bs) < 0) {
-        return NULL;
-    }
-    return paio_submit(bs, s->fd, sector_num, NULL, nb_sectors,
-                       cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
-}
-
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)

static int fd_open(BlockDriverState *bs)
{

block/raw-posix.c +13 -0
@@ -1403,6 +1390,19 @@ static int fd_open(BlockDriverState *bs)
 
 #endif /* !linux && !FreeBSD */
 
+static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState
 *bs,
+    int64_t sector_num, int nb_sectors,
+    BlockDriverCompletionFunc *cb, void *opaque)
+{
+    BDRVRawState *s = bs->opaque;
+
+    if (fd_open(bs) < 0) {
+        return NULL;
+    }
+    return paio_submit(bs, s->fd, sector_num, NULL, nb_sectors,
+                       cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
+}
+
 static int hdev_create(const char *filename, QEMUOptionParameter *options)
 {
     int fd;

--
1.7.10.4