11 Commits

Author SHA1 Message Date
Gleb Smirnoff
ee912576b3 Separate platform indepenent code into monitor.c, and move inotify(7)
specific code to monitor_inotify.c.
Both monitor_inotify.c and monitor_kqueue.c provide their functions
for adding and removing watches. Prefix these functions with monitor_.
2021-01-07 10:58:29 -08:00
Vlad Starodubtsev
204a0ded8d monitor: fix setting max_user_watches.
reset file position after read.
2020-11-18 14:45:11 -08:00
Justin Maggard
9f1677825c Fix some warnings from newer compilers 2020-11-18 14:45:11 -08:00
Gleb Smirnoff
3e8da9bb1a Return back checking file for sparseness. Use lseek(SEEK_HOLE) if supported by the system, otherwise fallback to block check. This allows to workaround bugs with SMB client and not introduce new bugs for filesystems with compression and deduplication.
This has theoretical bug if our collection spans different
filesystems and some filesystems support holes, and some not.
If this ever encountered we should use pathconf(2) and cache
its result for directories.
2018-01-16 17:05:44 -08:00
Gleb Smirnoff
42f0630198 Remove (st.st_blocks<<9 >= st.st_size) check. It may fail if a file system supports deduplication, compression and other features.
My guess the goal was to skip files with holes in them. Original commit
590f0761f4aba64c4a3b4c8f11543a929178da38, doesn't explain that. If that
is still necessary, better to add lseek(SEEK_DATA) check later.
2018-01-16 17:02:01 -08:00
Gleb Smirnoff
5e320f2798 Add monitoring support via kqueue(2). Based on patch from FreeBSD ports, authored by wg@FreeBSD.org and se@FreeBSD.org. However, this version doesn't create any thread, it uses main event dispatcher.
Some effort was made to unify monitoring via kqueue and via inotify
APIs. Now both provide their implementation of add_watch() function.

I guess there are some logical bugs in vnode_process(). With this commit
it would be better provide code as is, and resolve bugs separately.
2018-01-16 17:01:43 -08:00
Justin Maggard
3990f61c57 monitor: Abort inotify directory scanning on quit
Add more interruption point in case we receive a quit signal while we're
scanning a large directory.
2018-01-12 13:57:58 -08:00
Justin Maggard
ad5d6413a7 If no group is specified, use the user's primary group 2017-10-06 16:05:01 -07:00
Justin Maggard
50b1a2e289 scanner: Clean up non-destructive rescan
Fix several issues with the non-destructive rescan functionality.
Most of these issues also affected inotify scanning as well.  These
include annoying debug messages, adding album art for files that we
aren't supposed to be scanning anyway, incrementing the UpdateID when no
changes were made to the database, and other smaller issues.
2017-08-23 23:43:42 -07:00
Justin Maggard
9e534c56fd monitor: Support NFO file changes
Detect when a .nfo file changes, and rescan metadata for the associated
video file.
2017-08-22 15:30:10 -07:00
Justin Maggard
49aa42d893 scanner: Add non-destructive update rescan
New functionality, based on Shrimpkin's patch #145 on SF.
2017-05-04 23:29:59 -07:00