Re: [GSoC][PATCH v12 02/10] fsck: add a unified interface for reporting fsck messages
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Jul 23, 2024, 08:35 UTC
- Message-ID
- <CAOLa=ZQKvEEKYHj5WACjfAT4DUb3=p2g=WaWHr2zG0FE1UJO_A@mail.gmail.com>
- In-Reply-To
- <ZpuDCc8SZx8e4mLP@ArchLinux>
shejialuo <shejialuo@gmail.com> writes:
[snip]
Show 31 quoted lines
> diff --git a/fsck.h b/fsck.h
> index bcfb2e34cd..a2ecb39b51 100644
> --- a/fsck.h
> +++ b/fsck.h
> @@ -114,7 +114,9 @@ int is_valid_msg_type(const char *msg_id, const char *msg_type);
> typedef int (*fsck_walk_func)(struct object *obj, enum object_type object_type,
> void *data, struct fsck_options *options);
>
> -/* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
> +/*
> + * callback function for reporting errors when checking either objects or refs
> + */
> typedef int (*fsck_error)(struct fsck_options *o,
> const struct object_id *oid, enum object_type object_type,
> enum fsck_msg_type msg_type, enum fsck_msg_id msg_id,
> @@ -131,11 +133,24 @@ int fsck_error_cb_print_missing_gitmodules(struct fsck_options *o,
> enum fsck_msg_id msg_id,
> const char *message);
>
> +/*
> + * The information for reporting refs-related error message
> + */
> +struct fsck_refs_info {
> + char *ref_checkee;
> + union {
> + struct {
> + char *sub_ref_checkee;
> + } files;
> + } u;
> +};
> +When I suggested using a struct, it was to replace sending both 'ref_checkee' and 'sub_ref_checkee' to the error functions. I.e to send a single struct instead of two different fields. But now, we've included it in the 'fsck_options' struct, I don't think it should be part of the options. Because the fsck_options is used beyond the error function while 'fsck_refs_info' is only needed in the error functions, right?