From 9d34fc394ce30a28ec0e43f2ad7172b8de8b3be6 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Fri, 24 Jan 2014 16:18:50 +0100
Subject: [PATCH] Database*: move to db/

---
 Makefile.am                                   | 120 +++++++++---------
 src/CommandLine.cxx                           |   6 +-
 src/DetachedSong.cxx                          |   2 +-
 src/Instance.hxx                              |   2 +-
 src/Main.cxx                                  |   8 +-
 src/Mapper.cxx                                |   6 +-
 src/PlaylistEdit.cxx                          |   2 +-
 src/PlaylistFile.cxx                          |   2 +-
 src/PlaylistPrint.cxx                         |   4 +-
 src/PlaylistUpdate.cxx                        |   6 +-
 src/PlaylistVector.cxx                        |   2 +-
 src/SongFilter.cxx                            |   4 +-
 src/SongPrint.cxx                             |   2 +-
 src/SongSave.cxx                              |   2 +-
 src/SongUpdate.cxx                            |   4 +-
 src/Stats.cxx                                 |   8 +-
 src/command/CommandError.cxx                  |   2 +-
 src/command/DatabaseCommands.cxx              |   8 +-
 src/command/OtherCommands.cxx                 |   4 +-
 src/command/PlayerCommands.cxx                |   2 +-
 src/command/PlaylistCommands.cxx              |   2 +-
 src/command/QueueCommands.cxx                 |   4 +-
 src/command/StickerCommands.cxx               |   8 +-
 src/{ => db}/DatabaseError.cxx                |   0
 src/{ => db}/DatabaseError.hxx                |   0
 src/{ => db}/DatabaseGlue.cxx                 |   4 +-
 src/{ => db}/DatabaseGlue.hxx                 |   0
 src/{ => db}/DatabaseListener.hxx             |   0
 src/{ => db}/DatabaseLock.cxx                 |   0
 src/{ => db}/DatabaseLock.hxx                 |   0
 src/{ => db}/DatabasePlaylist.cxx             |   2 +-
 src/{ => db}/DatabasePlaylist.hxx             |   0
 src/{ => db}/DatabasePlugin.hxx               |   2 +-
 src/{ => db}/DatabasePrint.cxx                |   2 +-
 src/{ => db}/DatabasePrint.hxx                |   0
 src/{ => db}/DatabaseQueue.cxx                |   0
 src/{ => db}/DatabaseQueue.hxx                |   0
 src/{ => db}/DatabaseSave.cxx                 |   0
 src/{ => db}/DatabaseSave.hxx                 |   0
 src/{ => db}/DatabaseSimple.hxx               |   0
 src/{ => db}/DatabaseSong.cxx                 |   0
 src/{ => db}/DatabaseSong.hxx                 |   0
 src/{ => db}/Directory.cxx                    |   2 +-
 src/{ => db}/Directory.hxx                    |   2 +-
 src/{ => db}/DirectorySave.cxx                |   0
 src/{ => db}/DirectorySave.hxx                |   0
 src/{DatabaseHelpers.cxx => db/Helpers.cxx}   |   2 +-
 src/{DatabaseHelpers.hxx => db/Helpers.hxx}   |   2 +-
 src/{ => db}/LightDirectory.hxx               |   0
 src/{ => db}/LightSong.cxx                    |   0
 src/{ => db}/LightSong.hxx                    |   0
 src/{DatabaseRegistry.cxx => db/Registry.cxx} |   8 +-
 src/{DatabaseRegistry.hxx => db/Registry.hxx} |   0
 .../Selection.cxx}                            |   2 +-
 .../Selection.hxx}                            |   0
 src/{ => db}/Song.cxx                         |   0
 src/{ => db}/Song.hxx                         |   0
 src/{ => db}/SongSort.cxx                     |   0
 src/{ => db}/SongSort.hxx                     |   0
 src/{DatabaseVisitor.hxx => db/Visitor.hxx}   |   0
 src/db/{ => plugins}/LazyDatabase.cxx         |   0
 src/db/{ => plugins}/LazyDatabase.hxx         |   2 +-
 src/db/{ => plugins}/ProxyDatabasePlugin.cxx  |  12 +-
 src/db/{ => plugins}/ProxyDatabasePlugin.hxx  |   0
 src/db/{ => plugins}/SimpleDatabasePlugin.cxx |  16 +--
 src/db/{ => plugins}/SimpleDatabasePlugin.hxx |   4 +-
 src/db/{ => plugins}/UpnpDatabasePlugin.cxx   |  10 +-
 src/db/{ => plugins}/UpnpDatabasePlugin.hxx   |   0
 src/db/{ => plugins}/upnp/Action.hxx          |   0
 .../upnp/ContentDirectoryService.cxx          |   0
 .../upnp/ContentDirectoryService.hxx          |   0
 src/db/{ => plugins}/upnp/Device.cxx          |   0
 src/db/{ => plugins}/upnp/Device.hxx          |   0
 src/db/{ => plugins}/upnp/Directory.cxx       |   0
 src/db/{ => plugins}/upnp/Directory.hxx       |   0
 src/db/{ => plugins}/upnp/Discovery.cxx       |   0
 src/db/{ => plugins}/upnp/Discovery.hxx       |   0
 src/db/{ => plugins}/upnp/Domain.cxx          |   0
 src/db/{ => plugins}/upnp/Domain.hxx          |   0
 src/db/{ => plugins}/upnp/Object.cxx          |   0
 src/db/{ => plugins}/upnp/Object.hxx          |   0
 src/db/{ => plugins}/upnp/Tags.cxx            |   0
 src/db/{ => plugins}/upnp/Tags.hxx            |   0
 src/db/{ => plugins}/upnp/Util.cxx            |   0
 src/db/{ => plugins}/upnp/Util.hxx            |   0
 src/db/{ => plugins}/upnp/WorkQueue.hxx       |   0
 src/db/{ => plugins}/upnp/ixmlwrap.cxx        |   0
 src/db/{ => plugins}/upnp/ixmlwrap.hxx        |   0
 src/db/{ => plugins}/upnp/upnpplib.cxx        |   0
 src/db/{ => plugins}/upnp/upnpplib.hxx        |   0
 src/{ => db}/update/InotifyDomain.cxx         |   0
 src/{ => db}/update/InotifyDomain.hxx         |   0
 src/{ => db}/update/InotifyQueue.cxx          |   0
 src/{ => db}/update/InotifyQueue.hxx          |   0
 src/{ => db}/update/InotifySource.cxx         |   0
 src/{ => db}/update/InotifySource.hxx         |   0
 src/{ => db}/update/InotifyUpdate.cxx         |   0
 src/{ => db}/update/InotifyUpdate.hxx         |   0
 src/{ => db}/update/UpdateArchive.cxx         |   6 +-
 src/{ => db}/update/UpdateArchive.hxx         |   0
 src/{ => db}/update/UpdateContainer.cxx       |   6 +-
 src/{ => db}/update/UpdateContainer.hxx       |   0
 src/{ => db}/update/UpdateDatabase.cxx        |   6 +-
 src/{ => db}/update/UpdateDatabase.hxx        |   0
 src/{ => db}/update/UpdateDomain.cxx          |   0
 src/{ => db}/update/UpdateDomain.hxx          |   0
 src/{ => db}/update/UpdateGlue.cxx            |   2 +-
 src/{ => db}/update/UpdateGlue.hxx            |   0
 src/{ => db}/update/UpdateIO.cxx              |   2 +-
 src/{ => db}/update/UpdateIO.hxx              |   0
 src/{ => db}/update/UpdateInternal.hxx        |   0
 src/{ => db}/update/UpdateQueue.cxx           |   0
 src/{ => db}/update/UpdateQueue.hxx           |   0
 src/{ => db}/update/UpdateRemove.cxx          |   4 +-
 src/{ => db}/update/UpdateRemove.hxx          |   0
 src/{ => db}/update/UpdateSong.cxx            |   6 +-
 src/{ => db}/update/UpdateSong.hxx            |   0
 src/{ => db}/update/UpdateWalk.cxx            |   8 +-
 src/{ => db}/update/UpdateWalk.hxx            |   0
 src/playlist/PlaylistSong.cxx                 |   2 +-
 src/queue/QueueSave.cxx                       |   2 +-
 src/sticker/SongSticker.cxx                   |   6 +-
 test/DumpDatabase.cxx                         |  12 +-
 test/run_inotify.cxx                          |   2 +-
 test/test_translate_song.cxx                  |   2 +-
 125 files changed, 174 insertions(+), 174 deletions(-)
 rename src/{ => db}/DatabaseError.cxx (100%)
 rename src/{ => db}/DatabaseError.hxx (100%)
 rename src/{ => db}/DatabaseGlue.cxx (97%)
 rename src/{ => db}/DatabaseGlue.hxx (100%)
 rename src/{ => db}/DatabaseListener.hxx (100%)
 rename src/{ => db}/DatabaseLock.cxx (100%)
 rename src/{ => db}/DatabaseLock.hxx (100%)
 rename src/{ => db}/DatabasePlaylist.cxx (98%)
 rename src/{ => db}/DatabasePlaylist.hxx (100%)
 rename src/{ => db}/DatabasePlugin.hxx (99%)
 rename src/{ => db}/DatabasePrint.cxx (99%)
 rename src/{ => db}/DatabasePrint.hxx (100%)
 rename src/{ => db}/DatabaseQueue.cxx (100%)
 rename src/{ => db}/DatabaseQueue.hxx (100%)
 rename src/{ => db}/DatabaseSave.cxx (100%)
 rename src/{ => db}/DatabaseSave.hxx (100%)
 rename src/{ => db}/DatabaseSimple.hxx (100%)
 rename src/{ => db}/DatabaseSong.cxx (100%)
 rename src/{ => db}/DatabaseSong.hxx (100%)
 rename src/{ => db}/Directory.cxx (99%)
 rename src/{ => db}/Directory.hxx (99%)
 rename src/{ => db}/DirectorySave.cxx (100%)
 rename src/{ => db}/DirectorySave.hxx (100%)
 rename src/{DatabaseHelpers.cxx => db/Helpers.cxx} (98%)
 rename src/{DatabaseHelpers.hxx => db/Helpers.hxx} (97%)
 rename src/{ => db}/LightDirectory.hxx (100%)
 rename src/{ => db}/LightSong.cxx (100%)
 rename src/{ => db}/LightSong.hxx (100%)
 rename src/{DatabaseRegistry.cxx => db/Registry.cxx} (88%)
 rename src/{DatabaseRegistry.hxx => db/Registry.hxx} (100%)
 rename src/{DatabaseSelection.cxx => db/Selection.cxx} (97%)
 rename src/{DatabaseSelection.hxx => db/Selection.hxx} (100%)
 rename src/{ => db}/Song.cxx (100%)
 rename src/{ => db}/Song.hxx (100%)
 rename src/{ => db}/SongSort.cxx (100%)
 rename src/{ => db}/SongSort.hxx (100%)
 rename src/{DatabaseVisitor.hxx => db/Visitor.hxx} (100%)
 rename src/db/{ => plugins}/LazyDatabase.cxx (100%)
 rename src/db/{ => plugins}/LazyDatabase.hxx (98%)
 rename src/db/{ => plugins}/ProxyDatabasePlugin.cxx (98%)
 rename src/db/{ => plugins}/ProxyDatabasePlugin.hxx (100%)
 rename src/db/{ => plugins}/SimpleDatabasePlugin.cxx (96%)
 rename src/db/{ => plugins}/SimpleDatabasePlugin.hxx (97%)
 rename src/db/{ => plugins}/UpnpDatabasePlugin.cxx (99%)
 rename src/db/{ => plugins}/UpnpDatabasePlugin.hxx (100%)
 rename src/db/{ => plugins}/upnp/Action.hxx (100%)
 rename src/db/{ => plugins}/upnp/ContentDirectoryService.cxx (100%)
 rename src/db/{ => plugins}/upnp/ContentDirectoryService.hxx (100%)
 rename src/db/{ => plugins}/upnp/Device.cxx (100%)
 rename src/db/{ => plugins}/upnp/Device.hxx (100%)
 rename src/db/{ => plugins}/upnp/Directory.cxx (100%)
 rename src/db/{ => plugins}/upnp/Directory.hxx (100%)
 rename src/db/{ => plugins}/upnp/Discovery.cxx (100%)
 rename src/db/{ => plugins}/upnp/Discovery.hxx (100%)
 rename src/db/{ => plugins}/upnp/Domain.cxx (100%)
 rename src/db/{ => plugins}/upnp/Domain.hxx (100%)
 rename src/db/{ => plugins}/upnp/Object.cxx (100%)
 rename src/db/{ => plugins}/upnp/Object.hxx (100%)
 rename src/db/{ => plugins}/upnp/Tags.cxx (100%)
 rename src/db/{ => plugins}/upnp/Tags.hxx (100%)
 rename src/db/{ => plugins}/upnp/Util.cxx (100%)
 rename src/db/{ => plugins}/upnp/Util.hxx (100%)
 rename src/db/{ => plugins}/upnp/WorkQueue.hxx (100%)
 rename src/db/{ => plugins}/upnp/ixmlwrap.cxx (100%)
 rename src/db/{ => plugins}/upnp/ixmlwrap.hxx (100%)
 rename src/db/{ => plugins}/upnp/upnpplib.cxx (100%)
 rename src/db/{ => plugins}/upnp/upnpplib.hxx (100%)
 rename src/{ => db}/update/InotifyDomain.cxx (100%)
 rename src/{ => db}/update/InotifyDomain.hxx (100%)
 rename src/{ => db}/update/InotifyQueue.cxx (100%)
 rename src/{ => db}/update/InotifyQueue.hxx (100%)
 rename src/{ => db}/update/InotifySource.cxx (100%)
 rename src/{ => db}/update/InotifySource.hxx (100%)
 rename src/{ => db}/update/InotifyUpdate.cxx (100%)
 rename src/{ => db}/update/InotifyUpdate.hxx (100%)
 rename src/{ => db}/update/UpdateArchive.cxx (98%)
 rename src/{ => db}/update/UpdateArchive.hxx (100%)
 rename src/{ => db}/update/UpdateContainer.cxx (97%)
 rename src/{ => db}/update/UpdateContainer.hxx (100%)
 rename src/{ => db}/update/UpdateDatabase.cxx (96%)
 rename src/{ => db}/update/UpdateDatabase.hxx (100%)
 rename src/{ => db}/update/UpdateDomain.cxx (100%)
 rename src/{ => db}/update/UpdateDomain.hxx (100%)
 rename src/{ => db}/update/UpdateGlue.cxx (99%)
 rename src/{ => db}/update/UpdateGlue.hxx (100%)
 rename src/{ => db}/update/UpdateIO.cxx (99%)
 rename src/{ => db}/update/UpdateIO.hxx (100%)
 rename src/{ => db}/update/UpdateInternal.hxx (100%)
 rename src/{ => db}/update/UpdateQueue.cxx (100%)
 rename src/{ => db}/update/UpdateQueue.hxx (100%)
 rename src/{ => db}/update/UpdateRemove.cxx (97%)
 rename src/{ => db}/update/UpdateRemove.hxx (100%)
 rename src/{ => db}/update/UpdateSong.cxx (97%)
 rename src/{ => db}/update/UpdateSong.hxx (100%)
 rename src/{ => db}/update/UpdateWalk.cxx (98%)
 rename src/{ => db}/update/UpdateWalk.hxx (100%)

