dovecot-2.2: Added file_lock_method_to_str()
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 9 18:50:50 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/1a938b81cc5f
changeset: 14751:1a938b81cc5f
user: Timo Sirainen <tss at iki.fi>
date: Thu Aug 09 18:50:31 2012 +0300
description:
Added file_lock_method_to_str()
diffstat:
src/lib/file-lock.c | 13 +++++++++++++
src/lib/file-lock.h | 2 ++
2 files changed, 15 insertions(+), 0 deletions(-)
diffs (35 lines):
diff -r 6d626fcbde9e -r 1a938b81cc5f src/lib/file-lock.c
--- a/src/lib/file-lock.c Wed Aug 08 23:57:29 2012 +0300
+++ b/src/lib/file-lock.c Thu Aug 09 18:50:31 2012 +0300
@@ -28,6 +28,19 @@
return TRUE;
}
+const char *file_lock_method_to_str(enum file_lock_method method)
+{
+ switch (method) {
+ case FILE_LOCK_METHOD_FCNTL:
+ return "fcntl";
+ case FILE_LOCK_METHOD_FLOCK:
+ return "flock";
+ case FILE_LOCK_METHOD_DOTLOCK:
+ return "dotlock";
+ }
+ 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)
diff -r 6d626fcbde9e -r 1a938b81cc5f src/lib/file-lock.h
--- a/src/lib/file-lock.h Wed Aug 08 23:57:29 2012 +0300
+++ b/src/lib/file-lock.h Thu Aug 09 18:50:31 2012 +0300
@@ -17,6 +17,8 @@
/* Parse lock method from given string. Returns TRUE if ok,
FALSE if name is unknown. */
bool file_lock_method_parse(const char *name, enum file_lock_method *method_r);
+/* Convert lock method to string. */
+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. */
More information about the dovecot-cvs
mailing list