1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
6 #include "architecture.h"
8 typedef enum PickFlags
{
9 PICK_ARCHITECTURE
= 1 << 0, /* Look for an architecture suffix */
10 PICK_TRIES
= 1 << 1, /* Look for tries left/tries done counters */
11 PICK_RESOLVE
= 1 << 2, /* Return the fully resolved (chased) path, rather than the path to the entry */
14 typedef struct PickFilter
{
15 uint32_t type_mask
; /* A mask of 1U << DT_REG, 1U << DT_DIR, … */
16 const char *basename
; /* Can be overridden by search pattern */
18 Architecture architecture
;
19 const char *suffix
; /* Can be overridden by search pattern */
22 typedef struct PickResult
{
27 Architecture architecture
;
32 #define PICK_RESULT_NULL \
33 (const PickResult) { \
35 .st.st_mode = MODE_INVALID, \
36 .architecture = _ARCHITECTURE_INVALID, \
37 .tries_left = UINT_MAX, \
38 .tries_done = UINT_MAX, \
41 #define TAKE_PICK_RESULT(pick) TAKE_GENERIC(pick, PickResult, PICK_RESULT_NULL)
43 void pick_result_done(PickResult
*p
);
45 int path_pick(const char *toplevel_path
,
48 const PickFilter
*filter
,
52 int path_pick_update_warn(
54 const PickFilter
*filter
,
58 extern const PickFilter pick_filter_image_raw
;
59 extern const PickFilter pick_filter_image_dir
;