Skip to contentSkip to conversation

block: Make more block drivers compile-time configurable

PATCH Superseded Markus Armbruster 2 participants 5 messages Oct 19, 2018 – Nov 7, 2018 Block layer

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block: Make more block drivers compile-time configurable

From: Jeff Cody <[email protected]>

This adds configure options to control the following block drivers:

* Bochs
* Cloop
* Dmg
* Qcow (V1)
* Vdi
* Vvfat
* qed
* parallels
* sheepdog

Each of these defaults to being enabled.

---

Hmm, we got quite a few --enable-BLOCK-DRIVER now. Perhaps a single list-valued option similar --target-list would be better. Could be done on top.

 block/Makefile.objs | 22 ++++++++---
 configure           | 91 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 6 deletions(-)
block/Makefile.objs +16 -6
index c8337bf186..1cad9fc4f1 100644
@@ -1,10 +1,18 @@
-block-obj-y += raw-format.o qcow.o vdi.o vmdk.o cloop.o bochs.o vpc.o vvfat.o dmg.o
+block-obj-y += raw-format.o vmdk.o vpc.o
+block-obj-$(CONFIG_QCOW1) += qcow.o
+block-obj-$(CONFIG_VDI) += vdi.o
+block-obj-$(CONFIG_CLOOP) += cloop.o
+block-obj-$(CONFIG_BOCHS) += bochs.o
+block-obj-$(CONFIG_VVFAT) += vvfat.o
+block-obj-$(CONFIG_DMG) += dmg.o
+
 block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o qcow2-bitmap.o
-block-obj-y += qed.o qed-l2-cache.o qed-table.o qed-cluster.o
-block-obj-y += qed-check.o
+block-obj-$(CONFIG_QED) += qed.o qed-l2-cache.o qed-table.o qed-cluster.o
+block-obj-$(CONFIG_QED) += qed-check.o
 block-obj-y += vhdx.o vhdx-endian.o vhdx-log.o
 block-obj-y += quorum.o
-block-obj-y += parallels.o blkdebug.o blkverify.o blkreplay.o
+block-obj-y += blkdebug.o blkverify.o blkreplay.o
+block-obj-$(CONFIG_PARALLELS) += parallels.o
 block-obj-y += blklogwrites.o
 block-obj-y += block-backend.o snapshot.o qapi.o
 block-obj-$(CONFIG_WIN32) += file-win32.o win32-aio.o
@@ -14,7 +22,8 @@ block-obj-y += null.o mirror.o commit.o io.o create.o
 block-obj-y += throttle-groups.o
 block-obj-$(CONFIG_LINUX) += nvme.o
 
-block-obj-y += nbd.o nbd-client.o sheepdog.o
+block-obj-y += nbd.o nbd-client.o
+block-obj-$(CONFIG_SHEEPDOG) += sheepdog.o
 block-obj-$(CONFIG_LIBISCSI) += iscsi.o
 block-obj-$(if $(CONFIG_LIBISCSI),y,n) += iscsi-opts.o
 block-obj-$(CONFIG_LIBNFS) += nfs.o
@@ -45,7 +54,8 @@ gluster.o-libs     := $(GLUSTERFS_LIBS)
 vxhs.o-libs        := $(VXHS_LIBS)
 ssh.o-cflags       := $(LIBSSH2_CFLAGS)
 ssh.o-libs         := $(LIBSSH2_LIBS)
-block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-dmg-bz2$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-$(CONFIG_DMG) += $(block-obj-dmg-bz2-y)
 dmg-bz2.o-libs     := $(BZIP2_LIBS)
 qcow.o-libs        := -lz
 linux-aio.o-libs   := -laio
configure +91 -0

121 lines not on this page · raw message

Signature · 1 line
2.17.2
#1 lore raw
Quoted 32 lines · Markus Armbruster

From: Jeff Cody <[email protected]>

This adds configure options to control the following block drivers:

* Bochs
* Cloop
* Dmg
* Qcow (V1)
* Vdi
* Vvfat
* qed
* parallels
* sheepdog

Each of these defaults to being enabled.

---

Hmm, we got quite a few --enable-BLOCK-DRIVER now. Perhaps a single list-valued option similar --target-list would be better. Could be done on top.

 block/Makefile.objs | 22 ++++++++---
 configure           | 91 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 6 deletions(-)
block/Makefile.objs +0 -0
index c8337bf186..1cad9fc4f1 100644

[...]

block/Makefile.objs gluster.o-libs := $(GLUSTERFS_LIBS) · line 58