diff --git a/Makefile.am b/Makefile.am
index 74909e27d..fe069ac79 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -102,36 +102,36 @@ src_mpd_SOURCES = \
 	src/decoder/DecoderPlugin.hxx \
 	src/decoder/DecoderInternal.cxx src/decoder/DecoderInternal.hxx \
 	src/decoder/DecoderPrint.cxx src/decoder/DecoderPrint.hxx \
-	src/Directory.cxx src/Directory.hxx \
-	src/DirectorySave.cxx src/DirectorySave.hxx \
-	src/DatabaseSimple.hxx \
-	src/DatabaseGlue.cxx src/DatabaseGlue.hxx \
-	src/DatabaseSong.cxx src/DatabaseSong.hxx \
-	src/DatabasePrint.cxx src/DatabasePrint.hxx \
-	src/DatabaseQueue.cxx src/DatabaseQueue.hxx \
-	src/DatabasePlaylist.cxx src/DatabasePlaylist.hxx \
-	src/DatabaseError.cxx src/DatabaseError.hxx \
-	src/DatabaseLock.cxx src/DatabaseLock.hxx \
-	src/DatabaseSave.cxx src/DatabaseSave.hxx \
-	src/DatabasePlugin.hxx \
-	src/DatabaseListener.hxx \
-	src/DatabaseVisitor.hxx \
-	src/DatabaseSelection.cxx src/DatabaseSelection.hxx \
+	src/db/Directory.cxx src/db/Directory.hxx \
+	src/db/DirectorySave.cxx src/db/DirectorySave.hxx \
+	src/db/DatabaseSimple.hxx \
+	src/db/DatabaseGlue.cxx src/db/DatabaseGlue.hxx \
+	src/db/DatabaseSong.cxx src/db/DatabaseSong.hxx \
+	src/db/DatabasePrint.cxx src/db/DatabasePrint.hxx \
+	src/db/DatabaseQueue.cxx src/db/DatabaseQueue.hxx \
+	src/db/DatabasePlaylist.cxx src/db/DatabasePlaylist.hxx \
+	src/db/DatabaseError.cxx src/db/DatabaseError.hxx \
+	src/db/DatabaseLock.cxx src/db/DatabaseLock.hxx \
+	src/db/DatabaseSave.cxx src/db/DatabaseSave.hxx \
+	src/db/DatabasePlugin.hxx \
+	src/db/DatabaseListener.hxx \
+	src/db/Visitor.hxx \
+	src/db/Selection.cxx src/db/Selection.hxx \
 	src/ExcludeList.cxx src/ExcludeList.hxx \
 	src/FilterConfig.cxx src/FilterConfig.hxx \
 	src/FilterPlugin.cxx src/FilterPlugin.hxx \
 	src/FilterInternal.hxx \
 	src/FilterRegistry.cxx src/FilterRegistry.hxx \
-	src/update/UpdateDomain.cxx src/update/UpdateDomain.hxx \
-	src/update/UpdateGlue.cxx src/update/UpdateGlue.hxx \
-	src/update/UpdateQueue.cxx src/update/UpdateQueue.hxx \
-	src/update/UpdateIO.cxx src/update/UpdateIO.hxx \
-	src/update/UpdateDatabase.cxx src/update/UpdateDatabase.hxx \
-	src/update/UpdateWalk.cxx src/update/UpdateWalk.hxx \
-	src/update/UpdateSong.cxx src/update/UpdateSong.hxx \
-	src/update/UpdateContainer.cxx src/update/UpdateContainer.hxx \
-	src/update/UpdateInternal.hxx \
-	src/update/UpdateRemove.cxx src/update/UpdateRemove.hxx \
+	src/db/update/UpdateDomain.cxx src/db/update/UpdateDomain.hxx \
+	src/db/update/UpdateGlue.cxx src/db/update/UpdateGlue.hxx \
+	src/db/update/UpdateQueue.cxx src/db/update/UpdateQueue.hxx \
+	src/db/update/UpdateIO.cxx src/db/update/UpdateIO.hxx \
+	src/db/update/UpdateDatabase.cxx src/db/update/UpdateDatabase.hxx \
+	src/db/update/UpdateWalk.cxx src/db/update/UpdateWalk.hxx \
+	src/db/update/UpdateSong.cxx src/db/update/UpdateSong.hxx \
+	src/db/update/UpdateContainer.cxx src/db/update/UpdateContainer.hxx \
+	src/db/update/UpdateInternal.hxx \
+	src/db/update/UpdateRemove.cxx src/db/update/UpdateRemove.hxx \
 	src/client/Client.cxx src/client/Client.hxx \
 	src/client/ClientInternal.hxx \
 	src/client/ClientEvent.cxx \
