summaryrefslogtreecommitdiffstats
path: root/lib/utils_device_locking.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/utils_device_locking.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/lib/utils_device_locking.c b/lib/utils_device_locking.c
index e18ea77..ef3f6b4 100644
--- a/lib/utils_device_locking.c
+++ b/lib/utils_device_locking.c
@@ -1,8 +1,8 @@
/*
* Metadata on-disk locking for processes serialization
*
- * Copyright (C) 2016-2023 Red Hat, Inc. All rights reserved.
- * Copyright (C) 2016-2023 Ondrej Kozina
+ * Copyright (C) 2016-2024 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2016-2024 Ondrej Kozina
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -134,7 +134,7 @@ static int open_resource(struct crypt_device *cd, const char *res)
return -EINVAL;
log_dbg(cd, "Opening lock resource file %s/%s", DEFAULT_LUKS2_LOCK_PATH, res);
- r = openat(lockdir_fd, res, O_CREAT | O_NOFOLLOW | O_RDWR | O_CLOEXEC, 0777);
+ r = openat(lockdir_fd, res, O_CREAT|O_NOFOLLOW|O_RDWR|O_CLOEXEC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
err = errno;
close(lockdir_fd);
@@ -405,30 +405,6 @@ int device_write_lock_internal(struct crypt_device *cd, struct device *device)
return 1;
}
-int crypt_read_lock(struct crypt_device *cd, const char *resource, bool blocking, struct crypt_lock_handle **lock)
-{
- int r;
- struct crypt_lock_handle *h;
-
- if (!resource)
- return -EINVAL;
-
- log_dbg(cd, "Acquiring %sblocking read lock for resource %s.", blocking ? "" : "non", resource);
-
- r = acquire_and_verify(cd, NULL, resource, LOCK_SH | (blocking ? 0 : LOCK_NB), &h);
- if (r < 0)
- return r;
-
- h->type = DEV_LOCK_READ;
- h->refcnt = 1;
-
- log_dbg(cd, "READ lock for resource %s taken.", resource);
-
- *lock = h;
-
- return 0;
-}
-
int crypt_write_lock(struct crypt_device *cd, const char *resource, bool blocking, struct crypt_lock_handle **lock)
{
int r;