* Makes BFS code endianness-clean.
* Fixes some signedness warnings.
* Fixes a problem in fs/bfs/inode.c:164 where inodes not synced to disk
don't get fully marked as clean. Here's how to reproduce it:
# mount -o loop -t bfs /bfs.img /mnt
# df -i /mnt
FilesystemInodes IUsed IFree IUse% Mounted on
/bfs.img 48 1 473% /mnt
# df -k /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/bfs.img 512 5 508 1% /mnt
# cp 60k-archive.zip /mnt/mt.zip
# df -k /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/bfs.img 51265 447 13% /mnt
# df -i /mnt
FilesystemInodes IUsed IFree IUse% Mounted on
/bfs.img 48 2 465% /mnt
# rm /mnt/mt.zip
# echo $?
0
[If the unlink happens before the buffers flush, the following happens:]
# df -i /mnt
FilesystemInodes IUsed IFree IUse% Mounted on
/bfs.img 48 2 465% /mnt
# df -k /mnt
Filesystem 1K-blocks Used Available Use% Mounted on
/bfs.img 51265 447 13% /mnt
fs/bfs/bfs.h |1
fs/bfs/dir.c | 25 ++--
fs/bfs/file.c | 23 ++-
fs/bfs/inode.c | 100 ++---
include/linux/bfs_fs.h | 23 +--
5 files changed, 92 insertions(+), 80 deletions(-)
Signed-off-by: Andrew Stribblehill [EMAIL PROTECTED]
--- kernel/fs/bfs/bfs.h 2005-09-02 13:23:24.0 +0100
+++ kernel/fs/bfs/bfs.h 2005-09-02 15:01:52.0 +0100
@@ -20,7 +20,6 @@
unsigned long si_lasti;
unsigned long * si_imap;
struct buffer_head * si_sbh;/* buffer header w/superblock */
- struct bfs_super_block * si_bfs_sb; /* superblock in si_sbh-b_data
*/
};
/*
--- kernel/fs/bfs/dir.c 2005-09-02 13:23:24.0 +0100
+++ kernel/fs/bfs/dir.c 2005-09-02 15:01:52.0 +0100
@@ -2,6 +2,7 @@
* fs/bfs/dir.c
* BFS directory operations.
* Copyright (C) 1999,2000 Tigran Aivazian [EMAIL PROTECTED]
+ * Made endianness-clean by Andrew Stribblehill [EMAIL PROTECTED] 2005
*/
#include linux/time.h
@@ -20,9 +21,9 @@
#define dprintf(x...)
#endif
-static int bfs_add_entry(struct inode * dir, const char * name, int namelen,
int ino);
+static int bfs_add_entry(struct inode * dir, const unsigned char * name, int
namelen, int ino);
static struct buffer_head * bfs_find_entry(struct inode * dir,
- const char * name, int namelen, struct bfs_dirent ** res_dir);
+ const unsigned char * name, int namelen, struct bfs_dirent ** res_dir);
static int bfs_readdir(struct file * f, void * dirent, filldir_t filldir)
{
@@ -53,7 +54,7 @@
de = (struct bfs_dirent *)(bh-b_data + offset);
if (de-ino) {
int size = strnlen(de-name, BFS_NAMELEN);
- if (filldir(dirent, de-name, size, f-f_pos,
de-ino, DT_UNKNOWN) 0) {
+ if (filldir(dirent, de-name, size, f-f_pos,
le16_to_cpu(de-ino), DT_UNKNOWN) 0) {
brelse(bh);
unlock_kernel();
return 0;
@@ -107,7 +108,7 @@
inode-i_mapping-a_ops = bfs_aops;
inode-i_mode = mode;
inode-i_ino = ino;
- BFS_I(inode)-i_dsk_ino = ino;
+ BFS_I(inode)-i_dsk_ino = cpu_to_le16(ino);
BFS_I(inode)-i_sblock = 0;
BFS_I(inode)-i_eblock = 0;
insert_inode_hash(inode);
@@ -139,7 +140,7 @@
lock_kernel();
bh = bfs_find_entry(dir, dentry-d_name.name, dentry-d_name.len, de);
if (bh) {
- unsigned long ino = le32_to_cpu(de-ino);
+ unsigned long ino = (unsigned long)le16_to_cpu(de-ino);
brelse(bh);
inode = iget(dir-i_sb, ino);
if (!inode) {
@@ -183,7 +184,7 @@
inode = dentry-d_inode;
lock_kernel();
bh = bfs_find_entry(dir, dentry-d_name.name, dentry-d_name.len, de);
- if (!bh || de-ino != inode-i_ino)
+ if (!bh || le16_to_cpu(de-ino) != inode-i_ino)
goto out_brelse;
if (!inode-i_nlink) {
@@ -224,7 +225,7 @@
old_dentry-d_name.name,
old_dentry-d_name.len, old_de);
- if (!old_bh || old_de-ino != old_inode-i_ino)
+ if (!old_bh || le16_to_cpu(old_de-ino) != old_inode-i_ino)
goto end_rename;
error = -EPERM;
@@ -270,7 +271,7 @@
.rename = bfs_rename,
};
-static int bfs_add_entry(struct inode * dir, const char * name, int namelen,
int ino)
+static int bfs_add_entry(struct inode * dir, const unsigned char * name, int
namelen, int ino)
{