@@ -196,13 +196,13 @@ src_mpd_SOURCES = \
 	src/ReplayGainConfig.cxx src/ReplayGainConfig.hxx \
 	src/ReplayGainInfo.cxx src/ReplayGainInfo.hxx \
 	src/DetachedSong.cxx src/DetachedSong.hxx \
-	src/LightSong.cxx src/LightSong.hxx \
-	src/LightDirectory.hxx \
-	src/Song.cxx src/Song.hxx \
+	src/db/LightSong.cxx src/db/LightSong.hxx \
+	src/db/LightDirectory.hxx \
+	src/db/Song.cxx src/db/Song.hxx \
 	src/SongUpdate.cxx \
 	src/SongPrint.cxx src/SongPrint.hxx \
 	src/SongSave.cxx src/SongSave.hxx \
-	src/SongSort.cxx src/SongSort.hxx \
+	src/db/SongSort.cxx src/db/SongSort.hxx \
 	src/StateFile.cxx src/StateFile.hxx \
 	src/Stats.cxx src/Stats.hxx \
 	src/TagPrint.cxx src/TagPrint.hxx \
@@ -235,10 +235,10 @@ endif
 
 if ENABLE_INOTIFY
 src_mpd_SOURCES += \
-	src/update/InotifyDomain.cxx src/update/InotifyDomain.hxx \
-	src/update/InotifySource.cxx src/update/InotifySource.hxx \
-	src/update/InotifyQueue.cxx src/update/InotifyQueue.hxx \
-	src/update/InotifyUpdate.cxx src/update/InotifyUpdate.hxx
+	src/db/update/InotifyDomain.cxx src/db/update/InotifyDomain.hxx \
+	src/db/update/InotifySource.cxx src/db/update/InotifySource.hxx \
+	src/db/update/InotifyQueue.cxx src/db/update/InotifyQueue.hxx \
+	src/db/update/InotifyUpdate.cxx src/db/update/InotifyUpdate.hxx
 endif
 
 if ENABLE_SQLITE
@@ -400,14 +400,14 @@ libfs_a_SOURCES = \
 # database plugins
 
 libdb_plugins_a_SOURCES = \
-	src/DatabaseRegistry.cxx src/DatabaseRegistry.hxx \
-	src/DatabaseHelpers.cxx src/DatabaseHelpers.hxx \
-	src/db/LazyDatabase.cxx src/db/LazyDatabase.hxx \
-	src/db/SimpleDatabasePlugin.cxx src/db/SimpleDatabasePlugin.hxx
+	src/db/Registry.cxx src/db/Registry.hxx \
+	src/db/Helpers.cxx src/db/Helpers.hxx \
+	src/db/plugins/LazyDatabase.cxx src/db/plugins/LazyDatabase.hxx \
+	src/db/plugins/SimpleDatabasePlugin.cxx src/db/plugins/SimpleDatabasePlugin.hxx
 
 if HAVE_LIBMPDCLIENT
 libdb_plugins_a_SOURCES += \
-	src/db/ProxyDatabasePlugin.cxx src/db/ProxyDatabasePlugin.hxx
+	src/db/plugins/ProxyDatabasePlugin.cxx src/db/plugins/ProxyDatabasePlugin.hxx
 endif
 
 DB_LIBS = \
@@ -416,19 +416,19 @@ DB_LIBS = \
 
 if HAVE_LIBUPNP
 libdb_plugins_a_SOURCES += \
-	src/db/UpnpDatabasePlugin.cxx src/db/UpnpDatabasePlugin.hxx \
-	src/db/upnp/Tags.cxx src/db/upnp/Tags.hxx \
-	src/db/upnp/ContentDirectoryService.cxx src/db/upnp/ContentDirectoryService.hxx \
-	src/db/upnp/Device.cxx src/db/upnp/Device.hxx \
-	src/db/upnp/Directory.cxx src/db/upnp/Directory.hxx \
-	src/db/upnp/Discovery.cxx src/db/upnp/Discovery.hxx \
-	src/db/upnp/Domain.cxx src/db/upnp/Domain.hxx \
-	src/db/upnp/ixmlwrap.cxx src/db/upnp/ixmlwrap.hxx \
-	src/db/upnp/upnpplib.cxx src/db/upnp/upnpplib.hxx \
-	src/db/upnp/Util.cxx src/db/upnp/Util.hxx \
-	src/db/upnp/Action.hxx \
-	src/db/upnp/WorkQueue.hxx \
-	src/db/upnp/Object.cxx src/db/upnp/Object.hxx
+	src/db/plugins/UpnpDatabasePlugin.cxx src/db/plugins/UpnpDatabasePlugin.hxx \
+	src/db/plugins/upnp/Tags.cxx src/db/plugins/upnp/Tags.hxx \
+	src/db/plugins/upnp/ContentDirectoryService.cxx src/db/plugins/upnp/ContentDirectoryService.hxx \
+	src/db/plugins/upnp/Device.cxx src/db/plugins/upnp/Device.hxx \
+	src/db/plugins/upnp/Directory.cxx src/db/plugins/upnp/Directory.hxx \
+	src/db/plugins/upnp/Discovery.cxx src/db/plugins/upnp/Discovery.hxx \
+	src/db/plugins/upnp/Domain.cxx src/db/plugins/upnp/Domain.hxx \
+	src/db/plugins/upnp/ixmlwrap.cxx src/db/plugins/upnp/ixmlwrap.hxx \
+	src/db/plugins/upnp/upnpplib.cxx src/db/plugins/upnp/upnpplib.hxx \
+	src/db/plugins/upnp/Util.cxx src/db/plugins/upnp/Util.hxx \
+	src/db/plugins/upnp/Action.hxx \
+	src/db/plugins/upnp/WorkQueue.hxx \
+	src/db/plugins/upnp/Object.cxx src/db/plugins/upnp/Object.hxx
 DB_LIBS += \
 	$(EXPAT_LIBS) \
 	$(UPNP_LIBS)
@@ -441,7 +441,7 @@ if ENABLE_ARCHIVE
 noinst_LIBRARIES += libarchive.a
 
 src_mpd_SOURCES +=  \
-	src/update/UpdateArchive.cxx src/update/UpdateArchive.hxx
+	src/db/update/UpdateArchive.cxx src/db/update/UpdateArchive.hxx
 
 libarchive_a_SOURCES = \
 	src/archive/ArchiveDomain.cxx src/archive/ArchiveDomain.hxx \
@@ -1244,13 +1244,13 @@ test_DumpDatabase_LDADD = \
 test_DumpDatabase_SOURCES = test/DumpDatabase.cxx \
 	src/protocol/Ack.cxx \
 	src/Log.cxx src/LogBackend.cxx \
-	src/DatabaseError.cxx \
-	src/DatabaseRegistry.cxx \
-	src/DatabaseSelection.cxx \
-	src/Directory.cxx src/DirectorySave.cxx \
+	src/db/DatabaseError.cxx \
+	src/db/Registry.cxx \
+	src/db/Selection.cxx \
+	src/db/Directory.cxx src/db/DirectorySave.cxx \
 	src/PlaylistVector.cxx src/PlaylistDatabase.cxx \
-	src/DatabaseLock.cxx src/DatabaseSave.cxx \
-	src/Song.cxx src/SongSave.cxx src/SongSort.cxx \
+	src/db/DatabaseLock.cxx src/db/DatabaseSave.cxx \
+	src/db/Song.cxx src/SongSave.cxx src/db/SongSort.cxx \
 	src/DetachedSong.cxx \
 	src/TagSave.cxx \
 	src/SongFilter.cxx
@@ -1581,8 +1581,8 @@ noinst_PROGRAMS += test/run_inotify
 test_run_inotify_SOURCES = test/run_inotify.cxx \
 	test/ShutdownHandler.cxx test/ShutdownHandler.hxx \
 	src/Log.cxx src/LogBackend.cxx \
-	src/update/InotifyDomain.cxx \
-	src/update/InotifySource.cxx
+	src/db/update/InotifyDomain.cxx \
+	src/db/update/InotifySource.cxx
 test_run_inotify_LDADD = \
 	libevent.a \
 	libsystem.a \
diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx
index 2b386f5de..c5adc4153 100644
--- a/src/CommandLine.cxx
+++ b/src/CommandLine.cxx
@@ -23,8 +23,8 @@
 #include "LogInit.hxx"
 #include "Log.hxx"
 #include "config/ConfigGlobal.hxx"
-#include "DatabaseRegistry.hxx"
-#include "DatabasePlugin.hxx"
+#include "db/Registry.hxx"
+#include "db/DatabasePlugin.hxx"
 #include "decoder/DecoderList.hxx"
 #include "decoder/DecoderPlugin.hxx"
 #include "output/OutputList.hxx"
@@ -99,7 +99,7 @@ static void version(void)
 	     "This is free software; see the source for copying conditions.  There is NO\n"
 	     "warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
 	     "\n"
-	     "Database plugins:");
+	     "db/Database plugins:");
 
 	for (auto i = database_plugins; *i != nullptr; ++i)
 		printf(" %s", (*i)->name);
diff --git a/src/DetachedSong.cxx b/src/DetachedSong.cxx
index 8882d2863..2fff9b70f 100644
--- a/src/DetachedSong.cxx
+++ b/src/DetachedSong.cxx
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "DetachedSong.hxx"
-#include "LightSong.hxx"
+#include "db/LightSong.hxx"
 #include "util/UriUtil.hxx"
 #include "fs/Traits.hxx"
 
diff --git a/src/Instance.hxx b/src/Instance.hxx
index 71203ba48..ca7bb5197 100644
--- a/src/Instance.hxx
+++ b/src/Instance.hxx
@@ -21,7 +21,7 @@
 #define MPD_INSTANCE_HXX
 
 #include "check.h"
-#include "DatabaseListener.hxx"
+#include "db/DatabaseListener.hxx"
 #include "Compiler.h"
 
 class ClientList;
