Move block format drivers to new directory 'bdrv'
PATCH 1/1 Move block format drivers to new directory 'bdrv'
Instead of crowding the top-level directory, give block format drivers their very own subdirectory.
--- Makefile | 10 +++++----- Makefile.target | 4 ++-- block-bochs.c => bdrv/bochs.c | 0 block-cloop.c => bdrv/cloop.c | 0 block-cow.c => bdrv/cow.c | 0 block-dmg.c => bdrv/dmg.c | 0 block-nbd.c => bdrv/nbd.c | 0 block-parallels.c => bdrv/parallels.c | 0 block-qcow.c => bdrv/qcow.c | 0 block-qcow2.c => bdrv/qcow2.c | 0 block-raw-posix.c => bdrv/raw-posix.c | 0 block-raw-win32.c => bdrv/raw-win32.c | 0 block-vmdk.c => bdrv/vmdk.c | 0 block-vpc.c => bdrv/vpc.c | 0 block-vvfat.c => bdrv/vvfat.c | 0 15 files changed, 7 insertions(+), 7 deletions(-) rename block-bochs.c => bdrv/bochs.c (100%) rename block-cloop.c => bdrv/cloop.c (100%) rename block-cow.c => bdrv/cow.c (100%) rename block-dmg.c => bdrv/dmg.c (100%) rename block-nbd.c => bdrv/nbd.c (100%) rename block-parallels.c => bdrv/parallels.c (100%) rename block-qcow.c => bdrv/qcow.c (100%) rename block-qcow2.c => bdrv/qcow2.c (100%) rename block-raw-posix.c => bdrv/raw-posix.c (100%) rename block-raw-win32.c => bdrv/raw-win32.c (100%) rename block-vmdk.c => bdrv/vmdk.c (100%) rename block-vpc.c => bdrv/vpc.c (100%) rename block-vvfat.c => bdrv/vvfat.c (100%)
Makefile +5 -5
@@ -63,18 +63,18 @@ recurse-all: $(SUBDIR_RULES) # BLOCK_OBJS is code used by both qemu system emulation and qemu-img BLOCK_OBJS=cutils.o qemu-malloc.o -BLOCK_OBJS+=block-cow.o block-qcow.o aes.o block-vmdk.o block-cloop.o -BLOCK_OBJS+=block-dmg.o block-bochs.o block-vpc.o block-vvfat.o -BLOCK_OBJS+=block-qcow2.o block-parallels.o block-nbd.o +BLOCK_OBJS+=bdrv/cow.o bdrv/qcow.o aes.o bdrv/vmdk.o bdrv/cloop.o +BLOCK_OBJS+=bdrv/dmg.o bdrv/bochs.o bdrv/vpc.o bdrv/vvfat.o +BLOCK_OBJS+=bdrv/qcow2.o bdrv/parallels.o bdrv/nbd.o BLOCK_OBJS+=nbd.o block.o aio.o ifdef CONFIG_WIN32 -BLOCK_OBJS += block-raw-win32.o +BLOCK_OBJS += bdrv/raw-win32.o else ifdef CONFIG_AIO BLOCK_OBJS += posix-aio-compat.o endif -BLOCK_OBJS += block-raw-posix.o +BLOCK_OBJS += bdrv/raw-posix.o endif ######################################################################
Makefile.target +2 -2
@@ -507,12 +507,12 @@ ifdef CONFIG_KVM OBJS+=kvm.o kvm-all.o endif ifdef CONFIG_WIN32 -OBJS+=block-raw-win32.o +OBJS+=bdrv/raw-win32.o else ifdef CONFIG_AIO OBJS+=posix-aio-compat.o endif -OBJS+=block-raw-posix.o +OBJS+=bdrv/raw-posix.o endif LIBS+=-lz
bdrv/bochs.c renamed from block-bochs.c +0 -0
bdrv/cloop.c renamed from block-cloop.c +0 -0
bdrv/cow.c renamed from block-cow.c +0 -0
bdrv/dmg.c renamed from block-dmg.c +0 -0
bdrv/nbd.c renamed from block-nbd.c +0 -0
bdrv/parallels.c renamed from block-parallels.c +0 -0
bdrv/qcow.c renamed from block-qcow.c +0 -0
bdrv/qcow2.c renamed from block-qcow2.c +0 -0
bdrv/raw-posix.c renamed from block-raw-posix.c +0 -0
bdrv/raw-win32.c renamed from block-raw-win32.c +0 -0
bdrv/vmdk.c renamed from block-vmdk.c +0 -0
bdrv/vpc.c renamed from block-vpc.c +0 -0
bdrv/vvfat.c renamed from block-vvfat.c +0 -0
Signature · 1 line
1.6.0.6
Quoted 2 lines · Avi Kivity
Instead of crowding the top-level directory, give block format drivers their very own subdirectory.
Please also move block.c. Also block/*.c would match the existing convention, not that I care too much.
Quoted 9 lines · Christoph Hellwig
Quoted 3 lines · Avi Kivity
Instead of crowding the top-level directory, give block format drivers their very own subdirectory.
Please also move
block.c. Alsoblock/*.cwould match the existing convention, not that I care too much.
That was deliberate - I wanted to keep the block core in the top level directory, and move the block format drivers away. I'll change it if there's consensus that block/*.c (including block.c) is preferable.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 11 lines · Avi Kivity
Quoted 4 lines · Christoph Hellwig
Quoted 1 line · Avi Kivity
Instead of crowding the top-level directory, give block format drivers
their
Quoted 4 lines
Quoted 3 lines
very own subdirectory.
Quoted 8 lines
Quoted 4 lines
Please also move
block.c. Alsoblock/*.cwould match the existing convention, not that I care too much.That was deliberate - I wanted to keep the block core in the top level
directory, and move the block format drivers away. I'll change it if there's consensus thatblock/*.c(includingblock.c) is preferable.
Taking one step further, why not introduce directories similar to VirtualBox:
http://www.virtualbox.org/browser/trunk/src/VBox
Or in our style: host/block/, host/net/slirp/, host/usb/, host/bluetooth/ (trying to match subdirectory names in Linux drivers directory)?
Quoted 4 lines · Blue Swirl
Taking one step further, why not introduce directories similar to VirtualBox:
http://www.virtualbox.org/browser/trunk/src/VBox
No objection, but let's go one step at a time.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 10 lines · Avi Kivity
Quoted 1 line · Blue Swirl
Taking one step further, why not introduce directories similar to
VirtualBox:
Quoted 4 lines
No objection, but let's go one step at a time.
Yes, but it's good to see the big picture.
So the new 'host' directory would be like:
.
|-- audio |-- block |-- bluetooth |-- crypto |-- net | `-- slirp |-- parport |-- scsi |-- serial |-- usb
`-- video
audio and slirp are current directories. SDL and VNC go to video, aes and d3des to crypto.
Quoted 15 lines · Blue Swirl
Yes, but it's good to see the big picture.
So the new 'host' directory would be like:
.
|-- audio |-- block |-- bluetooth |-- crypto |-- net | `-- slirp |-- parport |-- scsi |-- serial |-- usb
Quoted 5 lines
`-- video
audio and slirp are current directories. SDL and VNC go to video, aes and d3des to crypto.
I find it too sparse. Most of these directories would hold one or two files.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 32 lines · Blue Swirl
Quoted 5 lines · Avi Kivity
Quoted 2 lines · Blue Swirl
Taking one step further, why not introduce directories similar to
Quoted 9 lines
VirtualBox:
Quoted 5 lines
No objection, but let's go one step at a time.
Yes, but it's good to see the big picture.
So the new 'host' directory would be like:
.
|-- audio |-- block |-- bluetooth |-- crypto |-- net | `-- slirp |-- parport |-- scsi |-- serial |-- usb
Quoted 2 lines
`-- video
There's an awful lot of code refactoring needed before such a layout would make sense. In general, I think until there are at least 3 files in the form something-foo.c, it doesn't make sense to convert to something/foo.c
Regards,
Anthony Liguori
Quoted 5 lines
audio and slirp are current directories. SDL and VNC go to video, aes and d3des to crypto.
Quoted 13 lines · Anthony Liguori
Quoted 10 lines
|-- audio |-- block |-- bluetooth |-- crypto |-- net | `-- slirp |-- parport |-- scsi |-- serial |-- usbQuoted 2 lines
`-- video
Quoted 4 lines
There's an awful lot of code refactoring needed before such a layout would make sense. In general, I think until there are at least 3 files in the form
something-foo.c, it doesn't make sense to convert tosomething/foo.c
I agree. Useful subdirectories I can see currently are:
- usb
- net
- bluetooth
- block
- vnc
after looking at the code again I would also include the various scsi files in the block directoty, they are pretty closely related and will get even more interwinded with things like SG_IO passthrough for virtio.
Quoted 5 lines · Christoph Hellwig
after looking at the code again I would also include the various scsi files in the block directoty, they are pretty closely related and will get even more interwinded with things like
SG_IOpassthrough for virtio.
maybe
block (core)
block/formats (format drivers)
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Quoted 7 lines · Avi Kivity
Quoted 4 lines · Blue Swirl
Taking one step further, why not introduce directories similar to VirtualBox:
http://www.virtualbox.org/browser/trunk/src/VBoxNo objection, but let's go one step at a time.
I was going to suggest exactly the same thing. It would be good for someone to look at making a more logical layout in hw/.
Regards,
Anthony Liguori
Quoted 11 lines · Anthony Liguori
Quoted 3 lines · Avi Kivity
Quoted 1 line · Blue Swirl
Taking one step further, why not introduce directories similar to
VirtualBox:
Quoted 5 lines
Quoted 4 lines
Quoted 5 lines
Quoted 2 lines
No objection, but let's go one step at a time.
I was going to suggest exactly the same thing. It would be good for
someone to look at making a more logical layout in hw/.
hw could be arranged the same way, renamed to 'target':
target
|-- audio |-- block |-- bluetooth |-- boards | |-- alpha | |-- arm | |-- cris | |-- i386 | |-- m68k | |-- mips | |-- ppc | |-- sh4 | |-- sparc | |-- sparc64 | `-- x86_64 |-- input |-- irq |-- isa |-- mtd |-- net |-- pci |-- scsi |-- serial |-- timer |-- usb |-- video
`-- xen
Quoted 53 lines · Blue Swirl
Quoted 15 lines · Anthony Liguori
Quoted 5 lines · Avi Kivity
Quoted 2 lines · Blue Swirl
Taking one step further, why not introduce directories similar to
VirtualBox:
Quoted 5 lines
Quoted 5 lines
Quoted 6 lines
Quoted 3 lines
No objection, but let's go one step at a time.
I was going to suggest exactly the same thing. It would be good for
someone to look at making a more logical layout in hw/.hw could be arranged the same way, renamed to 'target':
target
|-- audio |-- block |-- bluetooth |-- boards | |-- alpha | |-- arm | |-- cris | |-- i386 | |-- m68k | |-- mips | |-- ppc | |-- sh4 | |-- sparc | |-- sparc64 | `-- x86_64 |-- input |-- irq |-- isa |-- mtd |-- net |-- pci |-- scsi |-- serial |-- timer |-- usb |-- video
Quoted 4 lines
`-- xen
... or similar to linux kernel structure?
target
|-- arch | |-- ... |-- drivers | |-- ...
Then it's clearer where the emulation code for a PC board (i386 or x86_64?), a network card (pci or net?) or others should be placed.
Quoted 29 lines · Blue Swirl
hw could be arranged the same way, renamed to 'target':
target
|-- audio |-- block |-- bluetooth |-- boards | |-- alpha | |-- arm | |-- cris | |-- i386 | |-- m68k | |-- mips | |-- ppc | |-- sh4 | |-- sparc | |-- sparc64 | `-- x86_64 |-- input |-- irq |-- isa |-- mtd |-- net |-- pci |-- scsi |-- serial |-- timer |-- usb |-- video
Quoted 1 line
`-- xen
We should be careful not to put each file into its own directory. A layout is good if it helps me to find the right file more quickly. If I have the same problem finding the right directory (or just having to change the working directory all the time) afterwards, I think it's not worth the effort.
Kevin
Quoted 5 lines · Kevin Wolf
We should be careful not to put each file into its own directory. A layout is good if it helps me to find the right file more quickly. If I have the same problem finding the right directory (or just having to change the working directory all the time) afterwards, I think it's not worth the effort.
The way Linux dealt with this is long ago there were only a few directories in drivers/ and a few top-level directories. Block devices went in drivers/block/, most other devices in drivers/char, and there were only a few top-level directories.
That went on for many years. Then as the number of drivers and kernel subsystems grew too big, they added more and more specialised directories. Now we have a lot of directories under drivers/, and a few more at the top level.
With GIT handling renames, adding more directories in future as needed and moving things into them might be quite straightforward, I'm not sure.
-- Jamie
In message: <[email protected]>
Jamie Lokier <[email protected]> writes:
: With GIT handling renames, adding more directories in future as needed : and moving things into them might be quite straightforward, I'm not : sure.
Yes. It does. Any of the more modern (post cvs) VCS do this.
Warner
Quoted 4 lines · Avi Kivity
Instead of crowding the top-level directory, give block format drivers their very own subdirectory.
Signed-off-by Avi Kivity <[email protected]>
I like this idea. In fact, I was going to suggest something like this myself. And a good next step would be to split up (too) large source files, e.g. into qcow2-snapshot.c, qcow2-refcount.c and so on.
Kevin
Quoted 7 lines · Kevin Wolf
Quoted 4 lines · Avi Kivity
Instead of crowding the top-level directory, give block format drivers their very own subdirectory.
Signed-off-by Avi Kivity <[email protected]>I like this idea. In fact, I was going to suggest something like this myself. And a good next step would be to split up (too) large source files, e.g. into
qcow2-snapshot.c,qcow2-refcount.cand so on.
qcow2/snapshot.c qcow2/refcount.c ...
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 10 lines · Avi Kivity
Quoted 7 lines · Kevin Wolf
Quoted 4 lines · Avi Kivity
Instead of crowding the top-level directory, give block format drivers their very own subdirectory.
Signed-off-by Avi Kivity <[email protected]>I like this idea. In fact, I was going to suggest something like this myself. And a good next step would be to split up (too) large source files, e.g. into
qcow2-snapshot.c,qcow2-refcount.cand so on.
qcow2/snapshot.cqcow2/refcount.c...
I'm not sure about that one. A less crowded top level directory is a good thing, but building a directory labyrinth is not, IMHO.
Kevin
Quoted 5 lines · Kevin Wolf
Quoted 2 lines · Avi Kivity
Instead of crowding the top-level directory, give block format drivers their very own subdirectory.
I like this idea.
Well, if we're agreed that this is a good idea, is there anything stopping it from happening? :)
Signature · 1 line
Stuart Brady