Lines Matching refs:directory

102 static bool e4crypt_policy_set(const char *directory, const char *policy, size_t policy_length) {  in e4crypt_policy_set()  argument
107 int fd = open(directory, O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC); in e4crypt_policy_set()
109 PLOG(ERROR) << "Failed to open directory " << directory; in e4crypt_policy_set()
120 PLOG(ERROR) << "Failed to set encryption policy for " << directory; in e4crypt_policy_set()
128 LOG(INFO) << "Policy for " << directory << " set to " << policy_hex; in e4crypt_policy_set()
132 static bool e4crypt_policy_get(const char *directory, char *policy, size_t policy_length) { in e4crypt_policy_get() argument
138 int fd = open(directory, O_DIRECTORY | O_NOFOLLOW | O_CLOEXEC); in e4crypt_policy_get()
140 PLOG(ERROR) << "Failed to open directory " << directory; in e4crypt_policy_get()
147 PLOG(ERROR) << "Failed to get encryption policy for " << directory; in e4crypt_policy_get()
157 LOG(ERROR) << "Failed to find matching encryption policy for " << directory; in e4crypt_policy_get()
165 static bool e4crypt_policy_check(const char *directory, const char *policy, size_t policy_length) { in e4crypt_policy_check() argument
171 if (!e4crypt_policy_get(directory, existing_policy, EXT4_KEY_DESCRIPTOR_SIZE)) return false; in e4crypt_policy_check()
179 LOG(ERROR) << "Found policy " << existing_policy_hex << " at " << directory in e4crypt_policy_check()
183 LOG(INFO) << "Found policy " << existing_policy_hex << " at " << directory in e4crypt_policy_check()
188 int e4crypt_policy_ensure(const char *directory, const char *policy, size_t policy_length) { in e4crypt_policy_ensure() argument
190 if (!is_dir_empty(directory, &is_empty)) return -1; in e4crypt_policy_ensure()
192 if (!e4crypt_policy_set(directory, policy, policy_length)) return -1; in e4crypt_policy_ensure()
194 if (!e4crypt_policy_check(directory, policy, policy_length)) return -1; in e4crypt_policy_ensure()