diff --git a/src/Main.cxx b/src/Main.cxx
index 815f26f0a..e71814cff 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -23,13 +23,13 @@
 #include "CommandLine.hxx"
 #include "PlaylistFile.hxx"
 #include "PlaylistGlobal.hxx"
-#include "update/UpdateGlue.hxx"
+#include "db/update/UpdateGlue.hxx"
 #include "MusicChunk.hxx"
 #include "StateFile.hxx"
 #include "PlayerThread.hxx"
 #include "Mapper.hxx"
-#include "DatabaseGlue.hxx"
-#include "DatabaseSimple.hxx"
+#include "db/DatabaseGlue.hxx"
+#include "db/DatabaseSimple.hxx"
 #include "Permission.hxx"
 #include "Listen.hxx"
 #include "client/Client.hxx"
@@ -68,7 +68,7 @@
 #include "Stats.hxx"
 
 #ifdef ENABLE_INOTIFY
-#include "update/InotifyUpdate.hxx"
+#include "db/update/InotifyUpdate.hxx"
 #endif
 
 #ifdef ENABLE_SQLITE
diff --git a/src/Mapper.cxx b/src/Mapper.cxx
index f29fd0646..ebcab91bf 100644
--- a/src/Mapper.cxx
+++ b/src/Mapper.cxx
@@ -23,10 +23,10 @@
 
 #include "config.h"
 #include "Mapper.hxx"
-#include "Directory.hxx"
-#include "Song.hxx"
 #include "DetachedSong.hxx"
-#include "LightSong.hxx"
+#include "db/Directory.hxx"
+#include "db/Song.hxx"
+#include "db/LightSong.hxx"
 #include "fs/AllocatedPath.hxx"
 #include "fs/Traits.hxx"
 #include "fs/Charset.hxx"
diff --git a/src/PlaylistEdit.cxx b/src/PlaylistEdit.cxx
index cbae02fef..87a64c5c9 100644
--- a/src/PlaylistEdit.cxx
+++ b/src/PlaylistEdit.cxx
@@ -32,7 +32,7 @@
 #include "DetachedSong.hxx"
 #include "Mapper.hxx"
 #include "Idle.hxx"
-#include "DatabaseSong.hxx"
+#include "db/DatabaseSong.hxx"
 #include "Log.hxx"
 
 #include <stdlib.h>
diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx
index befa45d94..0b0f8d32d 100644
--- a/src/PlaylistFile.cxx
+++ b/src/PlaylistFile.cxx
@@ -22,7 +22,7 @@
 #include "PlaylistSave.hxx"
 #include "PlaylistInfo.hxx"
 #include "PlaylistVector.hxx"
-#include "DatabaseSong.hxx"
+#include "db/DatabaseSong.hxx"
 #include "DetachedSong.hxx"
 #include "Mapper.hxx"
 #include "fs/TextFile.hxx"
diff --git a/src/PlaylistPrint.cxx b/src/PlaylistPrint.cxx
index a0697f8cf..faf373be7 100644
--- a/src/PlaylistPrint.cxx
+++ b/src/PlaylistPrint.cxx
@@ -23,8 +23,8 @@
 #include "Playlist.hxx"
 #include "queue/QueuePrint.hxx"
 #include "SongPrint.hxx"
-#include "DatabaseGlue.hxx"
-#include "DatabasePlugin.hxx"
+#include "db/DatabaseGlue.hxx"
+#include "db/DatabasePlugin.hxx"
 #include "client/Client.hxx"
 #include "input/InputStream.hxx"
 #include "DetachedSong.hxx"
diff --git a/src/PlaylistUpdate.cxx b/src/PlaylistUpdate.cxx
index 800ad49c9..114305960 100644
--- a/src/PlaylistUpdate.cxx
+++ b/src/PlaylistUpdate.cxx
@@ -19,9 +19,9 @@
 
 #include "config.h"
 #include "Playlist.hxx"
-#include "DatabaseGlue.hxx"
-#include "DatabasePlugin.hxx"
-#include "LightSong.hxx"
+#include "db/DatabaseGlue.hxx"
+#include "db/DatabasePlugin.hxx"
+#include "db/LightSong.hxx"
 #include "DetachedSong.hxx"
 #include "tag/Tag.hxx"
 #include "Idle.hxx"
diff --git a/src/PlaylistVector.cxx b/src/PlaylistVector.cxx
index 094167e33..82a3519d9 100644
--- a/src/PlaylistVector.cxx
+++ b/src/PlaylistVector.cxx
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "PlaylistVector.hxx"
-#include "DatabaseLock.hxx"
+#include "db/DatabaseLock.hxx"
 
 #include <algorithm>
 
diff --git a/src/SongFilter.cxx b/src/SongFilter.cxx
index 594ac3abc..637150c37 100644
--- a/src/SongFilter.cxx
+++ b/src/SongFilter.cxx
@@ -19,8 +19,8 @@
 
 #include "config.h"
 #include "SongFilter.hxx"
-#include "Song.hxx"
-#include "LightSong.hxx"
+#include "db/Song.hxx"
+#include "db/LightSong.hxx"
 #include "DetachedSong.hxx"
 #include "tag/Tag.hxx"
 #include "util/ASCII.hxx"
diff --git a/src/SongPrint.cxx b/src/SongPrint.cxx
index 18d732161..b0c9ed0a6 100644
--- a/src/SongPrint.cxx
+++ b/src/SongPrint.cxx
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "SongPrint.hxx"
-#include "LightSong.hxx"
+#include "db/LightSong.hxx"
 #include "DetachedSong.hxx"
 #include "TimePrint.hxx"
 #include "TagPrint.hxx"
diff --git a/src/SongSave.cxx b/src/SongSave.cxx
index 790047bb6..d53e5bb62 100644
--- a/src/SongSave.cxx
+++ b/src/SongSave.cxx
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "SongSave.hxx"
-#include "Song.hxx"
+#include "db/Song.hxx"
 #include "DetachedSong.hxx"
 #include "TagSave.hxx"
 #include "fs/TextFile.hxx"
diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx
index 571415ff1..0f3e9b172 100644
--- a/src/SongUpdate.cxx
+++ b/src/SongUpdate.cxx
@@ -18,10 +18,10 @@
  */
 
 #include "config.h" /* must be first for large file support */
-#include "Song.hxx"
 #include "DetachedSong.hxx"
+#include "db/Song.hxx"
+#include "db/Directory.hxx"
 #include "util/UriUtil.hxx"
-#include "Directory.hxx"
 #include "Mapper.hxx"
 #include "fs/AllocatedPath.hxx"
 #include "fs/Traits.hxx"
diff --git a/src/Stats.cxx b/src/Stats.cxx
index 5b979b322..940a984da 100644
--- a/src/Stats.cxx
+++ b/src/Stats.cxx
@@ -21,10 +21,10 @@
 #include "Stats.hxx"
 #include "PlayerControl.hxx"
 #include "client/Client.hxx"
-#include "DatabaseSelection.hxx"
-#include "DatabaseGlue.hxx"
-#include "DatabasePlugin.hxx"
-#include "DatabaseSimple.hxx"
+#include "db/Selection.hxx"
+#include "db/DatabaseGlue.hxx"
+#include "db/DatabasePlugin.hxx"
+#include "db/DatabaseSimple.hxx"
 #include "util/Error.hxx"
 #include "system/Clock.hxx"
 #include "Log.hxx"
diff --git a/src/command/CommandError.cxx b/src/command/CommandError.cxx
index cf3bf6851..73e363f24 100644
--- a/src/command/CommandError.cxx
+++ b/src/command/CommandError.cxx
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "CommandError.hxx"
-#include "DatabaseError.hxx"
+#include "db/DatabaseError.hxx"
 #include "protocol/Result.hxx"
 #include "util/Error.hxx"
 #include "Log.hxx"
diff --git a/src/command/DatabaseCommands.cxx b/src/command/DatabaseCommands.cxx
index eaff1e3ec..2b871e565 100644
--- a/src/command/DatabaseCommands.cxx
+++ b/src/command/DatabaseCommands.cxx
@@ -19,10 +19,10 @@
 
 #include "config.h"
 #include "DatabaseCommands.hxx"
-#include "DatabaseQueue.hxx"
-#include "DatabasePlaylist.hxx"
-#include "DatabasePrint.hxx"
-#include "DatabaseSelection.hxx"
+#include "db/DatabaseQueue.hxx"
+#include "db/DatabasePlaylist.hxx"
+#include "db/DatabasePrint.hxx"
+#include "db/Selection.hxx"
 #include "CommandError.hxx"
 #include "client/Client.hxx"
 #include "tag/Tag.hxx"
diff --git a/src/command/OtherCommands.cxx b/src/command/OtherCommands.cxx
index 4d61884c1..67d2aecf3 100644
--- a/src/command/OtherCommands.cxx
+++ b/src/command/OtherCommands.cxx
@@ -20,9 +20,9 @@
 #include "config.h"
 #include "OtherCommands.hxx"
 #include "DatabaseCommands.hxx"
+#include "db/update/UpdateGlue.hxx"
 #include "CommandError.hxx"
-#include "update/UpdateGlue.hxx"
-#include "Directory.hxx"
+#include "db/Directory.hxx"
 #include "DetachedSong.hxx"
 #include "SongPrint.hxx"
 #include "TagPrint.hxx"
diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx
index 759a37030..f703057cf 100644
--- a/src/command/PlayerCommands.cxx
+++ b/src/command/PlayerCommands.cxx
@@ -22,7 +22,7 @@
 #include "CommandError.hxx"
 #include "Playlist.hxx"
 #include "PlaylistPrint.hxx"
-#include "update/UpdateGlue.hxx"
+#include "db/update/UpdateGlue.hxx"
 #include "client/Client.hxx"
 #include "Volume.hxx"
 #include "output/OutputAll.hxx"
