13 void fsck_set_msg_type(struct fsck_options
*options
,
14 const char *msg_id
, const char *msg_type
);
15 void fsck_set_msg_types(struct fsck_options
*options
, const char *values
);
16 int is_valid_msg_type(const char *msg_id
, const char *msg_type
);
19 * callback function for fsck_walk
20 * type is the expected type of the object or OBJ_ANY
21 * the return value is:
23 * <0 error signaled and abort
24 * >0 error signaled and do not abort
26 typedef int (*fsck_walk_func
)(struct object
*obj
, int type
, void *data
, struct fsck_options
*options
);
28 /* callback for fsck_object, type is FSCK_ERROR or FSCK_WARN */
29 typedef int (*fsck_error
)(struct fsck_options
*o
,
30 const struct object_id
*oid
, enum object_type object_type
,
31 int msg_type
, const char *message
);
33 int fsck_error_function(struct fsck_options
*o
,
34 const struct object_id
*oid
, enum object_type object_type
,
35 int msg_type
, const char *message
);
39 fsck_error error_func
;
42 struct oidset skiplist
;
43 kh_oid_map_t
*object_names
;
46 #define FSCK_OPTIONS_DEFAULT { NULL, fsck_error_function, 0, NULL, OIDSET_INIT }
47 #define FSCK_OPTIONS_STRICT { NULL, fsck_error_function, 1, NULL, OIDSET_INIT }
49 /* descend in all linked child objects
50 * the return value is:
51 * -1 error in processing the object
52 * <0 return value of the callback, which lead to an abort
53 * >0 return value of the first signaled error >0 (in the case of no other errors)
56 int fsck_walk(struct object
*obj
, void *data
, struct fsck_options
*options
);
59 * Blob objects my pass a NULL data pointer, which indicates they are too large
60 * to fit in memory. All other types must pass a real buffer.
62 int fsck_object(struct object
*obj
, void *data
, unsigned long size
,
63 struct fsck_options
*options
);
66 * Some fsck checks are context-dependent, and may end up queued; run this
67 * after completing all fsck_object() calls in order to resolve any remaining
70 int fsck_finish(struct fsck_options
*options
);
73 * Subsystem for storing human-readable names for each object.
75 * If fsck_enable_object_names() has not been called, all other functions are
78 * Use fsck_put_object_name() to seed initial names (e.g. from refnames); the
79 * fsck code will extend that while walking trees, etc.
81 * Use fsck_get_object_name() to get a single name (or NULL if none). Or the
82 * more convenient describe_object(), which always produces an output string
83 * with the oid combined with the name (if any). Note that the return value
84 * points to a rotating array of static buffers, and may be invalidated by a
87 void fsck_enable_object_names(struct fsck_options
*options
);
88 const char *fsck_get_object_name(struct fsck_options
*options
,
89 const struct object_id
*oid
);
90 __attribute__((format (printf
,3,4)))
91 void fsck_put_object_name(struct fsck_options
*options
,
92 const struct object_id
*oid
,
93 const char *fmt
, ...);
94 const char *fsck_describe_object(struct fsck_options
*options
,
95 const struct object_id
*oid
);