1 /* SPDX-License-Identifier: LGPL-2.1+ */
10 #include "user-record.h"
11 #include "user-record-util.h"
13 typedef struct HomeSetup
{
18 struct crypt_device
*crypt_device
;
21 sd_id128_t found_partition_uuid
;
22 sd_id128_t found_luks_uuid
;
23 sd_id128_t found_fs_uuid
;
25 uint8_t fscrypt_key_descriptor
[FS_KEY_DESCRIPTOR_SIZE
];
28 size_t volume_key_size
;
32 bool do_offline_fitrim
;
33 bool do_offline_fallocate
;
35 uint64_t partition_offset
;
36 uint64_t partition_size
;
39 #define HOME_SETUP_INIT \
43 .partition_offset = UINT64_MAX, \
44 .partition_size = UINT64_MAX, \
47 int home_setup_undo(HomeSetup
*setup
);
49 int home_prepare(UserRecord
*h
, bool already_activated
, char ***pkcs11_decrypted_passwords
, HomeSetup
*setup
, UserRecord
**ret_header_home
);
51 int home_refresh(UserRecord
*h
, HomeSetup
*setup
, UserRecord
*header_home
, char ***pkcs11_decrypted_passwords
, struct statfs
*ret_statfs
, UserRecord
**ret_new_home
);
53 int home_populate(UserRecord
*h
, int dir_fd
);
55 int home_load_embedded_identity(UserRecord
*h
, int root_fd
, UserRecord
*header_home
, UserReconcileMode mode
, char ***pkcs11_decrypted_passwords
, UserRecord
**ret_embedded_home
, UserRecord
**ret_new_home
);
56 int home_store_embedded_identity(UserRecord
*h
, int root_fd
, uid_t uid
, UserRecord
*old_home
);
57 int home_extend_embedded_identity(UserRecord
*h
, UserRecord
*used
, HomeSetup
*setup
);
59 int user_record_authenticate(UserRecord
*h
, UserRecord
*secret
, char ***pkcs11_decrypted_passwords
, bool strict_verify
);
61 int home_sync_and_statfs(int root_fd
, struct statfs
*ret
);