diff --git a/src/command/PlaylistCommands.cxx b/src/command/PlaylistCommands.cxx
index 0441811c4..fbbb66757 100644
--- a/src/command/PlaylistCommands.cxx
+++ b/src/command/PlaylistCommands.cxx
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "PlaylistCommands.hxx"
-#include "DatabasePlaylist.hxx"
+#include "db/DatabasePlaylist.hxx"
 #include "CommandError.hxx"
 #include "PlaylistPrint.hxx"
 #include "PlaylistSave.hxx"
diff --git a/src/command/QueueCommands.cxx b/src/command/QueueCommands.cxx
index e884c71c3..ed2b551c4 100644
--- a/src/command/QueueCommands.cxx
+++ b/src/command/QueueCommands.cxx
@@ -20,9 +20,9 @@
 #include "config.h"
 #include "QueueCommands.hxx"
 #include "CommandError.hxx"
-#include "DatabaseQueue.hxx"
+#include "db/DatabaseQueue.hxx"
 #include "SongFilter.hxx"
-#include "DatabaseSelection.hxx"
+#include "db/Selection.hxx"
 #include "Playlist.hxx"
 #include "PlaylistPrint.hxx"
 #include "client/ClientFile.hxx"
diff --git a/src/command/StickerCommands.cxx b/src/command/StickerCommands.cxx
index cf1be076b..68a0d585f 100644
--- a/src/command/StickerCommands.cxx
+++ b/src/command/StickerCommands.cxx
@@ -20,10 +20,10 @@
 #include "config.h"
 #include "StickerCommands.hxx"
 #include "SongPrint.hxx"
-#include "DatabaseLock.hxx"
-#include "DatabasePlugin.hxx"
-#include "DatabaseGlue.hxx"
-#include "DatabaseSimple.hxx"
+#include "db/DatabaseLock.hxx"
+#include "db/DatabasePlugin.hxx"
+#include "db/DatabaseGlue.hxx"
+#include "db/DatabaseSimple.hxx"
 #include "sticker/SongSticker.hxx"
 #include "sticker/StickerPrint.hxx"
 #include "sticker/StickerDatabase.hxx"
diff --git a/src/DatabaseError.cxx b/src/db/DatabaseError.cxx
similarity index 100%
rename from src/DatabaseError.cxx
rename to src/db/DatabaseError.cxx
diff --git a/src/DatabaseError.hxx b/src/db/DatabaseError.hxx
similarity index 100%
rename from src/DatabaseError.hxx
rename to src/db/DatabaseError.hxx
diff --git a/src/DatabaseGlue.cxx b/src/db/DatabaseGlue.cxx
similarity index 97%
rename from src/DatabaseGlue.cxx
rename to src/db/DatabaseGlue.cxx
index ce53ec184..3734e156c 100644
--- a/src/DatabaseGlue.cxx
+++ b/src/db/DatabaseGlue.cxx
@@ -20,14 +20,14 @@
 #include "config.h"
 #include "DatabaseGlue.hxx"
 #include "DatabaseSimple.hxx"
-#include "DatabaseRegistry.hxx"
+#include "Registry.hxx"
 #include "DatabaseError.hxx"
 #include "Directory.hxx"
 #include "util/Error.hxx"
 #include "config/ConfigData.hxx"
 #include "Stats.hxx"
 #include "DatabasePlugin.hxx"
-#include "db/SimpleDatabasePlugin.hxx"
+#include "plugins/SimpleDatabasePlugin.hxx"
 
 #include <assert.h>
 #include <string.h>
diff --git a/src/DatabaseGlue.hxx b/src/db/DatabaseGlue.hxx
similarity index 100%
rename from src/DatabaseGlue.hxx
rename to src/db/DatabaseGlue.hxx
diff --git a/src/DatabaseListener.hxx b/src/db/DatabaseListener.hxx
similarity index 100%
rename from src/DatabaseListener.hxx
rename to src/db/DatabaseListener.hxx
diff --git a/src/DatabaseLock.cxx b/src/db/DatabaseLock.cxx
similarity index 100%
rename from src/DatabaseLock.cxx
rename to src/db/DatabaseLock.cxx
diff --git a/src/DatabaseLock.hxx b/src/db/DatabaseLock.hxx
similarity index 100%
rename from src/DatabaseLock.hxx
rename to src/db/DatabaseLock.hxx
diff --git a/src/DatabasePlaylist.cxx b/src/db/DatabasePlaylist.cxx
similarity index 98%
rename from src/DatabasePlaylist.cxx
rename to src/db/DatabasePlaylist.cxx
index 58742ca64..64b365d2a 100644
--- a/src/DatabasePlaylist.cxx
+++ b/src/db/DatabasePlaylist.cxx
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "DatabasePlaylist.hxx"
-#include "DatabaseSelection.hxx"
+#include "Selection.hxx"
 #include "PlaylistFile.hxx"
 #include "DatabaseGlue.hxx"
 #include "DatabasePlugin.hxx"
diff --git a/src/DatabasePlaylist.hxx b/src/db/DatabasePlaylist.hxx
similarity index 100%
rename from src/DatabasePlaylist.hxx
rename to src/db/DatabasePlaylist.hxx
diff --git a/src/DatabasePlugin.hxx b/src/db/DatabasePlugin.hxx
similarity index 99%
rename from src/DatabasePlugin.hxx
rename to src/db/DatabasePlugin.hxx
index 2ded7f736..b0cb41502 100644
--- a/src/DatabasePlugin.hxx
+++ b/src/db/DatabasePlugin.hxx
@@ -26,7 +26,7 @@
 #ifndef MPD_DATABASE_PLUGIN_HXX
 #define MPD_DATABASE_PLUGIN_HXX
 
-#include "DatabaseVisitor.hxx"
+#include "Visitor.hxx"
 #include "tag/TagType.h"
 #include "Compiler.h"
 
diff --git a/src/DatabasePrint.cxx b/src/db/DatabasePrint.cxx
similarity index 99%
rename from src/DatabasePrint.cxx
rename to src/db/DatabasePrint.cxx
index b22141aef..9ed0b0826 100644
--- a/src/DatabasePrint.cxx
+++ b/src/db/DatabasePrint.cxx
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "DatabasePrint.hxx"
-#include "DatabaseSelection.hxx"
+#include "Selection.hxx"
 #include "SongFilter.hxx"
 #include "SongPrint.hxx"
 #include "TimePrint.hxx"
diff --git a/src/DatabasePrint.hxx b/src/db/DatabasePrint.hxx
similarity index 100%
rename from src/DatabasePrint.hxx
rename to src/db/DatabasePrint.hxx
diff --git a/src/DatabaseQueue.cxx b/src/db/DatabaseQueue.cxx
similarity index 100%
rename from src/DatabaseQueue.cxx
rename to src/db/DatabaseQueue.cxx
diff --git a/src/DatabaseQueue.hxx b/src/db/DatabaseQueue.hxx
similarity index 100%
rename from src/DatabaseQueue.hxx
rename to src/db/DatabaseQueue.hxx
diff --git a/src/DatabaseSave.cxx b/src/db/DatabaseSave.cxx
similarity index 100%
rename from src/DatabaseSave.cxx
rename to src/db/DatabaseSave.cxx
diff --git a/src/DatabaseSave.hxx b/src/db/DatabaseSave.hxx
similarity index 100%
rename from src/DatabaseSave.hxx
rename to src/db/DatabaseSave.hxx
diff --git a/src/DatabaseSimple.hxx b/src/db/DatabaseSimple.hxx
similarity index 100%
rename from src/DatabaseSimple.hxx
rename to src/db/DatabaseSimple.hxx
diff --git a/src/DatabaseSong.cxx b/src/db/DatabaseSong.cxx
similarity index 100%
rename from src/DatabaseSong.cxx
rename to src/db/DatabaseSong.cxx
diff --git a/src/DatabaseSong.hxx b/src/db/DatabaseSong.hxx
similarity index 100%
rename from src/DatabaseSong.hxx
rename to src/db/DatabaseSong.hxx
diff --git a/src/Directory.cxx b/src/db/Directory.cxx
similarity index 99%
rename from src/Directory.cxx
rename to src/db/Directory.cxx
index 14cf88eb5..e74eabd19 100644
--- a/src/Directory.cxx
+++ b/src/db/Directory.cxx
@@ -22,7 +22,7 @@
 #include "LightDirectory.hxx"
 #include "SongFilter.hxx"
 #include "PlaylistVector.hxx"
-#include "DatabaseLock.hxx"
+#include "db/DatabaseLock.hxx"
 #include "SongSort.hxx"
 #include "Song.hxx"
 #include "LightSong.hxx"
diff --git a/src/Directory.hxx b/src/db/Directory.hxx
similarity index 99%
rename from src/Directory.hxx
rename to src/db/Directory.hxx
index c64a028ba..e114b27f4 100644
--- a/src/Directory.hxx
+++ b/src/db/Directory.hxx
@@ -23,7 +23,7 @@
 #include "check.h"
 #include "util/list.h"
 #include "Compiler.h"
-#include "DatabaseVisitor.hxx"
+#include "db/Visitor.hxx"
 #include "PlaylistVector.hxx"
 
 #include <string>
diff --git a/src/DirectorySave.cxx b/src/db/DirectorySave.cxx
similarity index 100%
rename from src/DirectorySave.cxx
rename to src/db/DirectorySave.cxx
diff --git a/src/DirectorySave.hxx b/src/db/DirectorySave.hxx
similarity index 100%
rename from src/DirectorySave.hxx
rename to src/db/DirectorySave.hxx
diff --git a/src/DatabaseHelpers.cxx b/src/db/Helpers.cxx
similarity index 98%
rename from src/DatabaseHelpers.cxx
rename to src/db/Helpers.cxx
index 58e7aaa3b..579b83e15 100644
--- a/src/DatabaseHelpers.cxx
+++ b/src/db/Helpers.cxx
@@ -17,7 +17,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "DatabaseHelpers.hxx"
+#include "Helpers.hxx"
 #include "DatabasePlugin.hxx"
 #include "LightSong.hxx"
 #include "tag/Tag.hxx"
