Debian Codegraph @

src/shared/securebits-util.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <linux/securebits.h>
5
6 #include "shared-forward.h"
7
8 int secure_bits_to_strv(int i, char ***ret);
9 DECLARE_STRING_TABLE_LOOKUP_WITH_FALLBACK(secure_bits, int);
10
11 static inline bool secure_bits_is_valid(int i) {
12 return ((SECURE_ALL_BITS | SECURE_ALL_LOCKS) & i) == i;
13 }
14
15 static inline int secure_bits_to_string_alloc_with_check(int n, char **s) {
16 if (!secure_bits_is_valid(n))
17 return -EINVAL;
18
19 return secure_bits_to_string_alloc(n, s);
20 }