Lines Matching refs:setup
288 int home_setup_undo_mount(HomeSetup *setup, int level) { in home_setup_undo_mount() argument
291 assert(setup); in home_setup_undo_mount()
293 if (!setup->undo_mount) in home_setup_undo_mount()
306 setup->undo_mount = false; in home_setup_undo_mount()
310 int home_setup_undo_dm(HomeSetup *setup, int level) { in home_setup_undo_dm() argument
313 assert(setup); in home_setup_undo_dm()
315 if (setup->undo_dm) { in home_setup_undo_dm()
316 assert(setup->crypt_device); in home_setup_undo_dm()
317 assert(setup->dm_name); in home_setup_undo_dm()
319 r = sym_crypt_deactivate_by_name(setup->crypt_device, setup->dm_name, 0); in home_setup_undo_dm()
325 (void) wait_for_block_device_gone(setup, USEC_PER_SEC * 30); in home_setup_undo_dm()
327 setup->undo_dm = false; in home_setup_undo_dm()
332 if (setup->crypt_device) { in home_setup_undo_dm()
333 sym_crypt_free(setup->crypt_device); in home_setup_undo_dm()
334 setup->crypt_device = NULL; in home_setup_undo_dm()
368 int home_setup_done(HomeSetup *setup) { in home_setup_done() argument
371 assert(setup); in home_setup_done()
373 if (setup->root_fd >= 0) { in home_setup_done()
374 if (setup->do_offline_fitrim) { in home_setup_done()
375 q = run_fitrim(setup->root_fd); in home_setup_done()
380 if (syncfs(setup->root_fd) < 0) in home_setup_done()
383 setup->root_fd = safe_close(setup->root_fd); in home_setup_done()
386 q = home_setup_undo_mount(setup, LOG_DEBUG); in home_setup_done()
390 q = home_setup_undo_dm(setup, LOG_DEBUG); in home_setup_done()
394 if (setup->image_fd >= 0) { in home_setup_done()
395 if (setup->do_offline_fallocate) { in home_setup_done()
396 q = run_fallocate(setup->image_fd, NULL); in home_setup_done()
401 if (setup->do_mark_clean) { in home_setup_done()
402 q = run_mark_dirty(setup->image_fd, false); in home_setup_done()
407 setup->image_fd = safe_close(setup->image_fd); in home_setup_done()
410 if (setup->temporary_image_path) { in home_setup_done()
411 if (unlink(setup->temporary_image_path) < 0) in home_setup_done()
413 setup->temporary_image_path); in home_setup_done()
415 setup->temporary_image_path = mfree(setup->temporary_image_path); in home_setup_done()
418 setup->key_serial = keyring_unlink(setup->key_serial); in home_setup_done()
420 setup->undo_mount = false; in home_setup_done()
421 setup->undo_dm = false; in home_setup_done()
422 setup->do_offline_fitrim = false; in home_setup_done()
423 setup->do_offline_fallocate = false; in home_setup_done()
424 setup->do_mark_clean = false; in home_setup_done()
426 setup->dm_name = mfree(setup->dm_name); in home_setup_done()
427 setup->dm_node = mfree(setup->dm_node); in home_setup_done()
429 setup->loop = loop_device_unref(setup->loop); in home_setup_done()
431 setup->volume_key = erase_and_free(setup->volume_key); in home_setup_done()
432 setup->volume_key_size = 0; in home_setup_done()
434 if (setup->do_drop_caches) in home_setup_done()
437 setup->mount_suffix = mfree(setup->mount_suffix); in home_setup_done()
445 HomeSetup *setup, in home_setup() argument
452 assert(setup); in home_setup()
453 assert(!setup->loop); in home_setup()
454 assert(!setup->crypt_device); in home_setup()
455 assert(setup->root_fd < 0); in home_setup()
456 assert(!setup->undo_dm); in home_setup()
457 assert(!setup->undo_mount); in home_setup()
462 setup->do_drop_caches = setup->do_drop_caches || user_record_drop_caches(h); in home_setup()
467 return home_setup_luks(h, flags, NULL, setup, cache, ret_header_home); in home_setup()
471 r = home_setup_directory(h, setup); in home_setup()
475 r = home_setup_fscrypt(h, setup, cache); in home_setup()
479 r = home_setup_cifs(h, flags, setup); in home_setup()
739 int home_extend_embedded_identity(UserRecord *h, UserRecord *used, HomeSetup *setup) { in home_extend_embedded_identity() argument
744 assert(setup); in home_extend_embedded_identity()
750 setup->found_partition_uuid, in home_extend_embedded_identity()
751 setup->found_luks_uuid, in home_extend_embedded_identity()
752 setup->found_fs_uuid, in home_extend_embedded_identity()
753 setup->crypt_device ? sym_crypt_get_cipher(setup->crypt_device) : NULL, in home_extend_embedded_identity()
754 setup->crypt_device ? sym_crypt_get_cipher_mode(setup->crypt_device) : NULL, in home_extend_embedded_identity()
755 … setup->crypt_device ? luks_volume_key_size_convert(setup->crypt_device) : UINT64_MAX, in home_extend_embedded_identity()
756 file_system_type_fd(setup->root_fd), in home_extend_embedded_identity()
786 HomeSetup *setup) { in home_maybe_shift_uid() argument
792 assert(setup); in home_maybe_shift_uid()
793 assert(setup->root_fd >= 0); in home_maybe_shift_uid()
799 if (fstat(setup->root_fd, &st) < 0) in home_maybe_shift_uid()
805 (void) home_shift_uid(setup->root_fd, NULL, st.st_uid, h->uid, &mount_fd); in home_maybe_shift_uid()
810 safe_close(setup->root_fd); in home_maybe_shift_uid()
812 setup->root_fd = fd_reopen(mount_fd, O_RDONLY|O_CLOEXEC|O_DIRECTORY); in home_maybe_shift_uid()
813 if (setup->root_fd < 0) in home_maybe_shift_uid()
814 …return log_error_errno(setup->root_fd, "Failed to convert mount fd into regular directory fd: %m"); in home_maybe_shift_uid()
823 HomeSetup *setup, in home_refresh() argument
833 assert(setup); in home_refresh()
839 …r = home_load_embedded_identity(h, setup->root_fd, header_home, USER_RECONCILE_ANY, cache, &embedd… in home_refresh()
843 r = home_maybe_shift_uid(h, flags, setup); in home_refresh()
847 r = home_store_header_identity_luks(new_home, setup, header_home); in home_refresh()
851 r = home_store_embedded_identity(new_home, setup->root_fd, h->uid, embedded_home); in home_refresh()
855 r = chown_recursive_directory(setup->root_fd, h->uid); in home_refresh()
859 r = home_sync_and_statfs(setup->root_fd, ret_statfs); in home_refresh()
868 _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; in home_activate()
902 r = home_activate_luks(h, flags, &setup, &cache, &new_home); in home_activate()
911 r = home_activate_directory(h, flags, &setup, &cache, &new_home); in home_activate()
918 r = home_activate_cifs(h, flags, &setup, &cache, &new_home); in home_activate()
941 _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; in home_deactivate()
966 … setup.undo_mount = true; /* remember to unmount the new bind mount from HOME_RUNTIME_WORK_DIR */ in home_deactivate()
969 setup.root_fd = open(HOME_RUNTIME_WORK_DIR, O_RDONLY|O_DIRECTORY|O_CLOEXEC); in home_deactivate()
970 if (setup.root_fd < 0) in home_deactivate()
982 (void) home_trim_luks(h, &setup); in home_deactivate()
986 if (syncfs(setup.root_fd) < 0) in home_deactivate()
992 (void) home_auto_shrink_luks(h, &setup, &cache); in home_deactivate()
994 setup.root_fd = safe_close(setup.root_fd); in home_deactivate()
1001 … setup.undo_mount = false; /* Remember that the bind mount doesn't need to be unmounted anymore */ in home_deactivate()
1004 setup.do_drop_caches = true; in home_deactivate()
1012 r = home_deactivate_luks(h, &setup); in home_deactivate()
1025 if (setup.do_drop_caches) { in home_deactivate()
1026 setup.do_drop_caches = false; in home_deactivate()
1311 _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; in home_create()
1374 r = home_create_luks(h, &setup, &cache, effective_passwords, &new_home); in home_create()
1379 r = home_create_directory_or_subvolume(h, &setup, &new_home); in home_create()
1383 r = home_create_fscrypt(h, &setup, effective_passwords, &new_home); in home_create()
1387 r = home_create_cifs(h, &setup, &new_home); in home_create()
1522 static int home_validate_update(UserRecord *h, HomeSetup *setup, HomeSetupFlags *flags) { in home_validate_update() argument
1527 assert(setup); in home_validate_update()
1557 r = home_get_state_luks(h, setup); in home_validate_update()
1578 _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; in home_update()
1591 r = home_validate_update(h, &setup, &flags); in home_update()
1595 r = home_setup(h, flags, &setup, &cache, &header_home); in home_update()
1599 …r = home_load_embedded_identity(h, setup.root_fd, header_home, USER_RECONCILE_REQUIRE_NEWER, &cach… in home_update()
1603 r = home_maybe_shift_uid(h, flags, &setup); in home_update()
1607 r = home_store_header_identity_luks(new_home, &setup, header_home); in home_update()
1611 r = home_store_embedded_identity(new_home, setup.root_fd, h->uid, embedded_home); in home_update()
1615 r = home_extend_embedded_identity(new_home, h, &setup); in home_update()
1619 r = home_sync_and_statfs(setup.root_fd, NULL); in home_update()
1623 r = home_setup_done(&setup); in home_update()
1634 _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; in home_resize()
1656 r = home_validate_update(h, &setup, &flags); in home_resize()
1668 return home_resize_luks(h, flags, &setup, &cache, ret); in home_resize()
1673 return home_resize_directory(h, flags, &setup, &cache, ret); in home_resize()
1683 _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; in home_passwd()
1698 r = home_validate_update(h, &setup, &flags); in home_passwd()
1702 r = home_setup(h, flags, &setup, &cache, &header_home); in home_passwd()
1706 …r = home_load_embedded_identity(h, setup.root_fd, header_home, USER_RECONCILE_REQUIRE_NEWER_OR_EQU… in home_passwd()
1710 r = home_maybe_shift_uid(h, flags, &setup); in home_passwd()
1717 r = home_passwd_luks(h, flags, &setup, &cache, effective_passwords); in home_passwd()
1723 r = home_passwd_fscrypt(h, &setup, &cache, effective_passwords); in home_passwd()
1732 r = home_store_header_identity_luks(new_home, &setup, header_home); in home_passwd()
1736 r = home_store_embedded_identity(new_home, setup.root_fd, h->uid, embedded_home); in home_passwd()
1740 r = home_extend_embedded_identity(new_home, h, &setup); in home_passwd()
1744 r = home_sync_and_statfs(setup.root_fd, NULL); in home_passwd()
1748 r = home_setup_done(&setup); in home_passwd()
1760 _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; in home_inspect()
1772 r = home_validate_update(h, &setup, &flags); in home_inspect()
1776 r = home_setup(h, flags, &setup, &cache, &header_home); in home_inspect()
1780 …r = home_load_embedded_identity(h, setup.root_fd, header_home, USER_RECONCILE_ANY, &cache, NULL, &… in home_inspect()
1784 r = home_extend_embedded_identity(new_home, h, &setup); in home_inspect()
1788 r = home_setup_done(&setup); in home_inspect()
1799 _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; in home_lock()
1815 r = home_lock_luks(h, &setup); in home_lock()
1824 _cleanup_(home_setup_done) HomeSetup setup = HOME_SETUP_INIT; in home_unlock()
1842 r = home_unlock_luks(h, &setup, &cache); in home_unlock()