diff --git a/src/DatabaseHelpers.hxx b/src/db/Helpers.hxx
similarity index 97%
rename from src/DatabaseHelpers.hxx
rename to src/db/Helpers.hxx
index 0880e4a56..24db260c0 100644
--- a/src/DatabaseHelpers.hxx
+++ b/src/db/Helpers.hxx
@@ -20,7 +20,7 @@
 #ifndef MPD_MEMORY_DATABASE_PLUGIN_HXX
 #define MPD_MEMORY_DATABASE_PLUGIN_HXX
 
-#include "DatabaseVisitor.hxx"
+#include "Visitor.hxx"
 #include "tag/TagType.h"
 
 class Error;
diff --git a/src/LightDirectory.hxx b/src/db/LightDirectory.hxx
similarity index 100%
rename from src/LightDirectory.hxx
rename to src/db/LightDirectory.hxx
diff --git a/src/LightSong.cxx b/src/db/LightSong.cxx
similarity index 100%
rename from src/LightSong.cxx
rename to src/db/LightSong.cxx
diff --git a/src/LightSong.hxx b/src/db/LightSong.hxx
similarity index 100%
rename from src/LightSong.hxx
rename to src/db/LightSong.hxx
diff --git a/src/DatabaseRegistry.cxx b/src/db/Registry.cxx
similarity index 88%
rename from src/DatabaseRegistry.cxx
rename to src/db/Registry.cxx
index b8a91343e..295d3cf2a 100644
--- a/src/DatabaseRegistry.cxx
+++ b/src/db/Registry.cxx
@@ -18,10 +18,10 @@
  */
 
 #include "config.h"
-#include "DatabaseRegistry.hxx"
-#include "db/SimpleDatabasePlugin.hxx"
-#include "db/ProxyDatabasePlugin.hxx"
-#include "db/UpnpDatabasePlugin.hxx"
+#include "Registry.hxx"
+#include "plugins/SimpleDatabasePlugin.hxx"
+#include "plugins/ProxyDatabasePlugin.hxx"
+#include "plugins/UpnpDatabasePlugin.hxx"
 
 #include <string.h>
 
