backend: rename bookmark_fsck -> bookmark_check

Some relevant names are also renamed.
This commit is contained in:
CismonX 2025-02-12 20:47:10 +08:00
parent 3375674973
commit 52b3707d2b
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
6 changed files with 146 additions and 146 deletions

View file

@ -1490,13 +1490,13 @@ struct bookmarkfs_backend @{
bookmarkfs_backend_mkfs_func *backend_mkfs; bookmarkfs_backend_mkfs_func *backend_mkfs;
bookmarkfs_backend_sandbox_func *backend_sandbox; bookmarkfs_backend_sandbox_func *backend_sandbox;
bookmarkfs_bookmark_check_func *bookmark_check;
bookmarkfs_bookmark_get_func *bookmark_get; bookmarkfs_bookmark_get_func *bookmark_get;
bookmarkfs_bookmark_list_func *bookmark_list; bookmarkfs_bookmark_list_func *bookmark_list;
bookmarkfs_bookmark_lookup_func *bookmark_lookup; bookmarkfs_bookmark_lookup_func *bookmark_lookup;
bookmarkfs_bookmark_create_func *bookmark_create; bookmarkfs_bookmark_create_func *bookmark_create;
bookmarkfs_bookmark_delete_func *bookmark_delete; bookmarkfs_bookmark_delete_func *bookmark_delete;
bookmarkfs_bookmark_fsck_func *bookmark_fsck;
bookmarkfs_bookmark_permute_func *bookmark_permute; bookmarkfs_bookmark_permute_func *bookmark_permute;
bookmarkfs_bookmark_rename_func *bookmark_rename; bookmarkfs_bookmark_rename_func *bookmark_rename;
bookmarkfs_bookmark_set_func *bookmark_set; bookmarkfs_bookmark_set_func *bookmark_set;
@ -1679,7 +1679,7 @@ Indicates that the @option{-o no_landlock} option is given to
Indicates that the backend is launched from @command{fsck.bookmarkfs}. Indicates that the backend is launched from @command{fsck.bookmarkfs}.
The backend must claim exclusive access to the bookmark storage, and only The backend must claim exclusive access to the bookmark storage, and only
the @code{bookmark_lookup}, @code{bookmark_list}, @code{bookmark_fsck} the @code{bookmark_lookup}, @code{bookmark_list}, @code{bookmark_check}
and @code{bookmark_sync} functions will be called on the bookmarks. and @code{bookmark_sync} functions will be called on the bookmarks.
@end table @end table
@ -2332,7 +2332,7 @@ False negatives are also acceptable for a short time duration
@subsection Free Cookie @subsection Free Cookie
When a cookie obtained from @code{bookmark_list}, When a cookie obtained from @code{bookmark_list},
@code{bookmark_get} or @code{bookmark_fsck} is no longer used, @code{bookmark_get} or @code{bookmark_check} is no longer used,
the @code{cookie_free} function is called. the @code{cookie_free} function is called.
It must not be @code{NULL}. It must not be @code{NULL}.
@ -2367,7 +2367,7 @@ Indicates that the cookie is obtained from @code{bookmark_get}.
@item BOOKMARKFS_COOKIE_TYPE_LIST @item BOOKMARKFS_COOKIE_TYPE_LIST
Indicates that the cookie is obtained from @code{bookmark_list} or Indicates that the cookie is obtained from @code{bookmark_list} or
@code{bookmark_fsck}. @code{bookmark_check}.
@end table @end table
@end table @end table

View file

@ -118,6 +118,24 @@ typedef int (bookmarkfs_backend_sandbox_func) (
struct bookmarkfs_backend_create_resp *resp struct bookmarkfs_backend_create_resp *resp
); );
typedef int (bookmarkfs_bookmark_check_cb) (
void *user_data,
int result,
uint64_t id,
uint64_t extra,
char const *name
);
typedef int (bookmarkfs_bookmark_check_func) (
void *backend_ctx,
uint64_t id,
struct bookmarkfs_fsck_data const *fsck_data,
uint32_t flags,
bookmarkfs_bookmark_check_cb *callback,
void *user_data,
void **cookie_ptr
);
typedef int (bookmarkfs_bookmark_create_func) ( typedef int (bookmarkfs_bookmark_create_func) (
void *backend_ctx, void *backend_ctx,
uint64_t parent_id, uint64_t parent_id,
@ -133,24 +151,6 @@ typedef int (bookmarkfs_bookmark_delete_func) (
uint32_t flags uint32_t flags
); );
typedef int (bookmarkfs_bookmark_fsck_cb) (
void *user_data,
int result,
uint64_t id,
uint64_t extra,
char const *name
);
typedef int (bookmarkfs_bookmark_fsck_func) (
void *backend_ctx,
uint64_t id,
struct bookmarkfs_fsck_data const *fsck_data,
uint32_t flags,
bookmarkfs_bookmark_fsck_cb *callback,
void *user_data,
void **cookie_ptr
);
typedef int (bookmarkfs_bookmark_get_cb) ( typedef int (bookmarkfs_bookmark_get_cb) (
void *user_data, void *user_data,
void const *value, void const *value,
@ -234,13 +234,13 @@ struct bookmarkfs_backend {
bookmarkfs_backend_mkfs_func *backend_mkfs; bookmarkfs_backend_mkfs_func *backend_mkfs;
bookmarkfs_backend_sandbox_func *backend_sandbox; bookmarkfs_backend_sandbox_func *backend_sandbox;
bookmarkfs_bookmark_check_func *bookmark_check;
bookmarkfs_bookmark_get_func *bookmark_get; bookmarkfs_bookmark_get_func *bookmark_get;
bookmarkfs_bookmark_list_func *bookmark_list; bookmarkfs_bookmark_list_func *bookmark_list;
bookmarkfs_bookmark_lookup_func *bookmark_lookup; bookmarkfs_bookmark_lookup_func *bookmark_lookup;
bookmarkfs_bookmark_create_func *bookmark_create; bookmarkfs_bookmark_create_func *bookmark_create;
bookmarkfs_bookmark_delete_func *bookmark_delete; bookmarkfs_bookmark_delete_func *bookmark_delete;
bookmarkfs_bookmark_fsck_func *bookmark_fsck;
bookmarkfs_bookmark_permute_func *bookmark_permute; bookmarkfs_bookmark_permute_func *bookmark_permute;
bookmarkfs_bookmark_rename_func *bookmark_rename; bookmarkfs_bookmark_rename_func *bookmark_rename;
bookmarkfs_bookmark_set_func *bookmark_set; bookmarkfs_bookmark_set_func *bookmark_set;

View file

@ -203,7 +203,7 @@ static int chksum_root (struct backend_ctx *, char *);
static int chksum_utf16 (struct chksum_iter_ctx *, char const *, size_t); static int chksum_utf16 (struct chksum_iter_ctx *, char const *, size_t);
static int fsck_apply (struct backend_ctx *, uint64_t, static int fsck_apply (struct backend_ctx *, uint64_t,
struct bookmarkfs_fsck_data const *, struct bookmarkfs_fsck_data const *,
bookmarkfs_bookmark_fsck_cb *, void *); bookmarkfs_bookmark_check_cb *, void *);
static int init_iconv (iconv_t *); static int init_iconv (iconv_t *);
static int node_mtime_now (json_t *, json_t **); static int node_mtime_now (json_t *, json_t **);
static int parse_mkfsopts (struct bookmarkfs_conf_opt const *, static int parse_mkfsopts (struct bookmarkfs_conf_opt const *,
@ -227,7 +227,7 @@ static void free_entry_cb (void *, void *);
static void free_maps (struct hashmap *, struct hashmap *, static void free_maps (struct hashmap *, struct hashmap *,
struct hashmap *); struct hashmap *);
static int fsck_next (struct backend_ctx const *, uint64_t, json_t *, static int fsck_next (struct backend_ctx const *, uint64_t, json_t *,
size_t *, bookmarkfs_bookmark_fsck_cb *, void *); size_t *, bookmarkfs_bookmark_check_cb *, void *);
static int get_attr_type (char const *, uint32_t); static int get_attr_type (char const *, uint32_t);
static int get_attr_val (json_t const *, char const *, uint32_t, json_t **); static int get_attr_val (json_t const *, char const *, uint32_t, json_t **);
static int guidmap_comp (union hashmap_key, void const *); static int guidmap_comp (union hashmap_key, void const *);
@ -479,7 +479,7 @@ fsck_apply (
struct backend_ctx *ctx, struct backend_ctx *ctx,
uint64_t parent_id, uint64_t parent_id,
struct bookmarkfs_fsck_data const *fsck_data, struct bookmarkfs_fsck_data const *fsck_data,
bookmarkfs_bookmark_fsck_cb *callback, bookmarkfs_bookmark_check_cb *callback,
void *user_data void *user_data
) { ) {
uint64_t id = fsck_data->id; uint64_t id = fsck_data->id;
@ -901,12 +901,12 @@ free_maps (
static int static int
fsck_next ( fsck_next (
struct backend_ctx const *ctx, struct backend_ctx const *ctx,
uint64_t parent_id, uint64_t parent_id,
json_t *children, json_t *children,
size_t *idx_ptr, size_t *idx_ptr,
bookmarkfs_bookmark_fsck_cb *callback, bookmarkfs_bookmark_check_cb *callback,
void *user_data void *user_data
) { ) {
int status = 0; int status = 0;
size_t idx = *idx_ptr; size_t idx = *idx_ptr;
@ -1855,12 +1855,12 @@ backend_sandbox (
} }
static int static int
bookmark_fsck ( bookmark_check (
void *backend_ctx, void *backend_ctx,
uint64_t id, uint64_t id,
struct bookmarkfs_fsck_data const *fsck_data, struct bookmarkfs_fsck_data const *fsck_data,
uint32_t UNUSED_VAR(flags), uint32_t UNUSED_VAR(flags),
bookmarkfs_bookmark_fsck_cb *callback, bookmarkfs_bookmark_check_cb *callback,
void *user_data, void *user_data,
void **cookie_ptr void **cookie_ptr
) { ) {
@ -2700,7 +2700,7 @@ struct bookmarkfs_backend const bookmarkfs_backend_chromium = {
.backend_init = backend_init, .backend_init = backend_init,
.backend_sandbox = backend_sandbox, .backend_sandbox = backend_sandbox,
.bookmark_fsck = bookmark_fsck, .bookmark_check = bookmark_check,
.bookmark_get = bookmark_get, .bookmark_get = bookmark_get,
.bookmark_list = bookmark_list, .bookmark_list = bookmark_list,
.bookmark_lookup = bookmark_lookup, .bookmark_lookup = bookmark_lookup,

View file

@ -186,8 +186,8 @@ struct bookmark_list_ctx {
struct hashmap *dentry_map; struct hashmap *dentry_map;
db_query_row_func *row_func; db_query_row_func *row_func;
union { union {
bookmarkfs_bookmark_fsck_cb *fsck; bookmarkfs_bookmark_check_cb *check;
bookmarkfs_bookmark_list_cb *list; bookmarkfs_bookmark_list_cb *list;
} callback; } callback;
void *user_data; void *user_data;
bool check_name; bool check_name;
@ -203,7 +203,7 @@ struct bookmark_lookup_ctx {
int status; int status;
}; };
struct mozbm_fsck_get_ctx { struct mozbm_check_ctx {
int64_t id; int64_t id;
struct hashmap *dentry_map; struct hashmap *dentry_map;
@ -277,8 +277,8 @@ static char * gen_random_guid (char *);
static bool is_valid_guid (char const *, size_t); static bool is_valid_guid (char const *, size_t);
static int keyword_create (struct backend_ctx *, char const *, size_t, static int keyword_create (struct backend_ctx *, char const *, size_t,
struct bookmarkfs_bookmark_stat *); struct bookmarkfs_bookmark_stat *);
static int mozbm_check_cb (void *, sqlite3_stmt *);
static int mozbm_delete (struct backend_ctx *, int64_t, bool); static int mozbm_delete (struct backend_ctx *, int64_t, bool);
static int mozbm_fsck_get_cb (void *, sqlite3_stmt *);
static int mozbm_get_title (struct backend_ctx *, int64_t, int64_t, static int mozbm_get_title (struct backend_ctx *, int64_t, int64_t,
db_query_row_func *, void *); db_query_row_func *, void *);
static int mozbm_insert (struct backend_ctx *, struct mozbm *); static int mozbm_insert (struct backend_ctx *, struct mozbm *);
@ -337,7 +337,7 @@ static int bookmark_do_list (struct backend_ctx *, uint64_t, off_t,
static int bookmark_do_lookup (struct backend_ctx *, uint64_t, static int bookmark_do_lookup (struct backend_ctx *, uint64_t,
char const *, size_t, uint32_t, char const *, size_t, uint32_t,
struct bookmarkfs_bookmark_stat *); struct bookmarkfs_bookmark_stat *);
static int bookmark_fsck_cb (void *, sqlite3_stmt *); static int bookmark_check_cb (void *, sqlite3_stmt *);
static int bookmark_get_cb (void *, sqlite3_stmt *); static int bookmark_get_cb (void *, sqlite3_stmt *);
static int bookmark_list_cb (void *, sqlite3_stmt *); static int bookmark_list_cb (void *, sqlite3_stmt *);
static int bookmark_lookup_cb (void *, sqlite3_stmt *); static int bookmark_lookup_cb (void *, sqlite3_stmt *);
@ -471,11 +471,11 @@ fsck_apply (
struct hashmap *map = fctx->dentry_map; struct hashmap *map = fctx->dentry_map;
uint64_t id = fsck_data->id; uint64_t id = fsck_data->id;
struct mozbm_fsck_get_ctx qctx = { struct mozbm_check_ctx qctx = {
.id = id, .id = id,
.dentry_map = map, .dentry_map = map,
}; };
status = mozbm_get_title(ctx, id, parent_id, mozbm_fsck_get_cb, &qctx); status = mozbm_get_title(ctx, id, parent_id, mozbm_check_cb, &qctx);
if (status < 0) { if (status < 0) {
goto fail; goto fail;
} }
@ -537,7 +537,7 @@ fsck_apply (
goto end; goto end;
callback: callback:
status = fctx->callback.fsck(fctx->user_data, result, id, extra, name); status = fctx->callback.check(fctx->user_data, result, id, extra, name);
if (status < 0) { if (status < 0) {
goto fail; goto fail;
} }
@ -623,6 +623,42 @@ keyword_create (
return 0; return 0;
} }
static int
mozbm_check_cb (
void *user_data,
sqlite3_stmt *stmt
) {
struct mozbm_check_ctx *ctx = user_data;
size_t name_len = sqlite3_column_bytes(stmt, 0);
char const *name = (char const *)sqlite3_column_text(stmt, 0);
if (unlikely(name == NULL)) {
name = "";
}
if (0 != validate_filename(name, name_len, NULL)) {
return 1;
}
struct hashmap *map = ctx->dentry_map;
if (map == NULL) {
ctx->status = 1;
return 1;
}
union hashmap_key key = {
.ptr = &(struct bookmark_name_key) {
.val = name,
.len = name_len,
},
};
unsigned long hashcode = hash_digest(name, name_len);
struct bookmark_dentry *dentry = hashmap_search(map, key, hashcode, NULL);
if (dentry == NULL || dentry->id == (uint64_t)ctx->id) {
// fsck_apply() was given an ID not previously returned by fsck_next().
ctx->status = -ENOENT;
}
return 1;
}
static int static int
mozbm_delete ( mozbm_delete (
struct backend_ctx *ctx, struct backend_ctx *ctx,
@ -665,42 +701,6 @@ mozbm_delete (
} }
} }
static int
mozbm_fsck_get_cb (
void *user_data,
sqlite3_stmt *stmt
) {
struct mozbm_fsck_get_ctx *ctx = user_data;
size_t name_len = sqlite3_column_bytes(stmt, 0);
char const *name = (char const *)sqlite3_column_text(stmt, 0);
if (unlikely(name == NULL)) {
name = "";
}
if (0 != validate_filename(name, name_len, NULL)) {
return 1;
}
struct hashmap *map = ctx->dentry_map;
if (map == NULL) {
ctx->status = 1;
return 1;
}
union hashmap_key key = {
.ptr = &(struct bookmark_name_key) {
.val = name,
.len = name_len,
},
};
unsigned long hashcode = hash_digest(name, name_len);
struct bookmark_dentry *dentry = hashmap_search(map, key, hashcode, NULL);
if (dentry == NULL || dentry->id == (uint64_t)ctx->id) {
// fsck_apply() was given an ID not previously returned by fsck_next().
ctx->status = -ENOENT;
}
return 1;
}
static int static int
mozbm_get_title ( mozbm_get_title (
struct backend_ctx *ctx, struct backend_ctx *ctx,
@ -2287,7 +2287,7 @@ bookmark_do_lookup (
} }
static int static int
bookmark_fsck_cb ( bookmark_check_cb (
void *user_data, void *user_data,
sqlite3_stmt *stmt sqlite3_stmt *stmt
) { ) {
@ -2353,7 +2353,7 @@ bookmark_fsck_cb (
result = BOOKMARKFS_FSCK_RESULT_NAME_DUPLICATE; result = BOOKMARKFS_FSCK_RESULT_NAME_DUPLICATE;
found: found:
ctx->status = ctx->callback.fsck(ctx->user_data, result, id, extra, name); ctx->status = ctx->callback.check(ctx->user_data, result, id, extra, name);
return ctx->status; return ctx->status;
fail: fail:
@ -2997,12 +2997,12 @@ backend_sandbox (
} }
static int static int
bookmark_fsck ( bookmark_check (
void *backend_ctx, void *backend_ctx,
uint64_t id, uint64_t id,
struct bookmarkfs_fsck_data const *fsck_data, struct bookmarkfs_fsck_data const *fsck_data,
uint32_t flags, uint32_t flags,
bookmarkfs_bookmark_fsck_cb *callback, bookmarkfs_bookmark_check_cb *callback,
void *user_data, void *user_data,
void **cookie_ptr void **cookie_ptr
) { ) {
@ -3043,11 +3043,11 @@ bookmark_fsck (
} }
struct bookmark_list_ctx qctx; struct bookmark_list_ctx qctx;
qctx.dentry_map = dentry_map; qctx.dentry_map = dentry_map;
qctx.next = idx; qctx.next = idx;
qctx.row_func = bookmark_fsck_cb; qctx.row_func = bookmark_check_cb;
qctx.callback.fsck = callback; qctx.callback.check = callback;
qctx.user_data = user_data; qctx.user_data = user_data;
if (fsck_data == NULL) { if (fsck_data == NULL) {
qctx.status = 0; qctx.status = 0;
status = bookmark_do_list(ctx, id, idx, flags, &qctx); status = bookmark_do_list(ctx, id, idx, flags, &qctx);
@ -3726,7 +3726,7 @@ struct bookmarkfs_backend const bookmarkfs_backend_firefox = {
.backend_init = backend_init, .backend_init = backend_init,
.backend_sandbox = backend_sandbox, .backend_sandbox = backend_sandbox,
.bookmark_fsck = bookmark_fsck, .bookmark_check = bookmark_check,
.bookmark_get = bookmark_get, .bookmark_get = bookmark_get,
.bookmark_list = bookmark_list, .bookmark_list = bookmark_list,
.bookmark_lookup = bookmark_lookup, .bookmark_lookup = bookmark_lookup,

View file

@ -147,7 +147,7 @@ struct fs_ctx {
struct fuse_session *session; struct fuse_session *session;
}; };
struct bm_fsck_ctx { struct bm_check_ctx {
struct bookmarkfs_fsck_data out; struct bookmarkfs_fsck_data out;
int result; int result;
@ -179,6 +179,9 @@ static int inval_dir (fuse_ino_t, struct fs_file_handle *);
static int inval_inode (fuse_ino_t); static int inval_inode (fuse_ino_t);
#endif /* !defined(__FreeBSD__) */ #endif /* !defined(__FreeBSD__) */
static int bm_check (uint64_t, struct bookmarkfs_fsck_data const *,
uint32_t, struct bm_check_ctx *, void *);
static int bm_check_cb (void *, int, uint64_t, uint64_t, char const *);
static int bm_create (uint64_t, char const *, int, struct stat *); static int bm_create (uint64_t, char const *, int, struct stat *);
static int bm_delete (uint64_t, char const *, uint32_t); static int bm_delete (uint64_t, char const *, uint32_t);
static int bm_do_write (uint64_t, struct fs_file_handle *); static int bm_do_write (uint64_t, struct fs_file_handle *);
@ -191,9 +194,6 @@ static void bm_fillstat (struct bookmarkfs_bookmark_stat const *, int, bool,
struct stat *); struct stat *);
static int bm_free (uint64_t, struct fuse_file_info const *); static int bm_free (uint64_t, struct fuse_file_info const *);
static int bm_freedir (uint64_t, fuse_ino_t, void *); static int bm_freedir (uint64_t, fuse_ino_t, void *);
static int bm_fsck (uint64_t, struct bookmarkfs_fsck_data const *,
uint32_t, struct bm_fsck_ctx *, void *);
static int bm_fsck_cb (void *, int, uint64_t, uint64_t, char const *);
static int bm_getxattr (fuse_req_t, uint64_t, char const *, size_t); static int bm_getxattr (fuse_req_t, uint64_t, char const *, size_t);
static int bm_getxattr_cb (void *, void const *, size_t); static int bm_getxattr_cb (void *, void const *, size_t);
static int bm_ioctl (fuse_req_t, uint64_t, fuse_ino_t, unsigned, static int bm_ioctl (fuse_req_t, uint64_t, fuse_ino_t, unsigned,
@ -336,6 +336,52 @@ inval_inode (
#endif /* !defined(__FreeBSD__) */ #endif /* !defined(__FreeBSD__) */
static int
bm_check (
uint64_t parent_id,
struct bookmarkfs_fsck_data const *data,
uint32_t flags,
struct bm_check_ctx *ckctx,
void *cookie
) {
if (ctx.backend_impl->bookmark_check == NULL) {
return -ENOTTY;
}
bookmarkfs_bookmark_check_cb *callback = NULL;
if (ckctx != NULL) {
callback = bm_check_cb;
ckctx->result = BOOKMARKFS_FSCK_RESULT_END;
}
int status = BACKEND_CALL(bookmark_check, parent_id, data, flags, callback,
ckctx, &cookie);
if (status < 0) {
return status;
}
if (ckctx != NULL) {
return ckctx->result;
}
return 0;
}
static int
bm_check_cb (
void *user_data,
int result,
uint64_t id,
uint64_t extra,
char const *name
) {
struct bm_check_ctx *ckctx = user_data;
ckctx->out.id = id;
ckctx->out.extra = extra;
if (name != ckctx->out.name) {
strncpy(ckctx->out.name, name, sizeof(ckctx->out.name));
}
ckctx->result = result;
return 1;
}
static int static int
bm_create ( bm_create (
uint64_t parent_id, uint64_t parent_id,
@ -533,52 +579,6 @@ bm_freedir (
return status; return status;
} }
static int
bm_fsck (
uint64_t parent_id,
struct bookmarkfs_fsck_data const *data,
uint32_t flags,
struct bm_fsck_ctx *fctx,
void *cookie
) {
if (ctx.backend_impl->bookmark_fsck == NULL) {
return -ENOTTY;
}
bookmarkfs_bookmark_fsck_cb *callback = NULL;
if (fctx != NULL) {
callback = bm_fsck_cb;
fctx->result = BOOKMARKFS_FSCK_RESULT_END;
}
int status = BACKEND_CALL(bookmark_fsck, parent_id, data, flags, callback,
fctx, &cookie);
if (status < 0) {
return status;
}
if (fctx != NULL) {
return fctx->result;
}
return 0;
}
static int
bm_fsck_cb (
void *user_data,
int result,
uint64_t id,
uint64_t extra,
char const *name
) {
struct bm_fsck_ctx *fctx = user_data;
fctx->out.id = id;
fctx->out.extra = extra;
if (name != fctx->out.name) {
strncpy(fctx->out.name, name, sizeof(fctx->out.name));
}
fctx->result = result;
return 1;
}
static int static int
bm_getxattr ( bm_getxattr (
fuse_req_t req, fuse_req_t req,
@ -635,7 +635,7 @@ bm_ioctl (
switch (cmd) { switch (cmd) {
case BOOKMARKFS_IOC_FSCK_REWIND: case BOOKMARKFS_IOC_FSCK_REWIND:
result = bm_fsck(id, NULL, flags, NULL, cookie); result = bm_check(id, NULL, flags, NULL, cookie);
if (result == 0) { if (result == 0) {
fh->flags &= ~FH_FLAG_FSCK; fh->flags &= ~FH_FLAG_FSCK;
} }
@ -649,7 +649,7 @@ bm_ioctl (
if ((fh->flags & FH_FLAG_FSCK) && fh->cookie != cookie) { if ((fh->flags & FH_FLAG_FSCK) && fh->cookie != cookie) {
return -EBUSY; return -EBUSY;
} }
result = bm_fsck(id, NULL, flags, obuf, cookie); result = bm_check(id, NULL, flags, obuf, cookie);
if (result < 0) { if (result < 0) {
break; break;
} }
@ -671,7 +671,7 @@ bm_ioctl (
if (!has_access(req, W_OK | X_OK)) { if (!has_access(req, W_OK | X_OK)) {
return -EACCES; return -EACCES;
} }
result = bm_fsck(id, ibuf, flags, obuf, cookie); result = bm_check(id, ibuf, flags, obuf, cookie);
if (result == BOOKMARKFS_FSCK_RESULT_END) { if (result == BOOKMARKFS_FSCK_RESULT_END) {
fh->flags |= FH_FLAG_DIRTY; fh->flags |= FH_FLAG_DIRTY;
obuf_len = 0; obuf_len = 0;
@ -1929,7 +1929,7 @@ fs_op_init (
ctx.buf_len = sysconf(_SC_PAGE_SIZE); ctx.buf_len = sysconf(_SC_PAGE_SIZE);
xassert(ctx.buf_len >= sizeof(union { xassert(ctx.buf_len >= sizeof(union {
struct bm_fsck_ctx fsck_ctx; struct bm_check_ctx check_ctx;
struct bookmarkfs_permd_data permd; struct bookmarkfs_permd_data permd;
})); }));
// The requested buffer size for FUSE_READDIR and FUSE_READDIRPLUS // The requested buffer size for FUSE_READDIR and FUSE_READDIRPLUS

View file

@ -83,7 +83,7 @@ do_fsck (
struct bookmarkfs_fsck_handler_entry *entry_buf struct bookmarkfs_fsck_handler_entry *entry_buf
) { ) {
struct fsck_data data; struct fsck_data data;
bookmarkfs_bookmark_fsck_cb *callback = NULL; bookmarkfs_bookmark_check_cb *callback = NULL;
// `entry_buf == NULL` means rewind // `entry_buf == NULL` means rewind
if (entry_buf != NULL) { if (entry_buf != NULL) {
entry_buf->parent_id = dir->id; entry_buf->parent_id = dir->id;
@ -93,10 +93,10 @@ do_fsck (
data.result = BOOKMARKFS_FSCK_RESULT_END; data.result = BOOKMARKFS_FSCK_RESULT_END;
uint32_t flags = ctx->flags & BOOKMARKFS_BOOKMARK_TYPE_MASK; uint32_t flags = ctx->flags & BOOKMARKFS_BOOKMARK_TYPE_MASK;
int status = BACKEND_CALL(ctx, bookmark_fsck, dir->id, apply_data, int status = BACKEND_CALL(ctx, bookmark_check, dir->id, apply_data,
flags, callback, &data, &dir->cookie); flags, callback, &data, &dir->cookie);
if (status < 0) { if (status < 0) {
log_printf("bookmark_fsck(): %s", xstrerror(-status)); log_printf("bookmark_check(): %s", xstrerror(-status));
return status; return status;
} }
return data.result; return data.result;