backend: rename bookmark_check args

- Rename `id` -> `parent_id`, since the function works on
  the parent directory.
This commit is contained in:
CismonX 2025-02-13 17:48:07 +08:00
parent 52b3707d2b
commit 9afdfc45d7
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
3 changed files with 11 additions and 9 deletions

View file

@ -128,7 +128,7 @@ typedef int (bookmarkfs_bookmark_check_cb) (
typedef int (bookmarkfs_bookmark_check_func) (
void *backend_ctx,
uint64_t id,
uint64_t parent_id,
struct bookmarkfs_fsck_data const *fsck_data,
uint32_t flags,
bookmarkfs_bookmark_check_cb *callback,

View file

@ -1857,7 +1857,7 @@ backend_sandbox (
static int
bookmark_check (
void *backend_ctx,
uint64_t id,
uint64_t parent_id,
struct bookmarkfs_fsck_data const *fsck_data,
uint32_t UNUSED_VAR(flags),
bookmarkfs_bookmark_check_cb *callback,
@ -1883,7 +1883,8 @@ bookmark_check (
}
}
// Unlike bookmark_list(), always fetch the latest entries during fsck.
struct node_entry const *entry = lookup_id(ctx->id_map, id, NULL, NULL);
struct node_entry const *entry
= lookup_id(ctx->id_map, parent_id, NULL, NULL);
if (unlikely(entry == NULL || entry->name == NULL)) {
return -ESTALE;
}
@ -1898,11 +1899,12 @@ bookmark_check (
goto end;
}
if (fsck_data == NULL) {
status = fsck_next(ctx, id, children, &idx, callback, user_data);
status = fsck_next(ctx, parent_id, children, &idx, callback,
user_data);
} else {
debug_assert(!(ctx->flags & BOOKMARKFS_BACKEND_READONLY));
#ifdef BOOKMARKFS_BACKEND_CHROMIUM_WRITE
status = fsck_apply(ctx, id, fsck_data, callback, user_data);
status = fsck_apply(ctx, parent_id, fsck_data, callback, user_data);
#endif
}

View file

@ -2999,7 +2999,7 @@ backend_sandbox (
static int
bookmark_check (
void *backend_ctx,
uint64_t id,
uint64_t parent_id,
struct bookmarkfs_fsck_data const *fsck_data,
uint32_t flags,
bookmarkfs_bookmark_check_cb *callback,
@ -3013,7 +3013,7 @@ bookmark_check (
}
switch (flags & BOOKMARKFS_BOOKMARK_TYPE_MASK) {
case BOOKMARKFS_BOOKMARK_TYPE(TAG):
if (id == ctx->tags_root_id) {
if (parent_id == ctx->tags_root_id) {
break;
}
// fallthrough
@ -3050,11 +3050,11 @@ bookmark_check (
qctx.user_data = user_data;
if (fsck_data == NULL) {
qctx.status = 0;
status = bookmark_do_list(ctx, id, idx, flags, &qctx);
status = bookmark_do_list(ctx, parent_id, idx, flags, &qctx);
} else {
debug_assert(!(ctx->flags & BOOKMARKFS_BACKEND_READONLY));
#ifdef BOOKMARKFS_BACKEND_FIREFOX_WRITE
status = fsck_apply(ctx, id, fsck_data, &qctx);
status = fsck_apply(ctx, parent_id, fsck_data, &qctx);
#endif
}
dentry_map = qctx.dentry_map;