diff --git a/src/DatabaseRegistry.hxx b/src/db/Registry.hxx
similarity index 100%
rename from src/DatabaseRegistry.hxx
rename to src/db/Registry.hxx
diff --git a/src/DatabaseSelection.cxx b/src/db/Selection.cxx
similarity index 97%
rename from src/DatabaseSelection.cxx
rename to src/db/Selection.cxx
index 035321252..96382eed7 100644
--- a/src/DatabaseSelection.cxx
+++ b/src/db/Selection.cxx
@@ -17,7 +17,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-#include "DatabaseSelection.hxx"
+#include "Selection.hxx"
 #include "SongFilter.hxx"
 
 DatabaseSelection::DatabaseSelection(const char *_uri, bool _recursive,
diff --git a/src/DatabaseSelection.hxx b/src/db/Selection.hxx
similarity index 100%
rename from src/DatabaseSelection.hxx
rename to src/db/Selection.hxx
diff --git a/src/Song.cxx b/src/db/Song.cxx
similarity index 100%
rename from src/Song.cxx
rename to src/db/Song.cxx
diff --git a/src/Song.hxx b/src/db/Song.hxx
similarity index 100%
rename from src/Song.hxx
rename to src/db/Song.hxx
diff --git a/src/SongSort.cxx b/src/db/SongSort.cxx
similarity index 100%
rename from src/SongSort.cxx
rename to src/db/SongSort.cxx
diff --git a/src/SongSort.hxx b/src/db/SongSort.hxx
similarity index 100%
rename from src/SongSort.hxx
rename to src/db/SongSort.hxx
diff --git a/src/DatabaseVisitor.hxx b/src/db/Visitor.hxx
similarity index 100%
rename from src/DatabaseVisitor.hxx
rename to src/db/Visitor.hxx
diff --git a/src/db/LazyDatabase.cxx b/src/db/plugins/LazyDatabase.cxx
similarity index 100%
rename from src/db/LazyDatabase.cxx
rename to src/db/plugins/LazyDatabase.cxx
diff --git a/src/db/LazyDatabase.hxx b/src/db/plugins/LazyDatabase.hxx
similarity index 98%
rename from src/db/LazyDatabase.hxx
rename to src/db/plugins/LazyDatabase.hxx
index f718ecb3f..336b8558f 100644
--- a/src/db/LazyDatabase.hxx
+++ b/src/db/plugins/LazyDatabase.hxx
@@ -20,7 +20,7 @@
 #ifndef MPD_LAZY_DATABASE_PLUGIN_HXX
 #define MPD_LAZY_DATABASE_PLUGIN_HXX
 
-#include "DatabasePlugin.hxx"
+#include "db/DatabasePlugin.hxx"
 
 /**
  * A wrapper for a #Database object that gets opened on the first
diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx
similarity index 98%
rename from src/db/ProxyDatabasePlugin.cxx
rename to src/db/plugins/ProxyDatabasePlugin.cxx
index 7253ba0d0..daa963c7d 100644
--- a/src/db/ProxyDatabasePlugin.cxx
+++ b/src/db/plugins/ProxyDatabasePlugin.cxx
@@ -19,13 +19,13 @@
 
 #include "config.h"
 #include "ProxyDatabasePlugin.hxx"
-#include "DatabasePlugin.hxx"
-#include "DatabaseListener.hxx"
-#include "DatabaseSelection.hxx"
-#include "DatabaseError.hxx"
+#include "db/DatabasePlugin.hxx"
+#include "db/DatabaseListener.hxx"
+#include "db/Selection.hxx"
+#include "db/DatabaseError.hxx"
 #include "PlaylistInfo.hxx"
-#include "LightDirectory.hxx"
-#include "LightSong.hxx"
+#include "db/LightDirectory.hxx"
+#include "db/LightSong.hxx"
 #include "SongFilter.hxx"
 #include "Compiler.h"
 #include "config/ConfigData.hxx"
diff --git a/src/db/ProxyDatabasePlugin.hxx b/src/db/plugins/ProxyDatabasePlugin.hxx
similarity index 100%
rename from src/db/ProxyDatabasePlugin.hxx
rename to src/db/plugins/ProxyDatabasePlugin.hxx
diff --git a/src/db/SimpleDatabasePlugin.cxx b/src/db/plugins/SimpleDatabasePlugin.cxx
similarity index 96%
rename from src/db/SimpleDatabasePlugin.cxx
rename to src/db/plugins/SimpleDatabasePlugin.cxx
index 73e080b41..55e08b6d7 100644
--- a/src/db/SimpleDatabasePlugin.cxx
+++ b/src/db/plugins/SimpleDatabasePlugin.cxx
@@ -19,15 +19,15 @@
 
 #include "config.h"
 #include "SimpleDatabasePlugin.hxx"
-#include "DatabaseSelection.hxx"
-#include "DatabaseHelpers.hxx"
-#include "LightDirectory.hxx"
-#include "Directory.hxx"
-#include "Song.hxx"
+#include "db/Selection.hxx"
+#include "db/Helpers.hxx"
+#include "db/LightDirectory.hxx"
+#include "db/Directory.hxx"
+#include "db/Song.hxx"
 #include "SongFilter.hxx"
-#include "DatabaseSave.hxx"
-#include "DatabaseLock.hxx"
-#include "DatabaseError.hxx"
+#include "db/DatabaseSave.hxx"
+#include "db/DatabaseLock.hxx"
+#include "db/DatabaseError.hxx"
 #include "fs/TextFile.hxx"
 #include "config/ConfigData.hxx"
 #include "fs/FileSystem.hxx"
diff --git a/src/db/SimpleDatabasePlugin.hxx b/src/db/plugins/SimpleDatabasePlugin.hxx
similarity index 97%
rename from src/db/SimpleDatabasePlugin.hxx
rename to src/db/plugins/SimpleDatabasePlugin.hxx
index 509b91e4e..137a60884 100644
--- a/src/db/SimpleDatabasePlugin.hxx
+++ b/src/db/plugins/SimpleDatabasePlugin.hxx
@@ -20,9 +20,9 @@
 #ifndef MPD_SIMPLE_DATABASE_PLUGIN_HXX
 #define MPD_SIMPLE_DATABASE_PLUGIN_HXX
 
-#include "DatabasePlugin.hxx"
+#include "db/DatabasePlugin.hxx"
 #include "fs/AllocatedPath.hxx"
-#include "LightSong.hxx"
+#include "db/LightSong.hxx"
 #include "Compiler.h"
 
 #include <cassert>
diff --git a/src/db/UpnpDatabasePlugin.cxx b/src/db/plugins/UpnpDatabasePlugin.cxx
similarity index 99%
rename from src/db/UpnpDatabasePlugin.cxx
rename to src/db/plugins/UpnpDatabasePlugin.cxx
index 46084061f..10575fc94 100644
--- a/src/db/UpnpDatabasePlugin.cxx
+++ b/src/db/plugins/UpnpDatabasePlugin.cxx
@@ -26,11 +26,11 @@
 #include "upnp/Directory.hxx"
 #include "upnp/Tags.hxx"
 #include "upnp/Util.hxx"
-#include "DatabasePlugin.hxx"
-#include "DatabaseSelection.hxx"
-#include "DatabaseError.hxx"
-#include "LightDirectory.hxx"
-#include "LightSong.hxx"
+#include "db/DatabasePlugin.hxx"
+#include "db/Selection.hxx"
+#include "db/DatabaseError.hxx"
+#include "db/LightDirectory.hxx"
+#include "db/LightSong.hxx"
 #include "config/ConfigData.hxx"
 #include "tag/TagBuilder.hxx"
 #include "tag/TagTable.hxx"
diff --git a/src/db/UpnpDatabasePlugin.hxx b/src/db/plugins/UpnpDatabasePlugin.hxx
similarity index 100%
rename from src/db/UpnpDatabasePlugin.hxx
rename to src/db/plugins/UpnpDatabasePlugin.hxx
diff --git a/src/db/upnp/Action.hxx b/src/db/plugins/upnp/Action.hxx
similarity index 100%
rename from src/db/upnp/Action.hxx
rename to src/db/plugins/upnp/Action.hxx
diff --git a/src/db/upnp/ContentDirectoryService.cxx b/src/db/plugins/upnp/ContentDirectoryService.cxx
similarity index 100%
rename from src/db/upnp/ContentDirectoryService.cxx
rename to src/db/plugins/upnp/ContentDirectoryService.cxx
diff --git a/src/db/upnp/ContentDirectoryService.hxx b/src/db/plugins/upnp/ContentDirectoryService.hxx
similarity index 100%
rename from src/db/upnp/ContentDirectoryService.hxx
rename to src/db/plugins/upnp/ContentDirectoryService.hxx
diff --git a/src/db/upnp/Device.cxx b/src/db/plugins/upnp/Device.cxx
similarity index 100%
rename from src/db/upnp/Device.cxx
rename to src/db/plugins/upnp/Device.cxx
diff --git a/src/db/upnp/Device.hxx b/src/db/plugins/upnp/Device.hxx
similarity index 100%
rename from src/db/upnp/Device.hxx
rename to src/db/plugins/upnp/Device.hxx
diff --git a/src/db/upnp/Directory.cxx b/src/db/plugins/upnp/Directory.cxx
similarity index 100%
rename from src/db/upnp/Directory.cxx
rename to src/db/plugins/upnp/Directory.cxx
diff --git a/src/db/upnp/Directory.hxx b/src/db/plugins/upnp/Directory.hxx
similarity index 100%
rename from src/db/upnp/Directory.hxx
rename to src/db/plugins/upnp/Directory.hxx
diff --git a/src/db/upnp/Discovery.cxx b/src/db/plugins/upnp/Discovery.cxx
similarity index 100%
rename from src/db/upnp/Discovery.cxx
rename to src/db/plugins/upnp/Discovery.cxx
diff --git a/src/db/upnp/Discovery.hxx b/src/db/plugins/upnp/Discovery.hxx
similarity index 100%
rename from src/db/upnp/Discovery.hxx
rename to src/db/plugins/upnp/Discovery.hxx
diff --git a/src/db/upnp/Domain.cxx b/src/db/plugins/upnp/Domain.cxx
similarity index 100%
rename from src/db/upnp/Domain.cxx
rename to src/db/plugins/upnp/Domain.cxx
diff --git a/src/db/upnp/Domain.hxx b/src/db/plugins/upnp/Domain.hxx
similarity index 100%
rename from src/db/upnp/Domain.hxx
rename to src/db/plugins/upnp/Domain.hxx
diff --git a/src/db/upnp/Object.cxx b/src/db/plugins/upnp/Object.cxx
similarity index 100%
rename from src/db/upnp/Object.cxx
rename to src/db/plugins/upnp/Object.cxx
diff --git a/src/db/upnp/Object.hxx b/src/db/plugins/upnp/Object.hxx
similarity index 100%
rename from src/db/upnp/Object.hxx
rename to src/db/plugins/upnp/Object.hxx
diff --git a/src/db/upnp/Tags.cxx b/src/db/plugins/upnp/Tags.cxx
similarity index 100%
rename from src/db/upnp/Tags.cxx
rename to src/db/plugins/upnp/Tags.cxx
diff --git a/src/db/upnp/Tags.hxx b/src/db/plugins/upnp/Tags.hxx
similarity index 100%
rename from src/db/upnp/Tags.hxx
rename to src/db/plugins/upnp/Tags.hxx
diff --git a/src/db/upnp/Util.cxx b/src/db/plugins/upnp/Util.cxx
similarity index 100%
rename from src/db/upnp/Util.cxx
rename to src/db/plugins/upnp/Util.cxx
diff --git a/src/db/upnp/Util.hxx b/src/db/plugins/upnp/Util.hxx
similarity index 100%
rename from src/db/upnp/Util.hxx
rename to src/db/plugins/upnp/Util.hxx
diff --git a/src/db/upnp/WorkQueue.hxx b/src/db/plugins/upnp/WorkQueue.hxx
similarity index 100%
rename from src/db/upnp/WorkQueue.hxx
rename to src/db/plugins/upnp/WorkQueue.hxx
diff --git a/src/db/upnp/ixmlwrap.cxx b/src/db/plugins/upnp/ixmlwrap.cxx
similarity index 100%
rename from src/db/upnp/ixmlwrap.cxx
rename to src/db/plugins/upnp/ixmlwrap.cxx
diff --git a/src/db/upnp/ixmlwrap.hxx b/src/db/plugins/upnp/ixmlwrap.hxx
similarity index 100%
rename from src/db/upnp/ixmlwrap.hxx
rename to src/db/plugins/upnp/ixmlwrap.hxx
diff --git a/src/db/upnp/upnpplib.cxx b/src/db/plugins/upnp/upnpplib.cxx
similarity index 100%
rename from src/db/upnp/upnpplib.cxx
rename to src/db/plugins/upnp/upnpplib.cxx
diff --git a/src/db/upnp/upnpplib.hxx b/src/db/plugins/upnp/upnpplib.hxx
similarity index 100%
rename from src/db/upnp/upnpplib.hxx
rename to src/db/plugins/upnp/upnpplib.hxx
diff --git a/src/update/InotifyDomain.cxx b/src/db/update/InotifyDomain.cxx
similarity index 100%
rename from src/update/InotifyDomain.cxx
rename to src/db/update/InotifyDomain.cxx
diff --git a/src/update/InotifyDomain.hxx b/src/db/update/InotifyDomain.hxx
similarity index 100%
rename from src/update/InotifyDomain.hxx
rename to src/db/update/InotifyDomain.hxx
diff --git a/src/update/InotifyQueue.cxx b/src/db/update/InotifyQueue.cxx
similarity index 100%
rename from src/update/InotifyQueue.cxx
rename to src/db/update/InotifyQueue.cxx
diff --git a/src/update/InotifyQueue.hxx b/src/db/update/InotifyQueue.hxx
similarity index 100%
rename from src/update/InotifyQueue.hxx
rename to src/db/update/InotifyQueue.hxx
diff --git a/src/update/InotifySource.cxx b/src/db/update/InotifySource.cxx
similarity index 100%
rename from src/update/InotifySource.cxx
rename to src/db/update/InotifySource.cxx
diff --git a/src/update/InotifySource.hxx b/src/db/update/InotifySource.hxx
similarity index 100%
rename from src/update/InotifySource.hxx
rename to src/db/update/InotifySource.hxx
diff --git a/src/update/InotifyUpdate.cxx b/src/db/update/InotifyUpdate.cxx
similarity index 100%
rename from src/update/InotifyUpdate.cxx
rename to src/db/update/InotifyUpdate.cxx
diff --git a/src/update/InotifyUpdate.hxx b/src/db/update/InotifyUpdate.hxx
similarity index 100%
rename from src/update/InotifyUpdate.hxx
rename to src/db/update/InotifyUpdate.hxx
diff --git a/src/update/UpdateArchive.cxx b/src/db/update/UpdateArchive.cxx
similarity index 98%
rename from src/update/UpdateArchive.cxx
rename to src/db/update/UpdateArchive.cxx
index ec46a4e17..5e733202d 100644
--- a/src/update/UpdateArchive.cxx
+++ b/src/db/update/UpdateArchive.cxx
@@ -21,9 +21,9 @@
 #include "UpdateArchive.hxx"
 #include "UpdateInternal.hxx"
 #include "UpdateDomain.hxx"
-#include "DatabaseLock.hxx"
-#include "Directory.hxx"
-#include "Song.hxx"
+#include "db/DatabaseLock.hxx"
+#include "db/Directory.hxx"
+#include "db/Song.hxx"
 #include "Mapper.hxx"
 #include "fs/AllocatedPath.hxx"
 #include "archive/ArchiveList.hxx"
diff --git a/src/update/UpdateArchive.hxx b/src/db/update/UpdateArchive.hxx
similarity index 100%
rename from src/update/UpdateArchive.hxx
rename to src/db/update/UpdateArchive.hxx
diff --git a/src/update/UpdateContainer.cxx b/src/db/update/UpdateContainer.cxx
similarity index 97%
rename from src/update/UpdateContainer.cxx
rename to src/db/update/UpdateContainer.cxx
index 0417aa999..c03d88748 100644
--- a/src/update/UpdateContainer.cxx
+++ b/src/db/update/UpdateContainer.cxx
@@ -22,9 +22,9 @@
 #include "UpdateInternal.hxx"
 #include "UpdateDatabase.hxx"
 #include "UpdateDomain.hxx"
-#include "DatabaseLock.hxx"
-#include "Directory.hxx"
-#include "Song.hxx"
+#include "db/DatabaseLock.hxx"
+#include "db/Directory.hxx"
+#include "db/Song.hxx"
 #include "decoder/DecoderPlugin.hxx"
 #include "decoder/DecoderList.hxx"
 #include "Mapper.hxx"
diff --git a/src/update/UpdateContainer.hxx b/src/db/update/UpdateContainer.hxx
similarity index 100%
rename from src/update/UpdateContainer.hxx
rename to src/db/update/UpdateContainer.hxx
diff --git a/src/update/UpdateDatabase.cxx b/src/db/update/UpdateDatabase.cxx
similarity index 96%
rename from src/update/UpdateDatabase.cxx
rename to src/db/update/UpdateDatabase.cxx
index fe49a90fb..8ef0b6d82 100644
--- a/src/update/UpdateDatabase.cxx
+++ b/src/db/update/UpdateDatabase.cxx
@@ -21,9 +21,9 @@
 #include "UpdateDatabase.hxx"
 #include "UpdateRemove.hxx"
 #include "PlaylistVector.hxx"
-#include "Directory.hxx"
-#include "Song.hxx"
-#include "DatabaseLock.hxx"
+#include "db/Directory.hxx"
+#include "db/Song.hxx"
+#include "db/DatabaseLock.hxx"
 
 #include <assert.h>
 #include <stddef.h>
diff --git a/src/update/UpdateDatabase.hxx b/src/db/update/UpdateDatabase.hxx
similarity index 100%
rename from src/update/UpdateDatabase.hxx
rename to src/db/update/UpdateDatabase.hxx
diff --git a/src/update/UpdateDomain.cxx b/src/db/update/UpdateDomain.cxx
similarity index 100%
rename from src/update/UpdateDomain.cxx
rename to src/db/update/UpdateDomain.cxx
diff --git a/src/update/UpdateDomain.hxx b/src/db/update/UpdateDomain.hxx
similarity index 100%
rename from src/update/UpdateDomain.hxx
rename to src/db/update/UpdateDomain.hxx
diff --git a/src/update/UpdateGlue.cxx b/src/db/update/UpdateGlue.cxx
similarity index 99%
rename from src/update/UpdateGlue.cxx
rename to src/db/update/UpdateGlue.cxx
index 29e5f3ca7..d18747ba1 100644
--- a/src/update/UpdateGlue.cxx
+++ b/src/db/update/UpdateGlue.cxx
@@ -24,7 +24,7 @@
 #include "UpdateRemove.hxx"
 #include "UpdateDomain.hxx"
 #include "Mapper.hxx"
-#include "DatabaseSimple.hxx"
+#include "db/DatabaseSimple.hxx"
 #include "Idle.hxx"
 #include "GlobalEvents.hxx"
 #include "util/Error.hxx"
diff --git a/src/update/UpdateGlue.hxx b/src/db/update/UpdateGlue.hxx
similarity index 100%
rename from src/update/UpdateGlue.hxx
rename to src/db/update/UpdateGlue.hxx
diff --git a/src/update/UpdateIO.cxx b/src/db/update/UpdateIO.cxx
similarity index 99%
rename from src/update/UpdateIO.cxx
rename to src/db/update/UpdateIO.cxx
index 8e4406dc8..f91caf359 100644
--- a/src/update/UpdateIO.cxx
+++ b/src/db/update/UpdateIO.cxx
@@ -20,7 +20,7 @@
 #include "config.h" /* must be first for large file support */
 #include "UpdateIO.hxx"
 #include "UpdateDomain.hxx"
-#include "Directory.hxx"
+#include "db/Directory.hxx"
 #include "Mapper.hxx"
 #include "fs/AllocatedPath.hxx"
 #include "fs/FileSystem.hxx"
diff --git a/src/update/UpdateIO.hxx b/src/db/update/UpdateIO.hxx
similarity index 100%
rename from src/update/UpdateIO.hxx
rename to src/db/update/UpdateIO.hxx
diff --git a/src/update/UpdateInternal.hxx b/src/db/update/UpdateInternal.hxx
similarity index 100%
rename from src/update/UpdateInternal.hxx
rename to src/db/update/UpdateInternal.hxx
diff --git a/src/update/UpdateQueue.cxx b/src/db/update/UpdateQueue.cxx
similarity index 100%
rename from src/update/UpdateQueue.cxx
rename to src/db/update/UpdateQueue.cxx
diff --git a/src/update/UpdateQueue.hxx b/src/db/update/UpdateQueue.hxx
similarity index 100%
rename from src/update/UpdateQueue.hxx
rename to src/db/update/UpdateQueue.hxx
diff --git a/src/update/UpdateRemove.cxx b/src/db/update/UpdateRemove.cxx
similarity index 97%
rename from src/update/UpdateRemove.cxx
rename to src/db/update/UpdateRemove.cxx
index 30898b00b..c57758aef 100644
--- a/src/update/UpdateRemove.cxx
+++ b/src/db/update/UpdateRemove.cxx
@@ -23,8 +23,8 @@
 #include "GlobalEvents.hxx"
 #include "thread/Mutex.hxx"
 #include "thread/Cond.hxx"
-#include "Song.hxx"
-#include "LightSong.hxx"
+#include "db/Song.hxx"
+#include "db/LightSong.hxx"
 #include "Main.hxx"
 #include "Instance.hxx"
 #include "Log.hxx"
diff --git a/src/update/UpdateRemove.hxx b/src/db/update/UpdateRemove.hxx
similarity index 100%
rename from src/update/UpdateRemove.hxx
rename to src/db/update/UpdateRemove.hxx
diff --git a/src/update/UpdateSong.cxx b/src/db/update/UpdateSong.cxx
similarity index 97%
rename from src/update/UpdateSong.cxx
rename to src/db/update/UpdateSong.cxx
index 2db85a674..ac2d01cd2 100644
--- a/src/update/UpdateSong.cxx
+++ b/src/db/update/UpdateSong.cxx
@@ -24,9 +24,9 @@
 #include "UpdateDatabase.hxx"
 #include "UpdateContainer.hxx"
 #include "UpdateDomain.hxx"
-#include "DatabaseLock.hxx"
-#include "Directory.hxx"
-#include "Song.hxx"
+#include "db/DatabaseLock.hxx"
+#include "db/Directory.hxx"
+#include "db/Song.hxx"
 #include "decoder/DecoderList.hxx"
 #include "Log.hxx"
 
diff --git a/src/update/UpdateSong.hxx b/src/db/update/UpdateSong.hxx
similarity index 100%
rename from src/update/UpdateSong.hxx
rename to src/db/update/UpdateSong.hxx
diff --git a/src/update/UpdateWalk.cxx b/src/db/update/UpdateWalk.cxx
similarity index 98%
rename from src/update/UpdateWalk.cxx
rename to src/db/update/UpdateWalk.cxx
index 21754b31d..c5a9936e9 100644
--- a/src/update/UpdateWalk.cxx
+++ b/src/db/update/UpdateWalk.cxx
@@ -24,10 +24,10 @@
 #include "UpdateSong.hxx"
 #include "UpdateArchive.hxx"
 #include "UpdateDomain.hxx"
-#include "DatabaseLock.hxx"
-#include "DatabaseSimple.hxx"
-#include "Directory.hxx"
-#include "Song.hxx"
+#include "db/DatabaseLock.hxx"
+#include "db/DatabaseSimple.hxx"
+#include "db/Directory.hxx"
+#include "db/Song.hxx"
 #include "PlaylistVector.hxx"
 #include "playlist/PlaylistRegistry.hxx"
 #include "Mapper.hxx"
diff --git a/src/update/UpdateWalk.hxx b/src/db/update/UpdateWalk.hxx
similarity index 100%
rename from src/update/UpdateWalk.hxx
rename to src/db/update/UpdateWalk.hxx
diff --git a/src/playlist/PlaylistSong.cxx b/src/playlist/PlaylistSong.cxx
index bcbdc30be..69f8762ab 100644
--- a/src/playlist/PlaylistSong.cxx
+++ b/src/playlist/PlaylistSong.cxx
@@ -20,7 +20,7 @@
 #include "config.h"
 #include "PlaylistSong.hxx"
 #include "Mapper.hxx"
-#include "DatabaseSong.hxx"
+#include "db/DatabaseSong.hxx"
 #include "ls.hxx"
 #include "tag/Tag.hxx"
 #include "tag/TagBuilder.hxx"
diff --git a/src/queue/QueueSave.cxx b/src/queue/QueueSave.cxx
index 87de02c56..11c61aa9a 100644
--- a/src/queue/QueueSave.cxx
+++ b/src/queue/QueueSave.cxx
@@ -23,7 +23,7 @@
 #include "PlaylistError.hxx"
 #include "DetachedSong.hxx"
 #include "SongSave.hxx"
-#include "DatabaseSong.hxx"
+#include "db/DatabaseSong.hxx"
 #include "fs/TextFile.hxx"
 #include "util/StringUtil.hxx"
 #include "util/UriUtil.hxx"
diff --git a/src/sticker/SongSticker.cxx b/src/sticker/SongSticker.cxx
index 55143d278..3431a1702 100644
--- a/src/sticker/SongSticker.cxx
+++ b/src/sticker/SongSticker.cxx
@@ -20,9 +20,9 @@
 #include "config.h"
 #include "SongSticker.hxx"
 #include "StickerDatabase.hxx"
-#include "LightSong.hxx"
-#include "Song.hxx"
-#include "Directory.hxx"
+#include "db/LightSong.hxx"
+#include "db/Song.hxx"
+#include "db/Directory.hxx"
 
 #include <glib.h>
 
diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx
index 034bad72b..0be1191d2 100644
--- a/test/DumpDatabase.cxx
+++ b/test/DumpDatabase.cxx
@@ -18,12 +18,12 @@
  */
 
 #include "config.h"
-#include "DatabaseRegistry.hxx"
-#include "DatabasePlugin.hxx"
-#include "DatabaseSelection.hxx"
-#include "DatabaseListener.hxx"
-#include "LightDirectory.hxx"
-#include "LightSong.hxx"
+#include "db/Registry.hxx"
+#include "db/DatabasePlugin.hxx"
+#include "db/Selection.hxx"
+#include "db/DatabaseListener.hxx"
+#include "db/LightDirectory.hxx"
+#include "db/LightSong.hxx"
 #include "PlaylistVector.hxx"
 #include "config/ConfigGlobal.hxx"
 #include "config/ConfigData.hxx"
diff --git a/test/run_inotify.cxx b/test/run_inotify.cxx
index 9ed00d3d6..7d77372f0 100644
--- a/test/run_inotify.cxx
+++ b/test/run_inotify.cxx
@@ -19,7 +19,7 @@
 
 #include "config.h"
 #include "ShutdownHandler.hxx"
-#include "update/InotifySource.hxx"
+#include "db/update/InotifySource.hxx"
 #include "event/Loop.hxx"
 #include "util/Error.hxx"
 #include "Log.hxx"
diff --git a/test/test_translate_song.cxx b/test/test_translate_song.cxx
index fcda35f13..006bd56aa 100644
--- a/test/test_translate_song.cxx
+++ b/test/test_translate_song.cxx
@@ -11,7 +11,7 @@
 #include "fs/AllocatedPath.hxx"
 #include "ls.hxx"
 #include "Log.hxx"
-#include "DatabaseSong.hxx"
+#include "db/DatabaseSong.hxx"
 #include "Mapper.hxx"
 
 #include <cppunit/TestFixture.h>