Commit Graph

53 Commits

Author SHA1 Message Date
Max Kellermann
cc0def15c4 Copyright year 2022 2022-07-14 17:59:35 +02:00
Max Kellermann
9b427b3171 command/*: use std::span instead of ConstBuffer 2022-07-04 18:58:13 +02:00
Max Kellermann
0440c41cba client/Response: add method Fmt() based on libfmt 2021-05-25 16:01:56 +02:00
Max Kellermann
5348f8c9c8 copyright year 2021 2021-01-01 19:54:28 +01:00
Max Kellermann
c3cfb5fe16 Merge branch 'v0.21.x' 2020-07-06 20:56:52 +02:00
Max Kellermann
fe48e5596f command/storage: automatically scan new mounts
Closes https://github.com/MusicPlayerDaemon/MPD/issues/841
2020-07-06 20:23:41 +02:00
Max Kellermann
d7744d2b8e command/storage: check if storage is already mounted
Mounting one storage URI twice on different mount points can lead to
conflicts with the database cache file, and it doesn't make a lot of
sense.

But most importantly, our udisks storage plugin will unmount the disk
from the kernel VFS, and if two exist, they will compete with each
others.  We could (and should) fix this in the udisks storage plugin,
but for now, this workaround is good enough (and useful).
2020-07-06 18:02:47 +02:00
Max Kellermann
33ee35ab92 command/storage: check if mount point is busy
When mounting something over a directory that is already a mount
point, CompositeStorage::Mount() silently overwrites the previously
mounted storage, disposing it.  After that, SimpleDatabase::Mount()
will fail and handle_mount() will roll back the
CompositeStorage::Mount() command, effectively unmounting what was
there before (and also leaking memory).

Closes https://github.com/MusicPlayerDaemon/MPD/issues/918
2020-07-06 17:49:38 +02:00
Rosen Penev
e4dad42ca1 use std chr functions
The ones in std have overloads for const char/char.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-30 13:36:53 +02:00
Rosen Penev
97425d56e7
remove gcc_unused
[[maybe_unused]] (introduced in C++17) is standard C++.

https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused
says that this is equivalent to the GNU unused attribute.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16 00:08:21 -07:00
Rosen Penev
5cd400f578
replace inttypes.h with cinttypes
The former has been deprecated by C++14. They are also the same.

From the standard:

The contents and meaning of the header<cinttypes>are the same as the C
standard library header<inttypes.h>, with the following changes:

-The header<cinttypes>includes the header<cstdint>instead of<stdint.h>,and
—if and only if the typeintmax_tdesignates an extended integer type
 (6.7.1), the following functionsignatures are added:intmax_t
abs(intmax_t);imaxdiv_t div(intmax_t, intmax_t);which shall have the same
semantics as the function signaturesintmax_t imaxabs(intmax_t)andimaxdiv_t
imaxdiv(intmax_t, intmax_t), respectively.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12 16:07:28 -07:00
Max Kellermann
2817bf9e95 copyright year 2020 2020-01-18 19:23:49 +01:00
Max Kellermann
e9af692973 util/Time*: move to time/ 2019-12-16 23:02:14 +01:00
Max Kellermann
d663f81420 include cleanups (powered by iwyu) 2019-07-05 09:59:58 +02:00
Max Kellermann
a139279575 Copyright year 2019 2019-06-17 11:17:30 +02:00
Max Kellermann
214ddee2f5 util/Time*: move to time/ 2019-05-08 15:47:58 +02:00
Max Kellermann
8b5c33cecd Instance: use std::unique_ptr<> to manage the Database pointer 2019-02-20 20:48:20 +01:00
Max Kellermann
bda77ffc5b db/Interface: remove IsPlugin(), use dynamic_cast instead 2018-11-19 19:38:20 +01:00
Max Kellermann
f5c9071494 *: copyright year 2018 2018-10-31 17:54:59 +01:00
Max Kellermann
dcd483bd99 storage/Composite: use std::unique_ptr<Storage> 2018-01-02 16:18:34 +01:00
Max Kellermann
3c5e4e2788 storage/Plugin: return std::unique_ptr<Storage> 2018-01-02 16:11:17 +01:00
Max Kellermann
914df18bf9 Main, ...: catch any exception, not just std::runtime_error 2017-12-19 10:56:23 +01:00
Max Kellermann
6246d36fe6 Merge branch 'v0.20.x' 2017-12-16 20:56:06 +01:00
Max Kellermann
dfaf08743c *: check defined(_WIN32) instead of defined(WIN32)
Only _WIN32 is defined by the compiler, and WIN32 is not standardized
and may be missing.

Closes #169
2017-12-12 10:22:20 +01:00
Max Kellermann
4faef28cc5 release v0.20.7
-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEA5IzWngIOJSkMBxDI26KWMbbRRIFAlkaFL0QHG1heEBtdXNp
 Y3BkLm9yZwAKCRAjbopYxttFEr4ID/9iAQC+7fFv06uLOm48Ufu+PgoD8uJkAwF5
 QuLQkc85g9urn+bu9N7Qs7Vypp7aLyGcJKY0jyA8wxkOj24pUC3GYk80daUt561V
 5s20FnoS/Uoman3CSJL94IfCUBxejizE6vgIIHTc5bb6U0qIsPub/8JTTE2Ih7uP
 nvFZ5uBQ+YTc7at+iIH9123eUMKkitkh8osNblovqQT9v42++Tm4ztAytRHBjwUA
 Itew5HhlvahbLKqFs/7vmICh/YX1FcOV7cV+erEWYfkH0KCI2bhSle4u2d0CBOvD
 VJlDnBCo9bM7WKcPYqJiFFFXA0CRk06wbkkkAtwF4zjp8xos7aQcq4FyQnYL8KXo
 5lijIhRwBURBd+nt8oA9kuEhBt/T75otcemJkzVaYappHTJCLjhxSGcPt8mw+nE9
 9WQzsp/MIVzg9l5g3D9S/43xM7uhvn98Tn1Qf2s8YRd2o8CZeOhW+X3RvbCvVPv2
 mOlx4sFAv8DOJ3KxMdqiJT+PmylPyJluQdqH+tMc8BdPg/kpSpYIPTuSjjRqK1yh
 ld5do0HtAAwiHtvXfk5YVFjJSpO0c8yVn6xci2Cl4k/5ZHj2UE1ln+N5vCea2BRF
 2J3HAjROwtcwY3lU1jFnEAogf24KWiFJqhhC0EqBGUdlrM8Dn37P5cEWWjROIMNK
 lPEdovokNw==
 =CdDy
 -----END PGP SIGNATURE-----

Merge tag 'v0.20.7'

release v0.20.7
2017-05-15 23:01:49 +02:00
Max Kellermann
71f0ed8b74 *: add "noexcept" to many, many function prototypes
This eliminates some overhead, because the compiler doesn't need to
consider these functions throwing.
2017-05-08 14:44:49 +02:00
Max Kellermann
e3ee60e7af command/storage: use Instance::EmitIdle()
These events are relevant for all partitions.
2017-02-25 10:20:07 +01:00
Max Kellermann
05b8ddac4c Client: add method GetInstance() 2017-02-25 10:20:05 +01:00
Max Kellermann
6636c69a11 storage/FileInfo: convert mtime to std::chrono::system_clock::time_point 2017-02-11 23:45:15 +01:00
Max Kellermann
5e081de14a IOThread: move EventThread instance into struct Instance
Eliminate global variables.
2017-02-10 22:25:06 +01:00
Max Kellermann
5900253b85 update copyright year 2017-01-03 20:48:59 +01:00
Max Kellermann
df142d4f61 db/simple: migrate Mount() from class Error to C++ exceptions 2016-10-29 10:56:31 +02:00
Max Kellermann
c598686bd9 storage: migrate from class Error to C++ exceptions 2016-10-27 21:35:19 +02:00
Max Kellermann
60f72f0ff9 command/Storage: use std::unique_ptr 2016-10-27 21:04:40 +02:00
Max Kellermann
b24a5e0662 Partition: add method EmitIdle()
Prepare for moving idle events to class Partition.  Right now, it's
just a wrapper for idle_add().
2016-03-05 19:16:39 +01:00
Max Kellermann
5b8dce7456 db/simple: throw DatabaseError on error 2016-02-28 11:40:59 +01:00
Max Kellermann
1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Max Kellermann
86e036c393 command: pass Response object to command callbacks 2015-08-13 12:48:31 +02:00
Max Kellermann
7652a2986b client/Response: new Client wrapper class for writing responses 2015-08-12 08:41:05 +02:00
Max Kellermann
0f92d021a1 command/Request: new struct wrapping ConstBuffer<const char *> 2015-08-11 22:43:10 +02:00
Max Kellermann
6ff394bcc9 StorageCommands: use PathTraitsUTF8 for protocol argument 2015-03-02 21:25:55 +01:00
Max Kellermann
2d06a8e880 storage/FileInfo: rename to StorageFileInfo 2015-02-28 23:00:26 +01:00
Max Kellermann
712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann
6edfc56c9d command: use ConstBuffer<const char *> for argument list 2014-12-08 13:30:35 +01:00
Max Kellermann
3d2558bde6 StoragePlugin: pass EventLoop to constructor 2014-10-09 07:45:25 +02:00
Max Kellermann
2da0322329 command: make argc unsigned 2014-06-16 19:50:34 +02:00
Max Kellermann
88eae9dabb command/{storage,file}: suppress bogus format warnings on WIN32 2014-03-14 08:58:43 +01:00
Max Kellermann
96afa8bd2b command: add command "listfiles"
Lists files and directories.  Supports storage plugins.
2014-03-01 06:25:57 +01:00
Max Kellermann
e9a85aa4e4 db/simple: mount points
A SimpleDatabase instance can now "mount" other Database instances at
certain locations.  This is used to use a new SimpleDatabase instance
for each storage mount (issued with the "mount" protocol command).
Each such instance has its own database file, stored in the directory
that is specified with the "cache_directory" option.
2014-02-27 20:49:13 +01:00
Max Kellermann
df9667a497 StorageCommands: add command "unmount" 2014-02-12 23:48:08 +01:00