LINUX: CURRENT_TIME macro goes away.
[openafs.git] / src / afs / LINUX / osi_file.c
index 8cdff4b..1718c96 100644 (file)
 #endif
 #include "osi_compat.h"
 
+#ifndef CURRENT_TIME
+#define CURRENT_TIME           (current_kernel_time())
+#endif
+
 int cache_fh_type = -1;
 int cache_fh_len = -1;
 
@@ -183,7 +187,11 @@ osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
     newattrs.ia_ctime = CURRENT_TIME;
 
     /* avoid notify_change() since it wants to update dentry->d_parent */
+#ifdef HAVE_LINUX_SETATTR_PREPARE
+    code = setattr_prepare(file_dentry(afile->filp), &newattrs);
+#else
     code = inode_change_ok(inode, &newattrs);
+#endif
     if (!code)
        code = afs_inode_setattr(afile, &newattrs);
     if (!code)
@@ -218,7 +226,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
      * down. No point in crashing when we are already shutting down
      */
     if (!afile) {
-       if (!afs_shuttingdown)
+       if (afs_shuttingdown == AFS_RUNNING)
            osi_Panic("osi_Read called with null param");
        else
            return -EIO;
@@ -258,7 +266,7 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
     AFS_STATCNT(osi_Write);
 
     if (!afile) {
-       if (!afs_shuttingdown)
+       if (afs_shuttingdown == AFS_RUNNING)
            osi_Panic("afs_osi_Write called with null param");
        else
            return -EIO;
@@ -375,9 +383,9 @@ osi_rdwr(struct osi_file *osifile, struct uio *uiop, int rw)
 
        pos = uiop->uio_offset;
        if (rw == UIO_READ)
-           code = filp->f_op->read(filp, iov->iov_base, count, &pos);
+           code = afs_file_read(filp, iov->iov_base, count, &pos);
        else
-           code = filp->f_op->write(filp, iov->iov_base, count, &pos);
+           code = afs_file_write(filp, iov->iov_base, count, &pos);
 
        if (code < 0) {
            code = -code;