]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/home/homework-luks.h
homework: make PasswordCache const wherever we can
[thirdparty/systemd.git] / src / home / homework-luks.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
70a5db58
LP
2#pragma once
3
1e2f3230 4#include "cryptsetup-util.h"
70a5db58
LP
5#include "homework.h"
6#include "user-record.h"
7
e1df968b 8int home_setup_luks(UserRecord *h, HomeSetupFlags flags, const char *force_image_path, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_luks_home);
70a5db58 9
7b78db28 10int home_activate_luks(UserRecord *h, PasswordCache *cache, UserRecord **ret_home);
70a5db58 11int home_deactivate_luks(UserRecord *h);
28a7f106 12int home_trim_luks(UserRecord *h);
70a5db58
LP
13
14int home_store_header_identity_luks(UserRecord *h, HomeSetup *setup, UserRecord *old_home);
15
37a1bf7f 16int home_create_luks(UserRecord *h, const PasswordCache *cache, char **effective_passwords, UserRecord **ret_home);
70a5db58 17
e1ab6635 18int home_get_state_luks(UserRecord *h, HomeSetup *setup);
70a5db58 19
e1df968b 20int home_resize_luks(UserRecord *h, HomeSetupFlags flags, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_home);
70a5db58 21
37a1bf7f 22int home_passwd_luks(UserRecord *h, HomeSetup *setup, const PasswordCache *cache, char **effective_passwords);
70a5db58
LP
23
24int home_lock_luks(UserRecord *h);
37a1bf7f 25int home_unlock_luks(UserRecord *h, const PasswordCache *cache);
70a5db58
LP
26
27static inline uint64_t luks_volume_key_size_convert(struct crypt_device *cd) {
28 int k;
29
30 assert(cd);
31
32 /* Convert the "int" to uint64_t, which we usually use for byte sizes stored on disk. */
33
71eceff6 34 k = sym_crypt_get_volume_key_size(cd);
70a5db58
LP
35 if (k <= 0)
36 return UINT64_MAX;
37
38 return (uint64_t) k;
39}
28a7f106
LP
40
41int run_fitrim(int root_fd);
42int run_fitrim_by_path(const char *root_path);
43int run_fallocate(int backing_fd, const struct stat *st);
44int run_fallocate_by_path(const char *backing_path);
565ac8b1
LP
45int run_mark_dirty(int fd, bool b);
46int run_mark_dirty_by_path(const char *path, bool b);