2020-11-09 05:23:58 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2019-07-04 18:35:39 +02:00
|
|
|
#pragma once
|
|
|
|
|
2020-08-28 21:26:33 +02:00
|
|
|
#include "cryptsetup-util.h"
|
2019-07-04 18:35:39 +02:00
|
|
|
#include "homework.h"
|
|
|
|
#include "user-record.h"
|
|
|
|
|
2020-04-14 19:18:09 +02:00
|
|
|
int home_prepare_luks(UserRecord *h, bool already_activated, const char *force_image_path, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_luks_home);
|
2019-07-04 18:35:39 +02:00
|
|
|
|
2020-04-14 19:18:09 +02:00
|
|
|
int home_activate_luks(UserRecord *h, PasswordCache *cache, UserRecord **ret_home);
|
2019-07-04 18:35:39 +02:00
|
|
|
int home_deactivate_luks(UserRecord *h);
|
2020-05-05 15:13:20 +02:00
|
|
|
int home_trim_luks(UserRecord *h);
|
2019-07-04 18:35:39 +02:00
|
|
|
|
|
|
|
int home_store_header_identity_luks(UserRecord *h, HomeSetup *setup, UserRecord *old_home);
|
|
|
|
|
2020-04-14 19:18:09 +02:00
|
|
|
int home_create_luks(UserRecord *h, PasswordCache *cache, char **effective_passwords, UserRecord **ret_home);
|
2019-07-04 18:35:39 +02:00
|
|
|
|
|
|
|
int home_validate_update_luks(UserRecord *h, HomeSetup *setup);
|
|
|
|
|
2020-04-14 19:18:09 +02:00
|
|
|
int home_resize_luks(UserRecord *h, bool already_activated, PasswordCache *cache, HomeSetup *setup, UserRecord **ret_home);
|
2019-07-04 18:35:39 +02:00
|
|
|
|
2020-04-14 19:18:09 +02:00
|
|
|
int home_passwd_luks(UserRecord *h, HomeSetup *setup, PasswordCache *cache, char **effective_passwords);
|
2019-07-04 18:35:39 +02:00
|
|
|
|
|
|
|
int home_lock_luks(UserRecord *h);
|
2020-04-14 19:18:09 +02:00
|
|
|
int home_unlock_luks(UserRecord *h, PasswordCache *cache);
|
2019-07-04 18:35:39 +02:00
|
|
|
|
|
|
|
static inline uint64_t luks_volume_key_size_convert(struct crypt_device *cd) {
|
|
|
|
int k;
|
|
|
|
|
|
|
|
assert(cd);
|
|
|
|
|
|
|
|
/* Convert the "int" to uint64_t, which we usually use for byte sizes stored on disk. */
|
|
|
|
|
|
|
|
k = crypt_get_volume_key_size(cd);
|
|
|
|
if (k <= 0)
|
|
|
|
return UINT64_MAX;
|
|
|
|
|
|
|
|
return (uint64_t) k;
|
|
|
|
}
|
2020-05-05 15:13:20 +02:00
|
|
|
|
|
|
|
int run_fitrim(int root_fd);
|
|
|
|
int run_fitrim_by_path(const char *root_path);
|
|
|
|
int run_fallocate(int backing_fd, const struct stat *st);
|
|
|
|
int run_fallocate_by_path(const char *backing_path);
|
2020-08-17 20:37:04 +02:00
|
|
|
int run_mark_dirty(int fd, bool b);
|
|
|
|
int run_mark_dirty_by_path(const char *path, bool b);
|