vserver 1.9.5.x5
[linux-2.6.git] / fs / affs / amigaffs.c
index b5d1aab..ccd624e 100644 (file)
@@ -8,14 +8,7 @@
  *  Please send bug reports to: hjw@zvw.de
  */
 
-#include <stdarg.h>
-#include <linux/stat.h>
-#include <linux/time.h>
-#include <linux/affs_fs.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/amigaffs.h>
-#include <linux/buffer_head.h>
+#include "affs.h"
 
 extern struct timezone sys_tz;
 
@@ -68,7 +61,7 @@ affs_insert_hash(struct inode *dir, struct buffer_head *bh)
        mark_buffer_dirty_inode(dir_bh, dir);
        affs_brelse(dir_bh);
 
-       dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+       dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
        dir->i_version++;
        mark_inode_dirty(dir);
 
@@ -84,7 +77,8 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
 {
        struct super_block *sb;
        struct buffer_head *bh;
-       u32 rem_ino, hash_ino, ino;
+       u32 rem_ino, hash_ino;
+       __be32 ino;
        int offset, retval;
 
        sb = dir->i_sb;
@@ -120,7 +114,7 @@ affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh)
 
        affs_brelse(bh);
 
-       dir->i_mtime = dir->i_ctime = CURRENT_TIME;
+       dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
        dir->i_version++;
        mark_inode_dirty(dir);
 
@@ -201,11 +195,11 @@ affs_remove_link(struct dentry *dentry)
                        goto done;
        }
 
-       while ((ino = be32_to_cpu(AFFS_TAIL(sb, bh)->link_chain))) {
+       while ((ino = be32_to_cpu(AFFS_TAIL(sb, bh)->link_chain)) != 0) {
                if (ino == link_ino) {
-                       ino = AFFS_TAIL(sb, link_bh)->link_chain;
-                       AFFS_TAIL(sb, bh)->link_chain = ino;
-                       affs_adjust_checksum(bh, be32_to_cpu(ino) - link_ino);
+                       __be32 ino2 = AFFS_TAIL(sb, link_bh)->link_chain;
+                       AFFS_TAIL(sb, bh)->link_chain = ino2;
+                       affs_adjust_checksum(bh, be32_to_cpu(ino2) - link_ino);
                        mark_buffer_dirty_inode(bh, inode);
                        retval = 0;
                        /* Fix the link count, if bh is a normal header block without links */
@@ -318,7 +312,7 @@ affs_remove_header(struct dentry *dentry)
        else
                inode->i_nlink = 0;
        affs_unlock_link(inode);
-       inode->i_ctime = CURRENT_TIME;
+       inode->i_ctime = CURRENT_TIME_SEC;
        mark_inode_dirty(inode);
 
 done:
@@ -341,12 +335,12 @@ done_unlock:
 u32
 affs_checksum_block(struct super_block *sb, struct buffer_head *bh)
 {
-       u32 *ptr = (u32 *)bh->b_data;
+       __be32 *ptr = (__be32 *)bh->b_data;
        u32 sum;
        int bsize;
 
        sum = 0;
-       for (bsize = sb->s_blocksize / sizeof(u32); bsize > 0; bsize--)
+       for (bsize = sb->s_blocksize / sizeof(__be32); bsize > 0; bsize--)
                sum += be32_to_cpu(*ptr++);
        return sum;
 }
@@ -359,9 +353,10 @@ affs_checksum_block(struct super_block *sb, struct buffer_head *bh)
 void
 affs_fix_checksum(struct super_block *sb, struct buffer_head *bh)
 {
-       int cnt = sb->s_blocksize / sizeof(u32);
-       u32 *ptr = (u32 *)bh->b_data;
-       u32 checksum, *checksumptr;
+       int cnt = sb->s_blocksize / sizeof(__be32);
+       __be32 *ptr = (__be32 *)bh->b_data;
+       u32 checksum;
+       __be32 *checksumptr;
 
        checksumptr = ptr + 5;
        *checksumptr = 0;
@@ -384,9 +379,9 @@ secs_to_datestamp(time_t secs, struct affs_date *ds)
        minute  = secs / 60;
        secs   -= minute * 60;
 
-       ds->days = be32_to_cpu(days);
-       ds->mins = be32_to_cpu(minute);
-       ds->ticks = be32_to_cpu(secs * 50);
+       ds->days = cpu_to_be32(days);
+       ds->mins = cpu_to_be32(minute);
+       ds->ticks = cpu_to_be32(secs * 50);
 }
 
 mode_t
@@ -458,7 +453,6 @@ affs_error(struct super_block *sb, const char *function, const char *fmt, ...)
        if (!(sb->s_flags & MS_RDONLY))
                printk(KERN_WARNING "AFFS: Remounting filesystem read-only\n");
        sb->s_flags |= MS_RDONLY;
-       AFFS_SB(sb)->s_flags |= SF_READONLY;    /* Don't allow to remount rw */
 }
 
 void