1 #ifndef NFS_WORKAROUNDS_H
2 #define NFS_WORKAROUNDS_H
3 
4 /* Note that some systems (Solaris) may use a macro to redefine struct stat */
5 #include <sys/stat.h>
6 
7 /* When syscall fails with ESTALE error, how many times to try reopening the
8    file and retrying the operation. */
9 #define NFS_ESTALE_RETRY_COUNT 10
10 
11 /* Same as open(), but try to handle ESTALE errors. */
12 int nfs_safe_open(const char *path, int flags);
13 /* Same as stat(), but try to handle ESTALE errors.
14    Doesn't flush attribute cache. */
15 int nfs_safe_stat(const char *path, struct stat *buf);
16 int nfs_safe_lstat(const char *path, struct stat *buf);
17 /* Same as link(), but handle problems with link() by verifying the file's
18    link count changes. If links1=TRUE, assume the original file's link count
19    is 1, otherwise stat() first to find it out. */
20 int nfs_safe_link(const char *oldpath, const char *newpath, bool links1);
21 
22 /* Flush attribute cache for given path. The file must not be fcntl locked or
23    the locks may get dropped. */
24 void nfs_flush_attr_cache_unlocked(const char *path);
25 /* Flush attribute cache for given path. The file may be fcntl locked. */
26 void nfs_flush_attr_cache_maybe_locked(const char *path);
27 /* Flush attribute cache for a fcntl locked file descriptor. If locking flushes
28    the attribute cache with the running OS, this function does nothing.
29    The given path is used only for logging. */
30 void nfs_flush_attr_cache_fd_locked(const char *path, int fd);
31 /* Flush file handle cache for given file. */
32 void nfs_flush_file_handle_cache(const char *path);
33 
34 /* Flush read cache for fd that was just fcntl locked. If the OS flushes
35    read cache when fcntl locking file, this function does nothing. */
36 void nfs_flush_read_cache_locked(const char *path, int fd);
37 /* Flush read cache for fd that doesn't have fcntl locks. */
38 void nfs_flush_read_cache_unlocked(const char *path, int fd);
39 
40 #endif
41