mirror of
https://git.sr.ht/~cismonx/bookmarkfs
synced 2025-07-23 09:38:53 +00:00
all: minor refactor
This commit is contained in:
parent
7816e955b7
commit
55c0726c7f
3 changed files with 14 additions and 15 deletions
12
src/fs_ops.c
12
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 )
|
||||
|
@ -79,8 +79,8 @@
|
|||
{ \
|
||||
.generation = 1, \
|
||||
.attr = STRUCT_STAT_INIT, \
|
||||
.attr_timeout = FS_ENTRY_TIMEOUT_SECS, \
|
||||
.entry_timeout = FS_ENTRY_TIMEOUT_SECS, \
|
||||
.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
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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_) */
|
||||
|
|
Loading…
Add table
Reference in a new issue