Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
e113ce96
Commit
e113ce96
authored
Sep 16, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/InotifyUpdate: obey `.mpdignore` files
Closes
https://github.com/MusicPlayerDaemon/MPD/issues/846
parent
e8213220
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
2 deletions
+31
-2
NEWS
NEWS
+2
-0
InotifyUpdate.cxx
src/db/update/InotifyUpdate.cxx
+29
-2
No files found.
NEWS
View file @
e113ce96
ver 0.21.26 (not yet released)
* database
- inotify: obey ".mpdignore" files
* output
- osx: fix crash bug
- sles: support floating point samples
...
...
src/db/update/InotifyUpdate.cxx
View file @
e113ce96
...
...
@@ -21,11 +21,15 @@
#include "InotifySource.hxx"
#include "InotifyQueue.hxx"
#include "InotifyDomain.hxx"
#include "ExcludeList.hxx"
#include "storage/StorageInterface.hxx"
#include "input/InputStream.hxx"
#include "input/Error.hxx"
#include "fs/AllocatedPath.hxx"
#include "fs/DirectoryReader.hxx"
#include "fs/FileInfo.hxx"
#include "fs/Traits.hxx"
#include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include "Log.hxx"
...
...
@@ -52,6 +56,8 @@ struct WatchDirectory {
int
descriptor
;
ExcludeList
exclude_list
;
std
::
forward_list
<
WatchDirectory
>
children
;
template
<
typename
N
>
...
...
@@ -64,11 +70,14 @@ struct WatchDirectory {
WatchDirectory
(
WatchDirectory
&
_parent
,
N
&&
_name
,
int
_descriptor
)
:
parent
(
&
_parent
),
name
(
std
::
forward
<
N
>
(
_name
)),
descriptor
(
_descriptor
)
{}
descriptor
(
_descriptor
),
exclude_list
(
_parent
.
exclude_list
)
{}
WatchDirectory
(
const
WatchDirectory
&
)
=
delete
;
WatchDirectory
&
operator
=
(
const
WatchDirectory
&
)
=
delete
;
void
LoadExcludeList
(
Path
directory_path
)
noexcept
;
gcc_pure
unsigned
GetDepth
()
const
noexcept
;
...
...
@@ -76,6 +85,18 @@ struct WatchDirectory {
AllocatedPath
GetUriFS
()
const
noexcept
;
};
void
WatchDirectory
::
LoadExcludeList
(
Path
directory_path
)
noexcept
try
{
Mutex
mutex
;
auto
is
=
InputStream
::
OpenReady
((
directory_path
/
Path
::
FromFS
(
".mpdignore"
)).
c_str
(),
mutex
);
exclude_list
.
Load
(
std
::
move
(
is
));
}
catch
(...)
{
if
(
!
IsFileNotFound
(
std
::
current_exception
()))
LogError
(
std
::
current_exception
());
}
static
InotifySource
*
inotify_source
;
static
InotifyQueue
*
inotify_queue
;
...
...
@@ -163,7 +184,8 @@ SkipFilename(Path name) noexcept
static
void
recursive_watch_subdirectories
(
WatchDirectory
&
parent
,
const
AllocatedPath
&
path_fs
,
unsigned
depth
)
const
AllocatedPath
&
path_fs
,
unsigned
depth
)
try
{
assert
(
depth
<=
inotify_max_depth
);
assert
(
!
path_fs
.
IsNull
());
...
...
@@ -181,6 +203,9 @@ try {
if
(
SkipFilename
(
name_fs
))
continue
;
if
(
parent
.
exclude_list
.
Check
(
name_fs
))
continue
;
const
auto
child_path_fs
=
path_fs
/
name_fs
;
FileInfo
fi
;
...
...
@@ -213,6 +238,7 @@ try {
name_fs
,
ret
);
child
=
&
parent
.
children
.
front
();
child
->
LoadExcludeList
(
child_path_fs
);
tree_add_watch_directory
(
child
);
...
...
@@ -317,6 +343,7 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update,
}
inotify_root
=
new
WatchDirectory
(
path
,
descriptor
);
inotify_root
->
LoadExcludeList
(
path
);
tree_add_watch_directory
(
inotify_root
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment