diff --git a/doc/bookmarkfs.texi b/doc/bookmarkfs.texi index 084caa1..b4932f1 100644 --- a/doc/bookmarkfs.texi +++ b/doc/bookmarkfs.texi @@ -1404,11 +1404,10 @@ struct bookmarkfs_backend @{ bookmarkfs_backend_init_func *backend_init; bookmarkfs_backend_mkfs_func *backend_mkfs; bookmarkfs_backend_sandbox_func *backend_sandbox; - bookmarkfs_backend_sync_func *backend_sync; - bookmarkfs_bookmark_get_func *bookmark_get; - bookmarkfs_bookmark_list_func *bookmark_list; - bookmarkfs_bookmark_lookup_func *bookmark_lookup; + bookmarkfs_bookmark_get_func *bookmark_get; + bookmarkfs_bookmark_list_func *bookmark_list; + bookmarkfs_bookmark_lookup_func *bookmark_lookup; bookmarkfs_bookmark_create_func *bookmark_create; bookmarkfs_bookmark_delete_func *bookmark_delete; @@ -1416,6 +1415,7 @@ struct bookmarkfs_backend @{ bookmarkfs_bookmark_permute_func *bookmark_permute; bookmarkfs_bookmark_rename_func *bookmark_rename; bookmarkfs_bookmark_set_func *bookmark_set; + bookmarkfs_bookmark_sync_func *bookmark_sync; bookmarkfs_object_free_func *object_free; @}; @@ -1581,8 +1581,8 @@ Indicates that the @option{-o no_landlock} option is given to Indicates that the backend is launched from @command{fsck.bookmarkfs}. The backend must claim exclusive access to the bookmark storage, and only -the @code{bookmark_lookup}, @code{bookmark_list} and @code{bookmark_fsck} -functions will be called on the bookmarks. +the @code{bookmark_lookup}, @code{bookmark_list}, @code{bookmark_fsck} +and @code{bookmark_sync} functions will be called on the bookmarks. @end table @item store_path diff --git a/src/backend.h b/src/backend.h index d2206c5..dec863a 100644 --- a/src/backend.h +++ b/src/backend.h @@ -120,10 +120,6 @@ typedef int (bookmarkfs_backend_sandbox_func) ( struct bookmarkfs_backend_create_resp *resp ); -typedef int (bookmarkfs_backend_sync_func) ( - void *backend_ctx -); - typedef int (bookmarkfs_bookmark_create_func) ( void *backend_ctx, uint64_t parent_id, @@ -222,6 +218,10 @@ typedef int (bookmarkfs_bookmark_set_func) ( size_t val_len ); +typedef int (bookmarkfs_bookmark_sync_func) ( + void *backend_ctx +); + typedef void (bookmarkfs_object_free_func) ( void *backend_ctx, void *object, @@ -235,11 +235,10 @@ struct bookmarkfs_backend { bookmarkfs_backend_init_func *backend_init; bookmarkfs_backend_mkfs_func *backend_mkfs; bookmarkfs_backend_sandbox_func *backend_sandbox; - bookmarkfs_backend_sync_func *backend_sync; - bookmarkfs_bookmark_get_func *bookmark_get; - bookmarkfs_bookmark_list_func *bookmark_list; - bookmarkfs_bookmark_lookup_func *bookmark_lookup; + bookmarkfs_bookmark_get_func *bookmark_get; + bookmarkfs_bookmark_list_func *bookmark_list; + bookmarkfs_bookmark_lookup_func *bookmark_lookup; bookmarkfs_bookmark_create_func *bookmark_create; bookmarkfs_bookmark_delete_func *bookmark_delete; @@ -247,6 +246,7 @@ struct bookmarkfs_backend { bookmarkfs_bookmark_permute_func *bookmark_permute; bookmarkfs_bookmark_rename_func *bookmark_rename; bookmarkfs_bookmark_set_func *bookmark_set; + bookmarkfs_bookmark_sync_func *bookmark_sync; bookmarkfs_object_free_func *object_free; }; diff --git a/src/backend_chromium.c b/src/backend_chromium.c index e083458..b79ca80 100644 --- a/src/backend_chromium.c +++ b/src/backend_chromium.c @@ -2183,16 +2183,6 @@ backend_mkfs ( return status; } -static int -backend_sync ( - void *backend_ctx -) { - struct backend_ctx *ctx = backend_ctx; - debug_assert(!(ctx->flags & BOOKMARKFS_BACKEND_READONLY)); - - return store_save(ctx); -} - static int bookmark_create ( void *backend_ctx, @@ -2698,6 +2688,16 @@ bookmark_set ( return 0; } +static int +bookmark_sync ( + void *backend_ctx +) { + struct backend_ctx *ctx = backend_ctx; + debug_assert(!(ctx->flags & BOOKMARKFS_BACKEND_READONLY)); + + return store_save(ctx); +} + #endif /* defined(BOOKMARKFS_BACKEND_CHROMIUM_WRITE) */ BOOKMARKFS_API @@ -2717,12 +2717,12 @@ struct bookmarkfs_backend const bookmarkfs_backend_chromium = { #ifdef BOOKMARKFS_BACKEND_CHROMIUM_WRITE .backend_mkfs = backend_mkfs, - .backend_sync = backend_sync, .bookmark_create = bookmark_create, .bookmark_delete = bookmark_delete, .bookmark_permute = bookmark_permute, .bookmark_rename = bookmark_rename, .bookmark_set = bookmark_set, + .bookmark_sync = bookmark_sync, #endif /* defined(BOOKMARKFS_BACKEND_CHROMIUM_WRITE) */ }; diff --git a/src/backend_firefox.c b/src/backend_firefox.c index 3d105cf..9c6a596 100644 --- a/src/backend_firefox.c +++ b/src/backend_firefox.c @@ -3181,16 +3181,6 @@ backend_mkfs ( return status; } -static int -backend_sync ( - void *backend_ctx -) { - struct backend_ctx *ctx = backend_ctx; - debug_assert(!(ctx->flags & BOOKMARKFS_BACKEND_READONLY)); - - return store_sync(ctx->db); -} - static int bookmark_create ( void *backend_ctx, @@ -3598,6 +3588,16 @@ bookmark_set ( return txn_rollback(ctx, status); } +static int +bookmark_sync ( + void *backend_ctx +) { + struct backend_ctx *ctx = backend_ctx; + debug_assert(!(ctx->flags & BOOKMARKFS_BACKEND_READONLY)); + + return store_sync(ctx->db); +} + #endif /* defined(BOOKMARKFS_BACKEND_FIREFOX_WRITE) */ BOOKMARKFS_API @@ -3617,12 +3617,12 @@ struct bookmarkfs_backend const bookmarkfs_backend_firefox = { #ifdef BOOKMARKFS_BACKEND_FIREFOX_WRITE .backend_mkfs = backend_mkfs, - .backend_sync = backend_sync, .bookmark_create = bookmark_create, .bookmark_delete = bookmark_delete, .bookmark_permute = bookmark_permute, .bookmark_rename = bookmark_rename, .bookmark_set = bookmark_set, + .bookmark_sync = bookmark_sync, #endif /* defined(BOOKMARKFS_BACKEND_FIREFOX_WRITE) */ }; diff --git a/src/fs_ops.c b/src/fs_ops.c index b31796e..cc0e44e 100644 --- a/src/fs_ops.c +++ b/src/fs_ops.c @@ -1818,7 +1818,7 @@ fs_op_fsync ( goto end; } - status = ctx.backend_impl->backend_sync(ctx.backend_ctx); + status = ctx.backend_impl->bookmark_sync(ctx.backend_ctx); end: send_reply(err, req, -status); @@ -1851,7 +1851,7 @@ fs_op_fsyncdir ( goto end; } - status = ctx.backend_impl->backend_sync(ctx.backend_ctx); + status = ctx.backend_impl->bookmark_sync(ctx.backend_ctx); end: send_reply(err, req, -status); diff --git a/src/fsck_offline.c b/src/fsck_offline.c index 4e6a657..e1e9735 100644 --- a/src/fsck_offline.c +++ b/src/fsck_offline.c @@ -266,7 +266,7 @@ fsck_control ( if (ctx->flags & BOOKMARKFS_BACKEND_READONLY) { break; } - return ctx->backend->backend_sync(ctx->backend_ctx); + return ctx->backend->bookmark_sync(ctx->backend_ctx); default: unreachable();