From 127bd89b4481f58a0df5701775f0d25f64dbbd4c Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 27 Mar 2023 03:56:36 +0300 Subject: [PATCH] filesystem: remove unused watch.c file, added by mistake from inotify branch --- filesystem/watch.c | 117 --------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 filesystem/watch.c diff --git a/filesystem/watch.c b/filesystem/watch.c deleted file mode 100644 index 1d4cf7ea..00000000 --- a/filesystem/watch.c +++ /dev/null @@ -1,117 +0,0 @@ -#if 0 -#include "build.h" -#if XASH_LINUX -#include -#include -#include -#endif -#include "filesystem_internal.h" -#include "common/com_strings.h" - -#define MAX_FS_WATCHES 256 - -struct -{ -#if XASH_LINUX - int fd; - int count; - struct - { - fs_event_callback_t callback; - int fd; - } watch[MAX_FS_WATCHES]; -#endif // XASH_LINUX -} fsnotify; - -#if XASH_LINUX -static qboolean FS_InotifyInit( void ) -{ - int fd; - - if(( fd = inotify_init1( IN_NONBLOCK )) < 0 ) - { - Con_Printf( S_ERROR "inotify_init1 failed: %s", strerror( errno )); - return false; - } - - fsnotify.fd = fd; - return true; -} - -static qboolean FS_InotifyWasInit( void ) -{ - return fsnotify.fd >= 0; -} -#endif - -/* -=============== -FS_AddWatch - -Adds on-disk path to filesystem watcher list -Every file modification will call back -=============== -*/ -int FS_AddWatch( const char *path, fs_event_callback_t callback ) -{ -#if XASH_LINUX - int fd; - const uint mask = IN_CREATE | IN_DELETE | IN_MODIFY; - - if( !FS_InotifyWasInit() && !FS_InotifyInit()) - return false; - - if(( fd = inotify_add_watch( fsnotify.fd, path, mask )) < 0 ) - { - Con_Printf( S_ERROR "inotify_add_watch failed: %s", strerror( errno )); - return false; - } - - fsnotify.watch[fsnotify.count].fd = fd; - fsnotify.watch[fsnotify.count].callback = callback; - - return true; -#else - return false; -#endif -} - -/* -=============== -FS_WatchFrame - -Polls any changes and runs call backs -=============== -*/ -void FS_WatchFrame( void ) -{ -#if XASH_LINUX - int i; - - for( i = 0; i < fsnotify.count; i++ ) - { - struct inotify_event events; - } - -#endif -} - -/* -=============== -FS_WatchInitialize - -initializes filesystem watcher subsystem -=============== -*/ -qboolean FS_WatchInitialize( void ) -{ -#if XASH_LINUX - fsnotify.fd = -1; // only call inotify init when requested - fsnotify.count = 0; - - return true; -#else - return false; -#endif -} -#endif // 0