diff --git a/src/fs_ops.c b/src/fs_ops.c index cb0c437..0f0d1b9 100644 --- a/src/fs_ops.c +++ b/src/fs_ops.c @@ -53,8 +53,8 @@ // Chromium saves its bookmarks (`bookmarks::BookmarkStorage::kSaveDelay`). // // See Chromium source code: /components/bookmarks/browser/bookmark_storage.h -#define FS_ENTRY_TIMEOUT_MAX INT32_MAX -#define FS_ENTRY_TIMEOUT_SECS ( ctx.flags.exclusive ? INT32_MAX : 2.5 ) +#define FS_ENTRY_TIMEOUT_MAX 3600. +#define FS_ENTRY_TIMEOUT ( ctx.flags.exclusive ? FS_ENTRY_TIMEOUT_MAX : 2.5 ) #define BOOKMARKS_ROOT_ID ( ctx.bookmarks_root_id ) #define TAGS_ROOT_ID ( ctx.tags_root_id ) @@ -75,12 +75,12 @@ #define INODE_SUBSYS_ID(ino) ( (ino) & SUBSYS_ID_MASK ) #define SUBSYS_NODEID(id, t) ( ((fuse_ino_t)(t) << SUBSYS_ID_BITS) | (id) ) -#define STRUCT_FUSE_ENTRY_PARAM_INIT \ - { \ - .generation = 1, \ - .attr = STRUCT_STAT_INIT, \ - .attr_timeout = FS_ENTRY_TIMEOUT_SECS, \ - .entry_timeout = FS_ENTRY_TIMEOUT_SECS, \ +#define STRUCT_FUSE_ENTRY_PARAM_INIT \ + { \ + .generation = 1, \ + .attr = STRUCT_STAT_INIT, \ + .attr_timeout = FS_ENTRY_TIMEOUT, \ + .entry_timeout = FS_ENTRY_TIMEOUT, \ } #define STRUCT_STAT_INIT \ { .st_nlink = 1, .st_uid = ctx.uid, .st_gid = ctx.gid } @@ -1890,7 +1890,7 @@ fs_op_getattr ( return; } - send_reply(attr, req, &stat_buf, FS_ENTRY_TIMEOUT_SECS); + send_reply(attr, req, &stat_buf, FS_ENTRY_TIMEOUT); } void @@ -2344,7 +2344,7 @@ fs_op_setattr ( send_reply(err, req, -status); } - send_reply(attr, req, stat_buf, FS_ENTRY_TIMEOUT_SECS); + send_reply(attr, req, stat_buf, FS_ENTRY_TIMEOUT); } void diff --git a/src/watcher.c b/src/watcher.c index ecd5f99..66d366c 100644 --- a/src/watcher.c +++ b/src/watcher.c @@ -288,7 +288,7 @@ impl_watch ( } end: - debug_printf("file %s changed", w->name); + debug_printf("%s: file changed", w->name); return 0; } @@ -339,6 +339,8 @@ watcher_create ( .name = name, .pipefd[1] = -1, .flags = flags, + .mutex = PTHREAD_MUTEX_INITIALIZER, + .cond = PTHREAD_COND_INITIALIZER, }; if (flags & WATCHER_NOOP) { return w; @@ -353,8 +355,6 @@ watcher_create ( if (unlikely(0 != impl_init(w))) { goto close_pipes; } - pthread_mutex_init(&w->mutex, NULL); - pthread_cond_init(&w->cond, NULL); int status = pthread_create(&w->worker, NULL, worker_loop, w); if (unlikely(status != 0)) { diff --git a/src/watcher.h b/src/watcher.h index aa0ee4a..910e644 100644 --- a/src/watcher.h +++ b/src/watcher.h @@ -31,7 +31,7 @@ // // The list should be kept short, since anything added there may // introduce extra syscall filtering overhead. -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) # define WATCHER_CAN_CREATE_IN_SANDBOX #endif @@ -94,5 +94,4 @@ watcher_poll ( struct watcher *w ); - #endif /* !defined(BOOKMARKFS_WATCHER_H_) */