# endif
#endif
-#ifndef HAVE_LINUX_DO_SYNC_READ
+#if defined(HAVE_LINUX_LOCKS_LOCK_FILE_WAIT)
+# define flock_lock_file_wait locks_lock_file_wait
+#endif
+
+#if !defined(HAVE_LINUX_DO_SYNC_READ) && !defined(STRUCT_FILE_OPERATIONS_HAS_READ_ITER)
static inline int
do_sync_read(struct file *fp, char *buf, size_t count, loff_t *offp) {
return generic_file_read(fp, buf, count, offp);
static inline void
afs_linux_lock_inode(struct inode *ip) {
-#ifdef STRUCT_INODE_HAS_I_MUTEX
+#if defined(HAVE_LINUX_INODE_LOCK)
+ inode_lock(ip);
+#elif defined(STRUCT_INODE_HAS_I_MUTEX)
mutex_lock(&ip->i_mutex);
#else
down(&ip->i_sem);
static inline void
afs_linux_unlock_inode(struct inode *ip) {
-#ifdef STRUCT_INODE_HAS_I_MUTEX
+#if defined(HAVE_LINUX_INODE_LOCK)
+ inode_unlock(ip);
+#elif defined(STRUCT_INODE_HAS_I_MUTEX)
mutex_unlock(&ip->i_mutex);
#else
up(&ip->i_sem);
#else
afs_get_dentry_ref(afs_linux_path_t *path, struct vfsmount **mnt, struct dentry **dpp) {
#endif
-#if defined(STRUCT_NAMEIDATA_HAS_PATH)
-# if defined(HAVE_LINUX_PATH_LOOKUP)
+#if defined(HAVE_LINUX_PATH_LOOKUP)
+# if defined(STRUCT_NAMEIDATA_HAS_PATH)
*dpp = dget(nd->path.dentry);
if (mnt)
*mnt = mntget(nd->path.mnt);
path_put(&nd->path);
# else
- *dpp = dget(path->dentry);
- if (mnt)
- *mnt = mntget(path->mnt);
- path_put(path);
-# endif
-#else
*dpp = dget(nd->dentry);
if (mnt)
*mnt = mntget(nd->mnt);
path_release(nd);
+# endif
+#else
+ *dpp = dget(path->dentry);
+ if (mnt)
+ *mnt = mntget(path->mnt);
+ path_put(path);
#endif
}
#endif
}
+static inline int
+afs_file_read(struct file *filp, char __user *buf, size_t len, loff_t *pos)
+{
+#if defined(HAVE_LINUX___VFS_READ)
+ return __vfs_read(filp, buf, len, pos);
+#else
+ return filp->f_op->read(filp, buf, len, pos);
+#endif
+}
+
+static inline int
+afs_file_write(struct file *filp, char __user *buf, size_t len, loff_t *pos)
+{
+#if defined(HAVE_LINUX___VFS_READ)
+ return __vfs_write(filp, buf, len, pos);
+#else
+ return filp->f_op->write(filp, buf, len, pos);
+#endif
+}
+
#endif /* AFS_LINUX_OSI_COMPAT_H */