1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include "user-record.h" 5 #include "group-record.h" 6 #include "nspawn-mount.h" 7 8 typedef struct BindUserData { 9 /* The host's user/group records */ 10 UserRecord *host_user; 11 GroupRecord *host_group; 12 13 /* The mapped records to place into the container */ 14 UserRecord *payload_user; 15 GroupRecord *payload_group; 16 } BindUserData; 17 18 typedef struct BindUserContext { 19 BindUserData *data; 20 size_t n_data; 21 } BindUserContext; 22 23 BindUserContext* bind_user_context_free(BindUserContext *c); 24 25 DEFINE_TRIVIAL_CLEANUP_FUNC(BindUserContext*, bind_user_context_free); 26 27 int bind_user_prepare(const char *directory, char **bind_user, uid_t uid_shift, uid_t uid_range, CustomMount **custom_mounts, size_t *n_custom_mounts, BindUserContext **ret); 28 29 int bind_user_setup(const BindUserContext *c, const char *root); 30