From 13b9181e3225f5a00b0b4cc13a9ad293cbf5bb8e Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Mon, 20 Sep 2021 02:29:55 +0200 Subject: [PATCH] lib: file-lock - Remove file_{wait,try}_lock(). --- src/lib/file-lock.c | 22 ---------------------- src/lib/file-lock.h | 11 ----------- 2 files changed, 33 deletions(-) diff --git a/src/lib/file-lock.c b/src/lib/file-lock.c index 84d9897d5c..d35d7fdfca 100644 --- a/src/lib/file-lock.c +++ b/src/lib/file-lock.c @@ -56,13 +56,6 @@ const char *file_lock_method_to_str(enum file_lock_method method) i_unreached(); } -int file_try_lock(int fd, const char *path, int lock_type, - enum file_lock_method lock_method, - struct file_lock **lock_r) -{ - return file_wait_lock(fd, path, lock_type, lock_method, 0, lock_r); -} - int file_try_lock_error(int fd, const char *path, int lock_type, enum file_lock_method lock_method, struct file_lock **lock_r, const char **error_r) @@ -292,21 +285,6 @@ static int file_lock_do(int fd, const char *path, int lock_type, return 1; } -int file_wait_lock(int fd, const char *path, int lock_type, - enum file_lock_method lock_method, - unsigned int timeout_secs, - struct file_lock **lock_r) -{ - const char *error; - int ret; - - ret = file_wait_lock_error(fd, path, lock_type, lock_method, - timeout_secs, lock_r, &error); - if (ret < 0) - i_error("%s", error); - return ret; -} - int file_wait_lock_error(int fd, const char *path, int lock_type, enum file_lock_method lock_method, unsigned int timeout_secs, diff --git a/src/lib/file-lock.h b/src/lib/file-lock.h index d32d5f8029..77e0dd9550 100644 --- a/src/lib/file-lock.h +++ b/src/lib/file-lock.h @@ -23,22 +23,11 @@ const char *file_lock_method_to_str(enum file_lock_method method); /* Lock the file. Returns 1 if successful, 0 if file is already locked, or -1 if error. lock_type is F_WRLCK or F_RDLCK. */ -int file_try_lock(int fd, const char *path, int lock_type, - enum file_lock_method lock_method, - struct file_lock **lock_r); -/* Like file_try_lock(), but return the error message as a string instead - of logging it. Also when returning 0 an error message is returned. */ int file_try_lock_error(int fd, const char *path, int lock_type, enum file_lock_method lock_method, struct file_lock **lock_r, const char **error_r); /* Like lock_try_lock(), but return 0 only after having tried to lock for timeout_secs. */ -int file_wait_lock(int fd, const char *path, int lock_type, - enum file_lock_method lock_method, - unsigned int timeout_secs, - struct file_lock **lock_r); -/* Like file_wait_lock(), but return the error message as a string instead - of logging it. Also when returning 0 an error message is returned. */ int file_wait_lock_error(int fd, const char *path, int lock_type, enum file_lock_method lock_method, unsigned int timeout_secs, -- 2.47.3