diff --git a/builtin/client_file/client_file.cpp b/builtin/client_file/client_file.cpp index 2aca320..0ee5c0b 100644 --- a/builtin/client_file/client_file.cpp +++ b/builtin/client_file/client_file.cpp @@ -33,12 +33,12 @@ struct Module: public interface::Module, public client_file::Interface { interface::Server *m_server; sm_> m_files; - sp_ m_watch; + sp_ m_watch; Module(interface::Server *server): interface::Module("client_file"), m_server(server), - m_watch(interface::createMultiFileWatch()) + m_watch(interface::createFileWatch()) { log_v(MODULE, "client_file construct"); } diff --git a/src/impl/linux/file_watch.cpp b/src/impl/linux/file_watch.cpp index 2e03f9e..5778403 100644 --- a/src/impl/linux/file_watch.cpp +++ b/src/impl/linux/file_watch.cpp @@ -13,7 +13,7 @@ namespace interface { -struct CMultiFileWatch: MultiFileWatch +struct CFileWatch: FileWatch { struct WatchThing { ss_ path; @@ -26,16 +26,16 @@ struct CMultiFileWatch: MultiFileWatch int m_fd = -1; sm_> m_watch; - CMultiFileWatch() + CFileWatch() { m_fd = inotify_init1(IN_NONBLOCK); - log_d(MODULE, "CMultiFileWatch(): m_fd=%i", m_fd); + log_d(MODULE, "CFileWatch(): m_fd=%i", m_fd); if(m_fd == -1){ throw Exception(ss_()+"inotify_init() failed: "+strerror(errno)); } } - ~CMultiFileWatch() + ~CFileWatch() { close(m_fd); } @@ -79,12 +79,12 @@ struct CMultiFileWatch: MultiFileWatch if(r == -1){ if(errno == EAGAIN) break; - log_w(MODULE, "CMultiFileWatch::report_fd(): read() failed " + log_w(MODULE, "CFileWatch::report_fd(): read() failed " "on fd=%i: %s", fd, strerror(errno)); break; } if(r < (int)INOTIFY_STRUCTSIZE){ - throw Exception("CMultiFileWatch::report_fd(): read() -> "+itos(r)); + throw Exception("CFileWatch::report_fd(): read() -> "+itos(r)); } struct inotify_event *in_event = (struct inotify_event*)buf; ss_ name; @@ -150,9 +150,9 @@ struct CMultiFileWatch: MultiFileWatch } }; -MultiFileWatch* createMultiFileWatch() +FileWatch* createFileWatch() { - return new CMultiFileWatch(); + return new CFileWatch(); } } diff --git a/src/impl/windows/file_watch.cpp b/src/impl/windows/file_watch.cpp index e81a415..640c5d6 100644 --- a/src/impl/windows/file_watch.cpp +++ b/src/impl/windows/file_watch.cpp @@ -7,20 +7,20 @@ namespace interface { -struct CMultiFileWatch: MultiFileWatch +struct CFileWatch: FileWatch { - CMultiFileWatch() + CFileWatch() { - log_e(MODULE, "CMultiFileWatch not implemented"); + log_e(MODULE, "CFileWatch not implemented"); } - ~CMultiFileWatch() + ~CFileWatch() { } void add(const ss_ &path, std::function cb) { - log_e(MODULE, "CMultiFileWatch::add() not implemented"); + log_e(MODULE, "CFileWatch::add() not implemented"); } // Used on Linux; no-op on Windows @@ -35,13 +35,13 @@ struct CMultiFileWatch: MultiFileWatch // Used on Windows; no-op on Linux void update() { - log_e(MODULE, "CMultiFileWatch::update() not implemented"); + log_e(MODULE, "CFileWatch::update() not implemented"); } }; -MultiFileWatch* createMultiFileWatch() +FileWatch* createFileWatch() { - return new CMultiFileWatch(); + return new CFileWatch(); } } diff --git a/src/interface/file_watch.h b/src/interface/file_watch.h index 8e3d247..40bb8d5 100644 --- a/src/interface/file_watch.h +++ b/src/interface/file_watch.h @@ -6,9 +6,9 @@ namespace interface { - struct MultiFileWatch + struct FileWatch { - virtual ~MultiFileWatch(){} + virtual ~FileWatch(){} virtual void add(const ss_ &path, std::function cb) = 0; @@ -22,6 +22,6 @@ namespace interface }; // cb is called at either report_fd() or update(). - MultiFileWatch* createMultiFileWatch(); + FileWatch* createFileWatch(); } // vim: set noet ts=4 sw=4: diff --git a/src/server/state.cpp b/src/server/state.cpp index 962668b..773975a 100644 --- a/src/server/state.cpp +++ b/src/server/state.cpp @@ -219,7 +219,7 @@ struct CState: public State, public interface::Server sm_ m_module_info; // Info of every seen module sm_ m_modules; // Currently loaded modules set_ m_unloads_requested; - sm_> m_module_file_watches; + sm_> m_module_file_watches; // Module modifications are accumulated here and core:module_modified events // are fired every event loop based on this to lump multiple modifications // into one (generally a modification causes many notifications) @@ -377,7 +377,7 @@ struct CState: public State, public interface::Server files_to_watch.insert(files_to_watch.end(), includes.begin(), includes.end()); if(m_module_file_watches.count(info.name) == 0){ - sp_ w(interface::createMultiFileWatch()); + sp_ w(interface::createFileWatch()); for(const ss_ &watch_path : files_to_watch){ ss_ dir_path = interface::Filesystem::strip_file_name(watch_path); w->add(dir_path, [this, info, watch_path](const ss_ &modified_path){