Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/lib/nfs-workarounds.h @ 8590:b9faf4db2a9f HEAD
Updated copyright notices to include year 2009.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 06 Jan 2009 09:25:38 -0500 |
parents | 41911abe6fa7 |
children |
rev | line source |
---|---|
6410
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
5970
diff
changeset
|
1 #ifndef NFS_WORKAROUNDS_H |
e4eb71ae8e96
Changed .h ifdef/defines to use <NAME>_H format.
Timo Sirainen <tss@iki.fi>
parents:
5970
diff
changeset
|
2 #define NFS_WORKAROUNDS_H |
4071
cd3d26cf124a
Renamed safe-open.* to nfs-workarounds.*, safe_open() to nfs_safe_open() and
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
3 |
4292
5f1069459a07
Include <sys/stat.h> before using struct stat, because some systems may use
Timo Sirainen <tss@iki.fi>
parents:
4225
diff
changeset
|
4 /* Note that some systems (Solaris) may use a macro to redefine struct stat */ |
5f1069459a07
Include <sys/stat.h> before using struct stat, because some systems may use
Timo Sirainen <tss@iki.fi>
parents:
4225
diff
changeset
|
5 #include <sys/stat.h> |
4225
abdef9d86a94
Added nfs_safe_stat() to transparently work around ESTALE with stat().
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4071
diff
changeset
|
6 |
4071
cd3d26cf124a
Renamed safe-open.* to nfs-workarounds.*, safe_open() to nfs_safe_open() and
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
7 /* When syscall fails with ESTALE error, how many times to try reopening the |
cd3d26cf124a
Renamed safe-open.* to nfs-workarounds.*, safe_open() to nfs_safe_open() and
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
8 file and retrying the operation. */ |
cd3d26cf124a
Renamed safe-open.* to nfs-workarounds.*, safe_open() to nfs_safe_open() and
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
9 #define NFS_ESTALE_RETRY_COUNT 10 |
cd3d26cf124a
Renamed safe-open.* to nfs-workarounds.*, safe_open() to nfs_safe_open() and
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
10 |
5970
a290b84d144a
Added nfs_flush_attr_cache() and nfs_flush_read_cache().
Timo Sirainen <tss@iki.fi>
parents:
5968
diff
changeset
|
11 /* Same as open(), but try to handle ESTALE errors. */ |
4071
cd3d26cf124a
Renamed safe-open.* to nfs-workarounds.*, safe_open() to nfs_safe_open() and
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
12 int nfs_safe_open(const char *path, int flags); |
5970
a290b84d144a
Added nfs_flush_attr_cache() and nfs_flush_read_cache().
Timo Sirainen <tss@iki.fi>
parents:
5968
diff
changeset
|
13 /* Same as stat(), but try to handle ESTALE errors. |
a290b84d144a
Added nfs_flush_attr_cache() and nfs_flush_read_cache().
Timo Sirainen <tss@iki.fi>
parents:
5968
diff
changeset
|
14 Doesn't flush attribute cache. */ |
4225
abdef9d86a94
Added nfs_safe_stat() to transparently work around ESTALE with stat().
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4071
diff
changeset
|
15 int nfs_safe_stat(const char *path, struct stat *buf); |
5968 | 16 int nfs_safe_lstat(const char *path, struct stat *buf); |
6813
575235932194
nfs_safe_link(): Support linking files without original link count=1. Use it
Timo Sirainen <tss@iki.fi>
parents:
6811
diff
changeset
|
17 /* Same as link(), but handle problems with link() by verifying the file's |
575235932194
nfs_safe_link(): Support linking files without original link count=1. Use it
Timo Sirainen <tss@iki.fi>
parents:
6811
diff
changeset
|
18 link count changes. If links1=TRUE, assume the original file's link count |
575235932194
nfs_safe_link(): Support linking files without original link count=1. Use it
Timo Sirainen <tss@iki.fi>
parents:
6811
diff
changeset
|
19 is 1, otherwise stat() first to find it out. */ |
575235932194
nfs_safe_link(): Support linking files without original link count=1. Use it
Timo Sirainen <tss@iki.fi>
parents:
6811
diff
changeset
|
20 int nfs_safe_link(const char *oldpath, const char *newpath, bool links1); |
4071
cd3d26cf124a
Renamed safe-open.* to nfs-workarounds.*, safe_open() to nfs_safe_open() and
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
21 |
6829
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
22 /* Flush attribute cache for given path. The file must not be fcntl locked or |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
23 the locks may get dropped. */ |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
24 void nfs_flush_attr_cache_unlocked(const char *path); |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
25 /* Flush attribute cache for given path. The file may be fcntl locked. */ |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
26 void nfs_flush_attr_cache_maybe_locked(const char *path); |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
27 /* Flush attribute cache for a fcntl locked file descriptor. If locking flushes |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
28 the attribute cache with the running OS, this function does nothing. |
5970
a290b84d144a
Added nfs_flush_attr_cache() and nfs_flush_read_cache().
Timo Sirainen <tss@iki.fi>
parents:
5968
diff
changeset
|
29 The given path is used only for logging. */ |
6829
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
30 bool nfs_flush_attr_cache_fd_locked(const char *path, int fd); |
6857 | 31 /* Flush file handle cache for given file. */ |
32 void nfs_flush_file_handle_cache(const char *path); | |
6829
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
33 |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
34 /* Flush read cache for fd that was just fcntl locked. If the OS flushes |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
35 read cache when fcntl locking file, this function does nothing. */ |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
36 void nfs_flush_read_cache_locked(const char *path, int fd); |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
37 /* Flush read cache for fd that doesn't have fcntl locks. */ |
dbab5e592577
NFS cache flushing APIs changed and backend implements it a bit differently.
Timo Sirainen <tss@iki.fi>
parents:
6819
diff
changeset
|
38 void nfs_flush_read_cache_unlocked(const char *path, int fd); |
5970
a290b84d144a
Added nfs_flush_attr_cache() and nfs_flush_read_cache().
Timo Sirainen <tss@iki.fi>
parents:
5968
diff
changeset
|
39 |
4071
cd3d26cf124a
Renamed safe-open.* to nfs-workarounds.*, safe_open() to nfs_safe_open() and
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
40 #endif |