Quoted 7 lines
block/Makefile.objs +2 -1
@@ -45,7 +54,8 @@ gluster.o-libs     := $(GLUSTERFS_LIBS)
 vxhs.o-libs        := $(VXHS_LIBS)
 ssh.o-cflags       := $(LIBSSH2_CFLAGS)
 ssh.o-libs         := $(LIBSSH2_LIBS)
-block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-dmg-bz2$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-$(CONFIG_DMG) += $(block-obj-dmg-bz2-y)

This defines "block-obj-dmg-bz2m" or "block-obj-dmg-bz2n", so "block-obj-dmg-bz2-y" is never defined (note both the missing hyphen and the "m" vs. "y").

How about:

block-obj-dmg-bz2-$(CONFIG_BZIP2) += dmg-bz2.o block-obj-$(if $(CONFIG_DMG),m,n) += $(block-obj-dmg-bz2-y)

Bonus point: The "+=" are naturally aligned!

(Fun fact on the side: I tried downloading some dmg image, but qemu refused to open that. ("sector count 409600 for chunk 4 is larger than max (131072)" -- yeah, yeah, I know that I'm not the largest guy) -- but you can test it just by replacing "dmg-bz2.o" by "does-not-exist.o", and then make complains normally, but stops complaining with --disable-dmg or --disable-bzip2.)

Max

Quoted 3 lines
block/Makefile.objs +0 -0
 dmg-bz2.o-libs     := $(BZIP2_LIBS)
 qcow.o-libs        := -lz
 linux-aio.o-libs   := -laio
#2 lore raw
Quoted 25 lines · Max Reitz
Quoted 24 lines · Markus Armbruster

From: Jeff Cody <[email protected]>

This adds configure options to control the following block drivers:

* Bochs
* Cloop
* Dmg
* Qcow (V1)
* Vdi
* Vvfat
* qed
* parallels
* sheepdog

Each of these defaults to being enabled.

---

Hmm, we got quite a few --enable-BLOCK-DRIVER now. Perhaps a single list-valued option similar --target-list would be better. Could be done on top.

Quoted 8 lines

block/Makefile.objs

Quoted 8 lines
 block/Makefile.objs | 22 ++++++++---
 configure           | 91 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 6 deletions(-)
block/Makefile.objs +0 -0
index c8337bf186..1cad9fc4f1 100644

@@ -1,10 +1,18 @@
-block-obj-y += raw-format.o qcow.o vdi.o vmdk.o cloop.o bochs.o vpc.o vvfat.o dmg.o +block-obj-y += raw-format.o vmdk.o vpc.o
+block-obj-$(CONFIG_QCOW1) += qcow.o
+block-obj-$(CONFIG_VDI) += vdi.o
+block-obj-$(CONFIG_CLOOP) += cloop.o
+block-obj-$(CONFIG_BOCHS) += bochs.o
+block-obj-$(CONFIG_VVFAT) += vvfat.o
+block-obj-$(CONFIG_DMG) += dmg.o
+

    block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o qcow2-bitmap.o
Quoted 15 lines

[...]

block/Makefile.objs gluster.o-libs := $(GLUSTERFS_LIBS) · line 58

Quoted 7 lines
block/Makefile.objs +2 -1
@@ -45,7 +54,8 @@ gluster.o-libs     := $(GLUSTERFS_LIBS)
 vxhs.o-libs        := $(VXHS_LIBS)
 ssh.o-cflags       := $(LIBSSH2_CFLAGS)
 ssh.o-libs         := $(LIBSSH2_LIBS)
-block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-dmg-bz2$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-$(CONFIG_DMG) += $(block-obj-dmg-bz2-y)

This defines "block-obj-dmg-bz2m" or "block-obj-dmg-bz2n", so "block-obj-dmg-bz2-y" is never defined (note both the missing hyphen and the "m" vs. "y").

Quoted 3 lines

How about:

block-obj-dmg-bz2-$(CONFIG_BZIP2) += dmg-bz2.o

As far as I can tell, CONFIG_BZIP2 is either undefined or "y". Thus, block-obj-dmg-bz2-y is either left undefined or set to dmg-bz2.o.

Perhaps the '+=' be ':=', but we seem to use '+=' pretty indiscriminately.

Quoted 1 line

block-obj-$(if $(CONFIG_DMG),m,n) += $(block-obj-dmg-bz2-y)

As far as I can tell, CONFIG_DMG is also either undefined or "y". So, this adds dmg-bz2.o to block-obj-m if both CONFIG_BZIP2 and CONFIG_DMG are enabled.

Shouldn't it be added to block-obj-y, like dmg.o, or am I confused?

Quoted 1 line

Bonus point: The "+=" are naturally aligned!

Woot!

Quoted 6 lines

(Fun fact on the side: I tried downloading some dmg image, but qemu refused to open that. ("sector count 409600 for chunk 4 is larger than max (131072)" -- yeah, yeah, I know that I'm not the largest guy) -- but you can test it just by replacing "dmg-bz2.o" by "does-not-exist.o", and then make complains normally, but stops complaining with --disable-dmg or --disable-bzip2.)

Thanks!

#3 lore raw
Quoted 61 lines · Markus Armbruster
Quoted 25 lines · Max Reitz
Quoted 24 lines · Markus Armbruster

From: Jeff Cody <[email protected]>

This adds configure options to control the following block drivers:

* Bochs
* Cloop
* Dmg
* Qcow (V1)
* Vdi
* Vvfat
* qed
* parallels
* sheepdog

Each of these defaults to being enabled.

---

Hmm, we got quite a few --enable-BLOCK-DRIVER now. Perhaps a single list-valued option similar --target-list would be better. Could be done on top.

Quoted 8 lines

block/Makefile.objs

Quoted 8 lines
 block/Makefile.objs | 22 ++++++++---
 configure           | 91 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 6 deletions(-)
block/Makefile.objs +0 -0
index c8337bf186..1cad9fc4f1 100644

@@ -1,10 +1,18 @@
-block-obj-y += raw-format.o qcow.o vdi.o vmdk.o cloop.o bochs.o vpc.o vvfat.o dmg.o +block-obj-y += raw-format.o vmdk.o vpc.o
+block-obj-$(CONFIG_QCOW1) += qcow.o
+block-obj-$(CONFIG_VDI) += vdi.o
+block-obj-$(CONFIG_CLOOP) += cloop.o
+block-obj-$(CONFIG_BOCHS) += bochs.o
+block-obj-$(CONFIG_VVFAT) += vvfat.o
+block-obj-$(CONFIG_DMG) += dmg.o
+

    block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o qcow2-bitmap.o
Quoted 15 lines

[...]

block/Makefile.objs gluster.o-libs := $(GLUSTERFS_LIBS) · line 58

Quoted 7 lines
block/Makefile.objs +2 -1
@@ -45,7 +54,8 @@ gluster.o-libs     := $(GLUSTERFS_LIBS)
 vxhs.o-libs        := $(VXHS_LIBS)
 ssh.o-cflags       := $(LIBSSH2_CFLAGS)
 ssh.o-libs         := $(LIBSSH2_LIBS)
-block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-dmg-bz2$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-$(CONFIG_DMG) += $(block-obj-dmg-bz2-y)

This defines "block-obj-dmg-bz2m" or "block-obj-dmg-bz2n", so "block-obj-dmg-bz2-y" is never defined (note both the missing hyphen and the "m" vs. "y").

Quoted 6 lines
Quoted 3 lines

How about:

block-obj-dmg-bz2-$(CONFIG_BZIP2) += dmg-bz2.o

As far as I can tell, CONFIG_BZIP2 is either undefined or "y". Thus, block-obj-dmg-bz2-y is either left undefined or set to dmg-bz2.o.

Yes.

Quoted 2 lines

Perhaps the '+=' be ':=', but we seem to use '+=' pretty indiscriminately.

Yep. I don't know. Whatever works, and both do, so...

Quoted 5 lines
Quoted 1 line

block-obj-$(if $(CONFIG_DMG),m,n) += $(block-obj-dmg-bz2-y)

As far as I can tell, CONFIG_DMG is also either undefined or "y". So, this adds dmg-bz2.o to block-obj-m if both CONFIG_BZIP2 and CONFIG_DMG are enabled.

Yes.

Quoted 1 line

Shouldn't it be added to block-obj-y, like dmg.o, or am I confused?

The behavior before this patch was to add it to block-obj-m. 27685a8dd08c051fa6d641fe46106fc0dfa51073 has the explanation: We want the bz2 part to be a module so you can launch qemu even without libbz2 around. Only when you use dmg will it load that module.

(And if you dig deeper, it was 88d88798b7efe that (intentionally) broke
that intended behavior, until it was restored by the above commit.)

Quoted 3 lines
Quoted 1 line

Bonus point: The "+=" are naturally aligned!

Woot!

:-)

Max

Quoted 9 lines
Quoted 6 lines

(Fun fact on the side: I tried downloading some dmg image, but qemu refused to open that. ("sector count 409600 for chunk 4 is larger than max (131072)" -- yeah, yeah, I know that I'm not the largest guy) -- but you can test it just by replacing "dmg-bz2.o" by "does-not-exist.o", and then make complains normally, but stops complaining with --disable-dmg or --disable-bzip2.)

Thanks!

#4 lore raw
Quoted 86 lines · Max Reitz
Quoted 61 lines · Markus Armbruster
Quoted 25 lines · Max Reitz
Quoted 24 lines · Markus Armbruster

From: Jeff Cody <[email protected]>

This adds configure options to control the following block drivers:

* Bochs
* Cloop
* Dmg
* Qcow (V1)
* Vdi
* Vvfat
* qed
* parallels
* sheepdog

Each of these defaults to being enabled.

---

Hmm, we got quite a few --enable-BLOCK-DRIVER now. Perhaps a single list-valued option similar --target-list would be better. Could be done on top.

Quoted 8 lines

block/Makefile.objs

Quoted 8 lines
 block/Makefile.objs | 22 ++++++++---
 configure           | 91 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 107 insertions(+), 6 deletions(-)
block/Makefile.objs +0 -0
index c8337bf186..1cad9fc4f1 100644

@@ -1,10 +1,18 @@
-block-obj-y += raw-format.o qcow.o vdi.o vmdk.o cloop.o bochs.o vpc.o vvfat.o dmg.o +block-obj-y += raw-format.o vmdk.o vpc.o
+block-obj-$(CONFIG_QCOW1) += qcow.o
+block-obj-$(CONFIG_VDI) += vdi.o
+block-obj-$(CONFIG_CLOOP) += cloop.o
+block-obj-$(CONFIG_BOCHS) += bochs.o
+block-obj-$(CONFIG_VVFAT) += vvfat.o
+block-obj-$(CONFIG_DMG) += dmg.o
+

    block-obj-y += qcow2.o qcow2-refcount.o qcow2-cluster.o qcow2-snapshot.o qcow2-cache.o qcow2-bitmap.o
Quoted 15 lines

[...]

block/Makefile.objs gluster.o-libs := $(GLUSTERFS_LIBS) · line 58

Quoted 7 lines
block/Makefile.objs +2 -1
@@ -45,7 +54,8 @@ gluster.o-libs     := $(GLUSTERFS_LIBS)
 vxhs.o-libs        := $(VXHS_LIBS)
 ssh.o-cflags       := $(LIBSSH2_CFLAGS)
 ssh.o-libs         := $(LIBSSH2_LIBS)
-block-obj-$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-dmg-bz2$(if $(CONFIG_BZIP2),m,n) += dmg-bz2.o
+block-obj-$(CONFIG_DMG) += $(block-obj-dmg-bz2-y)

This defines "block-obj-dmg-bz2m" or "block-obj-dmg-bz2n", so "block-obj-dmg-bz2-y" is never defined (note both the missing hyphen and the "m" vs. "y").

Quoted 6 lines
Quoted 3 lines

How about:

block-obj-dmg-bz2-$(CONFIG_BZIP2) += dmg-bz2.o

As far as I can tell, CONFIG_BZIP2 is either undefined or "y". Thus, block-obj-dmg-bz2-y is either left undefined or set to dmg-bz2.o.

Yes.

Quoted 2 lines

Perhaps the '+=' be ':=', but we seem to use '+=' pretty indiscriminately.

Yep. I don't know. Whatever works, and both do, so...

Quoted 5 lines
Quoted 1 line

block-obj-$(if $(CONFIG_DMG),m,n) += $(block-obj-dmg-bz2-y)

As far as I can tell, CONFIG_DMG is also either undefined or "y". So, this adds dmg-bz2.o to block-obj-m if both CONFIG_BZIP2 and CONFIG_DMG are enabled.

Yes.

Quoted 1 line

Shouldn't it be added to block-obj-y, like dmg.o, or am I confused?

Quoted 7 lines

The behavior before this patch was to add it to block-obj-m. 27685a8dd08c051fa6d641fe46106fc0dfa51073 has the explanation: We want the bz2 part to be a module so you can launch qemu even without libbz2 around. Only when you use dmg will it load that module.

(And if you dig deeper, it was 88d88798b7efe that (intentionally) broke
that intended behavior, until it was restored by the above commit.)

Thanks, v2 sent with your fix.