* 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;
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);
{
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;
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);
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 */
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:
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;
}
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;
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
va_list args;
va_start(args,fmt);
- vsprintf(ErrorBuffer,fmt,args);
+ vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args);
va_end(args);
printk(KERN_CRIT "AFFS error (device %s): %s(): %s\n", sb->s_id,
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
va_list args;
va_start(args,fmt);
- vsprintf(ErrorBuffer,fmt,args);
+ vsnprintf(ErrorBuffer,sizeof(ErrorBuffer),fmt,args);
va_end(args);
printk(KERN_WARNING "AFFS warning (device %s): %s(): %s\n", sb->s_id,