From c6b0a9f87b82f25fa35206ec04b5160372eabab4 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 6 Oct 2006 00:44:05 -0700 Subject: [PATCH] knfsd: tidy up up meaning of 'buffer size' in nfsd/sunrpc There is some confusion about the meaning of 'bufsz' for a sunrpc server. In some cases it is the largest message that can be sent or received. In other cases it is the largest 'payload' that can be included in a NFS message. In either case, it is not possible for both the request and the reply to be this large. One of the request or reply may only be one page long, which fits nicely with NFS. So we remove 'bufsz' and replace it with two numbers: 'max_payload' and 'max_mesg'. Max_payload is the size that the server requests. It is used by the server to check the max size allowed on a particular connection: depending on the protocol a lower limit might be used. max_mesg is the largest single message that can be sent or received. It is calculated as the max_payload, rounded up to a multiple of PAGE_SIZE, and with PAGE_SIZE added to overhead. Only one of the request and reply may be this size. The other must be at most one page. Cc: Greg Banks Cc: "J. Bruce Fields" Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/nfsd/nfssvc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 6fa6340..013b389 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c @@ -217,7 +217,7 @@ int nfsd_create_serv(void) atomic_set(&nfsd_busy, 0); nfsd_serv = svc_create_pooled(&nfsd_program, - NFSD_BUFSIZE - NFSSVC_MAXBLKSIZE + nfsd_max_blksize, + nfsd_max_blksize, nfsd_last_thread, nfsd, SIG_NOCLEAN, THIS_MODULE); if (nfsd_serv == NULL) -- cgit v1.1 From 00079e04fe478cd3c59ae2106ef2fbe779e67024 Mon Sep 17 00:00:00 2001 From: Eric Eric Sesterhenn Date: Fri, 6 Oct 2006 22:19:45 -0700 Subject: [PATCH] reiserfs: null pointer dereferencing in reiserfs_read_bitmap_block null pointer dereferencing in reiserfs_read_bitmap_block. Signed-off-by: Alexander Zarochentsev Cc: Jeff Mahoney Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/reiserfs/bitmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs') diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index 1bfae42..e3d466a 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c @@ -1304,8 +1304,8 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, bh = sb_bread(sb, block); if (bh == NULL) - reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%lu) " - "reading failed", __FUNCTION__, bh->b_blocknr); + reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%u) " + "reading failed", __FUNCTION__, block); else { if (buffer_locked(bh)) { PROC_INFO_INC(sb, scan_bitmap.wait); -- cgit v1.1 From ca4aa09635516258f158a7bc1594a794e4c34864 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Sun, 8 Oct 2006 14:33:24 -0400 Subject: [PATCH] NFS: Fix typo in nfs_get_client() NFS_CS_INITING > NFS_CS_READY, so instead of waiting for the structure to get initialised, we currently immediately jump out of the loop without ever sleeping. Signed-off-by: Trond Myklebust Signed-off-by: Linus Torvalds --- fs/nfs/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 6e4e48c..d2533e2 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -330,7 +330,7 @@ found_client: for (;;) { set_current_state(TASK_INTERRUPTIBLE); if (signal_pending(current) || - clp->cl_cons_state > NFS_CS_READY) + clp->cl_cons_state != NFS_CS_INITING) break; schedule(); } -- cgit v1.1 From 0bae89ec8b1519dae67036637942f5b5bbaa9424 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Sun, 8 Oct 2006 14:33:24 -0400 Subject: [PATCH] NFS: Fix typo in nfs_get_client() Commit ca4aa09635516258f158a7bc1594a794e4c34864 fixed waiting for the structure to get initialised, but it is also possible to break out of the loop while still in TASK_INTERRUPTIBLE. Replace the whole thing by wait_event_interruptible, which is much more readable, and doesn't suffer from these problems. Signed-off-by: Trond Myklebust Signed-off-by: Linus Torvalds --- fs/nfs/client.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'fs') diff --git a/fs/nfs/client.c b/fs/nfs/client.c index d2533e2..013cdbc 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -322,25 +322,11 @@ found_client: if (new) nfs_free_client(new); - if (clp->cl_cons_state == NFS_CS_INITING) { - DECLARE_WAITQUEUE(myself, current); - - add_wait_queue(&nfs_client_active_wq, &myself); - - for (;;) { - set_current_state(TASK_INTERRUPTIBLE); - if (signal_pending(current) || - clp->cl_cons_state != NFS_CS_INITING) - break; - schedule(); - } - - remove_wait_queue(&nfs_client_active_wq, &myself); - - if (signal_pending(current)) { - nfs_put_client(clp); - return ERR_PTR(-ERESTARTSYS); - } + error = wait_event_interruptible(&nfs_client_active_wq, + clp->cl_cons_state != NFS_CS_INITING); + if (error < 0) { + nfs_put_client(clp); + return ERR_PTR(-ERESTARTSYS); } if (clp->cl_cons_state < NFS_CS_READY) { -- cgit v1.1 From 832504933757ba7913bf64cd574326e014215b41 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 8 Oct 2006 17:28:25 -0700 Subject: Fix extraneous '&' in recent NFS client cleanup We should pass "wait_event_interruptible()" the wait-queue itself, not the pointer to it. The magic macro will pointerize it internally. Signed-off-by: Linus Torvalds --- fs/nfs/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 013cdbc..34c3996 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -322,7 +322,7 @@ found_client: if (new) nfs_free_client(new); - error = wait_event_interruptible(&nfs_client_active_wq, + error = wait_event_interruptible(nfs_client_active_wq, clp->cl_cons_state != NFS_CS_INITING); if (error < 0) { nfs_put_client(clp); -- cgit v1.1 From 5c09d96b34ac9b95ab4606e51ddb34ed0f19faf1 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 9 Oct 2006 20:24:49 +0100 Subject: [PATCH] wrong order of arguments in copy_to_user() in ncpfs Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/ncpfs/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/ncpfs/ioctl.c b/fs/ncpfs/ioctl.c index a89ac84..589d1ea 100644 --- a/fs/ncpfs/ioctl.c +++ b/fs/ncpfs/ioctl.c @@ -726,7 +726,7 @@ outrel: struct compat_ncp_privatedata_ioctl user32; user32.len = user.len; user32.data = (unsigned long) user.data; - if (copy_to_user(&user32, argp, sizeof(user32))) + if (copy_to_user(argp, &user32, sizeof(user32))) return -EFAULT; } else #endif -- cgit v1.1 From 38d6fd26ea7f291141039fe340a581dc6f770fc0 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 9 Oct 2006 20:27:30 +0100 Subject: [PATCH] dlm gfp_t annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/dlm/lowcomms.c | 6 +++--- fs/dlm/lowcomms.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'fs') diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 23f5ce1..7bcea7c 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -174,7 +174,7 @@ static int nodeid_to_addr(int nodeid, struct sockaddr *retaddr) return 0; } -static struct nodeinfo *nodeid2nodeinfo(int nodeid, int alloc) +static struct nodeinfo *nodeid2nodeinfo(int nodeid, gfp_t alloc) { struct nodeinfo *ni; int r; @@ -726,7 +726,7 @@ static int init_sock(void) } -static struct writequeue_entry *new_writequeue_entry(int allocation) +static struct writequeue_entry *new_writequeue_entry(gfp_t allocation) { struct writequeue_entry *entry; @@ -748,7 +748,7 @@ static struct writequeue_entry *new_writequeue_entry(int allocation) return entry; } -void *dlm_lowcomms_get_buffer(int nodeid, int len, int allocation, char **ppc) +void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc) { struct writequeue_entry *e; int offset = 0; diff --git a/fs/dlm/lowcomms.h b/fs/dlm/lowcomms.h index 6c04bb0..2d045e0 100644 --- a/fs/dlm/lowcomms.h +++ b/fs/dlm/lowcomms.h @@ -19,7 +19,7 @@ void dlm_lowcomms_exit(void); int dlm_lowcomms_start(void); void dlm_lowcomms_stop(void); int dlm_lowcomms_close(int nodeid); -void *dlm_lowcomms_get_buffer(int nodeid, int len, int allocation, char **ppc); +void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc); void dlm_lowcomms_commit_buffer(void *mh); #endif /* __LOWCOMMS_DOT_H__ */ -- cgit v1.1 From c8adf94a4806b4ae49a3057d434471a0b01096e3 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 9 Oct 2006 20:26:58 +0100 Subject: [PATCH] hppfs: readdir callback missed in prototype change Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/hppfs/hppfs_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/hppfs/hppfs_kern.c b/fs/hppfs/hppfs_kern.c index dcb6d2e..642675f 100644 --- a/fs/hppfs/hppfs_kern.c +++ b/fs/hppfs/hppfs_kern.c @@ -572,7 +572,7 @@ struct hppfs_dirent { }; static int hppfs_filldir(void *d, const char *name, int size, - loff_t offset, ino_t inode, unsigned int type) + loff_t offset, u64 inode, unsigned int type) { struct hppfs_dirent *dirent = d; -- cgit v1.1 From 659564c8adfe1765476beee8d55cd18986946892 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 9 Oct 2006 16:10:48 -0400 Subject: [PATCH] Introduce vfs_listxattr This patch moves code out of fs/xattr.c:listxattr into a new function - vfs_listxattr. The code for vfs_listxattr was originally submitted by Bill Nottingham to Unionfs. Sorry about that. The reason for this submission is to make the listxattr code in fs/xattr.c a little cleaner (as well as to clean up some code in Unionfs.) Currently, Unionfs has vfs_listxattr defined in its code. I think that's very ugly, and I'd like to see it (re)moved. The logical place to put it, is along side of all the other vfs_*xattr functions. Overall, I think this patch is benefitial for both kernel.org kernel and Unionfs. Signed-off-by: Josef "Jeff" Sipek Acked-by: Al Viro Signed-off-by: Linus Torvalds --- fs/xattr.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'fs') diff --git a/fs/xattr.c b/fs/xattr.c index c32f15b..3956351 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -135,6 +135,26 @@ vfs_getxattr(struct dentry *dentry, char *name, void *value, size_t size) } EXPORT_SYMBOL_GPL(vfs_getxattr); +ssize_t +vfs_listxattr(struct dentry *d, char *list, size_t size) +{ + ssize_t error; + + error = security_inode_listxattr(d); + if (error) + return error; + error = -EOPNOTSUPP; + if (d->d_inode->i_op && d->d_inode->i_op->listxattr) { + error = d->d_inode->i_op->listxattr(d, list, size); + } else { + error = security_inode_listsecurity(d->d_inode, list, size); + if (size && error > size) + error = -ERANGE; + } + return error; +} +EXPORT_SYMBOL_GPL(vfs_listxattr); + int vfs_removexattr(struct dentry *dentry, char *name) { @@ -346,17 +366,7 @@ listxattr(struct dentry *d, char __user *list, size_t size) return -ENOMEM; } - error = security_inode_listxattr(d); - if (error) - goto out; - error = -EOPNOTSUPP; - if (d->d_inode->i_op && d->d_inode->i_op->listxattr) { - error = d->d_inode->i_op->listxattr(d, klist, size); - } else { - error = security_inode_listsecurity(d->d_inode, klist, size); - if (size && error > size) - error = -ERANGE; - } + error = vfs_listxattr(d, klist, size); if (error > 0) { if (size && copy_to_user(list, klist, error)) error = -EFAULT; @@ -365,7 +375,6 @@ listxattr(struct dentry *d, char __user *list, size_t size) than XATTR_LIST_MAX bytes. Not possible. */ error = -E2BIG; } -out: kfree(klist); return error; } -- cgit v1.1 From ebf7a227dd1d810203a19642655d2fa293f395dd Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Tue, 10 Oct 2006 04:36:54 +0200 Subject: [PATCH] mm: bug in set_page_dirty_buffers This was triggered, but not the fault of, the dirty page accounting patches. Suitable for -stable as well, after it goes upstream. Unable to handle kernel NULL pointer dereference at virtual address 0000004c EIP is at _spin_lock+0x12/0x66 Call Trace: [<401766e7>] __set_page_dirty_buffers+0x15/0xc0 [<401401e7>] set_page_dirty+0x2c/0x51 [<40140db2>] set_page_dirty_balance+0xb/0x3b [<40145d29>] __do_fault+0x1d8/0x279 [<40147059>] __handle_mm_fault+0x125/0x951 [<401133f1>] do_page_fault+0x440/0x59f [<4034d0c1>] error_code+0x39/0x40 [<08048a33>] 0x8048a33 Signed-off-by: Nick Piggin Signed-off-by: Linus Torvalds --- fs/buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/buffer.c b/fs/buffer.c index 16cfbcd..eeb8ac1 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -701,7 +701,10 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode); */ int __set_page_dirty_buffers(struct page *page) { - struct address_space * const mapping = page->mapping; + struct address_space * const mapping = page_mapping(page); + + if (unlikely(!mapping)) + return !TestSetPageDirty(page); spin_lock(&mapping->private_lock); if (page_has_buffers(page)) { -- cgit v1.1 From 90cbad65911b5952a03111423347a6ab38236e0b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 10 Oct 2006 22:44:17 +0100 Subject: [PATCH] more fs/compat.c __user annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/compat.c b/fs/compat.c index 4d3fbcb..50624d4 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -1316,7 +1316,7 @@ compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32, unsigned int nr_segs, unsigned int flags) { unsigned i; - struct iovec *iov; + struct iovec __user *iov; if (nr_segs > UIO_MAXIOV) return -EINVAL; iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec)); -- cgit v1.1 From e6c6e640b8b258dc7f60533e81f050d15fc0a9af Mon Sep 17 00:00:00 2001 From: Al Viro Date: Tue, 10 Oct 2006 22:48:47 +0100 Subject: [PATCH] fs/inode.c NULL noise removal Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/inode.c b/fs/inode.c index bf6bec4..d9a21d1 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -162,7 +162,7 @@ static struct inode *alloc_inode(struct super_block *sb) bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info; mapping->backing_dev_info = bdi; } - inode->i_private = 0; + inode->i_private = NULL; inode->i_mapping = mapping; } return inode; -- cgit v1.1 From 88c124d847d0fc60531e45323752665b01fc14f0 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 23 Dec 2005 20:56:46 -0500 Subject: [PATCH] befs: remove bogus typedef Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/befs/befs_fs_types.h | 1 - 1 file changed, 1 deletion(-) (limited to 'fs') diff --git a/fs/befs/befs_fs_types.h b/fs/befs/befs_fs_types.h index 63ef1e1..d124b4c 100644 --- a/fs/befs/befs_fs_types.h +++ b/fs/befs/befs_fs_types.h @@ -81,7 +81,6 @@ enum inode_flags { typedef u64 befs_off_t; typedef u64 befs_time_t; -typedef void befs_binode_etc; /* Block runs */ typedef struct { -- cgit v1.1 From af10b0084dff530fb7232a0f8bbc4499e9c58574 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 24 Dec 2005 01:13:13 -0500 Subject: [PATCH] befs: prepare to sanitizing headers pulled includes of endian.h from fs/befs/*.c to befs.h Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/befs/befs.h | 2 ++ fs/befs/btree.c | 1 - fs/befs/datastream.c | 1 - fs/befs/debug.c | 1 - fs/befs/endian.h | 1 - fs/befs/inode.c | 1 - fs/befs/linuxvfs.c | 1 - fs/befs/super.c | 1 - 8 files changed, 2 insertions(+), 7 deletions(-) (limited to 'fs') diff --git a/fs/befs/befs.h b/fs/befs/befs.h index 057a2c3..c400bb6 100644 --- a/fs/befs/befs.h +++ b/fs/befs/befs.h @@ -151,4 +151,6 @@ befs_brun_size(struct super_block *sb, befs_block_run run) return BEFS_SB(sb)->block_size * run.len; } +#include "endian.h" + #endif /* _LINUX_BEFS_H */ diff --git a/fs/befs/btree.c b/fs/befs/btree.c index 76e2197..12e0fd6 100644 --- a/fs/befs/btree.c +++ b/fs/befs/btree.c @@ -30,7 +30,6 @@ #include "befs.h" #include "btree.h" #include "datastream.h" -#include "endian.h" /* * The btree functions in this file are built on top of the diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index b7d6b92..67335e2 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c @@ -18,7 +18,6 @@ #include "befs.h" #include "datastream.h" #include "io.h" -#include "endian.h" const befs_inode_addr BAD_IADDR = { 0, 0, 0 }; diff --git a/fs/befs/debug.c b/fs/befs/debug.c index 875cc0a..3afd088 100644 --- a/fs/befs/debug.c +++ b/fs/befs/debug.c @@ -21,7 +21,6 @@ #endif /* __KERNEL__ */ #include "befs.h" -#include "endian.h" #define ERRBUFSIZE 1024 diff --git a/fs/befs/endian.h b/fs/befs/endian.h index 9ecaea4..d77a26e 100644 --- a/fs/befs/endian.h +++ b/fs/befs/endian.h @@ -10,7 +10,6 @@ #define LINUX_BEFS_ENDIAN #include -#include "befs.h" static inline u64 fs64_to_cpu(const struct super_block *sb, u64 n) diff --git a/fs/befs/inode.c b/fs/befs/inode.c index d41c924..94c17f9 100644 --- a/fs/befs/inode.c +++ b/fs/befs/inode.c @@ -8,7 +8,6 @@ #include "befs.h" #include "inode.h" -#include "endian.h" /* Validates the correctness of the befs inode diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index 57020c7..07f7144 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c @@ -22,7 +22,6 @@ #include "datastream.h" #include "super.h" #include "io.h" -#include "endian.h" MODULE_DESCRIPTION("BeOS File System (BeFS) driver"); MODULE_AUTHOR("Will Dyson"); diff --git a/fs/befs/super.c b/fs/befs/super.c index 4557acb..8c3401f 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c @@ -11,7 +11,6 @@ #include "befs.h" #include "super.h" -#include "endian.h" /** * load_befs_sb -- Read from disk and properly byteswap all the fields -- cgit v1.1 From 1151895f8076584e061092afffb110b90cb38a68 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 24 Dec 2005 01:32:03 -0500 Subject: [PATCH] befs: introduce on-disk endian types Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/befs/befs_fs_types.h | 4 ++++ fs/befs/endian.h | 36 ++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) (limited to 'fs') diff --git a/fs/befs/befs_fs_types.h b/fs/befs/befs_fs_types.h index d124b4c..128066b 100644 --- a/fs/befs/befs_fs_types.h +++ b/fs/befs/befs_fs_types.h @@ -79,6 +79,10 @@ enum inode_flags { * On-Disk datastructures of BeFS */ +typedef u64 __bitwise fs64; +typedef u32 __bitwise fs32; +typedef u16 __bitwise fs16; + typedef u64 befs_off_t; typedef u64 befs_time_t; diff --git a/fs/befs/endian.h b/fs/befs/endian.h index d77a26e..979c543 100644 --- a/fs/befs/endian.h +++ b/fs/befs/endian.h @@ -12,57 +12,57 @@ #include static inline u64 -fs64_to_cpu(const struct super_block *sb, u64 n) +fs64_to_cpu(const struct super_block *sb, fs64 n) { if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) - return le64_to_cpu(n); + return le64_to_cpu((__force __le64)n); else - return be64_to_cpu(n); + return be64_to_cpu((__force __be64)n); } -static inline u64 +static inline fs64 cpu_to_fs64(const struct super_block *sb, u64 n) { if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) - return cpu_to_le64(n); + return (__force fs64)cpu_to_le64(n); else - return cpu_to_be64(n); + return (__force fs64)cpu_to_be64(n); } static inline u32 -fs32_to_cpu(const struct super_block *sb, u32 n) +fs32_to_cpu(const struct super_block *sb, fs32 n) { if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) - return le32_to_cpu(n); + return le32_to_cpu((__force __le32)n); else - return be32_to_cpu(n); + return be32_to_cpu((__force __be32)n); } -static inline u32 +static inline fs32 cpu_to_fs32(const struct super_block *sb, u32 n) { if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) - return cpu_to_le32(n); + return (__force fs32)cpu_to_le32(n); else - return cpu_to_be32(n); + return (__force fs32)cpu_to_be32(n); } static inline u16 -fs16_to_cpu(const struct super_block *sb, u16 n) +fs16_to_cpu(const struct super_block *sb, fs16 n) { if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) - return le16_to_cpu(n); + return le16_to_cpu((__force __le16)n); else - return be16_to_cpu(n); + return be16_to_cpu((__force __be16)n); } -static inline u16 +static inline fs16 cpu_to_fs16(const struct super_block *sb, u16 n) { if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) - return cpu_to_le16(n); + return (__force fs16)cpu_to_le16(n); else - return cpu_to_be16(n); + return (__force fs16)cpu_to_be16(n); } /* Composite types below here */ -- cgit v1.1 From e5201c58cd81066ecd0210bcc6c02e71200040a3 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 24 Dec 2005 03:09:03 -0500 Subject: [PATCH] befs: missing fs32_to_cpu() in debug.c inode->mode is disk-endian Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/befs/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/befs/debug.c b/fs/befs/debug.c index 3afd088..bb68370 100644 --- a/fs/befs/debug.c +++ b/fs/befs/debug.c @@ -124,7 +124,7 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode) befs_debug(sb, " type %08x", fs32_to_cpu(sb, inode->type)); befs_debug(sb, " inode_size %u", fs32_to_cpu(sb, inode->inode_size)); - if (S_ISLNK(inode->mode)) { + if (S_ISLNK(fs32_to_cpu(sb, inode->mode))) { befs_debug(sb, " Symbolic link [%s]", inode->data.symlink); } else { int i; -- cgit v1.1 From a9721f3152bc2be6702807705902e06abdd6e3bb Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 24 Dec 2005 14:28:55 -0500 Subject: [PATCH] befs: endianness annotations split the data structures that exist in host- and disk-endian variants, annotate the fields of disk-endian ones, propagate changes. Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/befs/befs.h | 4 +- fs/befs/befs_fs_types.h | 107 ++++++++++++++++++++++++++++++++---------------- fs/befs/btree.c | 28 ++++++------- fs/befs/datastream.c | 10 ++--- fs/befs/debug.c | 9 ++-- fs/befs/endian.h | 20 ++++----- 6 files changed, 106 insertions(+), 72 deletions(-) (limited to 'fs') diff --git a/fs/befs/befs.h b/fs/befs/befs.h index c400bb6..d9a40ab 100644 --- a/fs/befs/befs.h +++ b/fs/befs/befs.h @@ -94,7 +94,7 @@ void befs_debug(const struct super_block *sb, const char *fmt, ...); void befs_dump_super_block(const struct super_block *sb, befs_super_block *); void befs_dump_inode(const struct super_block *sb, befs_inode *); -void befs_dump_index_entry(const struct super_block *sb, befs_btree_super *); +void befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super *); void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *); /****************************/ @@ -136,7 +136,7 @@ blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno) static inline unsigned int befs_iaddrs_per_block(struct super_block *sb) { - return BEFS_SB(sb)->block_size / sizeof (befs_inode_addr); + return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr); } static inline int diff --git a/fs/befs/befs_fs_types.h b/fs/befs/befs_fs_types.h index 128066b..e2595c2 100644 --- a/fs/befs/befs_fs_types.h +++ b/fs/befs/befs_fs_types.h @@ -84,15 +84,22 @@ typedef u32 __bitwise fs32; typedef u16 __bitwise fs16; typedef u64 befs_off_t; -typedef u64 befs_time_t; +typedef fs64 befs_time_t; /* Block runs */ typedef struct { + fs32 allocation_group; + fs16 start; + fs16 len; +} PACKED befs_disk_block_run; + +typedef struct { u32 allocation_group; u16 start; u16 len; } PACKED befs_block_run; +typedef befs_disk_block_run befs_disk_inode_addr; typedef befs_block_run befs_inode_addr; /* @@ -100,31 +107,31 @@ typedef befs_block_run befs_inode_addr; */ typedef struct { char name[B_OS_NAME_LENGTH]; - u32 magic1; - u32 fs_byte_order; + fs32 magic1; + fs32 fs_byte_order; - u32 block_size; - u32 block_shift; + fs32 block_size; + fs32 block_shift; - befs_off_t num_blocks; - befs_off_t used_blocks; + fs64 num_blocks; + fs64 used_blocks; - u32 inode_size; + fs32 inode_size; - u32 magic2; - u32 blocks_per_ag; - u32 ag_shift; - u32 num_ags; + fs32 magic2; + fs32 blocks_per_ag; + fs32 ag_shift; + fs32 num_ags; - u32 flags; + fs32 flags; - befs_block_run log_blocks; - befs_off_t log_start; - befs_off_t log_end; + befs_disk_block_run log_blocks; + fs64 log_start; + fs64 log_end; - u32 magic3; - befs_inode_addr root_dir; - befs_inode_addr indices; + fs32 magic3; + befs_disk_inode_addr root_dir; + befs_disk_inode_addr indices; } PACKED befs_super_block; @@ -133,6 +140,16 @@ typedef struct { * be longer than one block! */ typedef struct { + befs_disk_block_run direct[BEFS_NUM_DIRECT_BLOCKS]; + fs64 max_direct_range; + befs_disk_block_run indirect; + fs64 max_indirect_range; + befs_disk_block_run double_indirect; + fs64 max_double_indirect_range; + fs64 size; +} PACKED befs_disk_data_stream; + +typedef struct { befs_block_run direct[BEFS_NUM_DIRECT_BLOCKS]; befs_off_t max_direct_range; befs_block_run indirect; @@ -144,35 +161,35 @@ typedef struct { /* Attribute */ typedef struct { - u32 type; - u16 name_size; - u16 data_size; + fs32 type; + fs16 name_size; + fs16 data_size; char name[1]; } PACKED befs_small_data; /* Inode structure */ typedef struct { - u32 magic1; - befs_inode_addr inode_num; - u32 uid; - u32 gid; - u32 mode; - u32 flags; + fs32 magic1; + befs_disk_inode_addr inode_num; + fs32 uid; + fs32 gid; + fs32 mode; + fs32 flags; befs_time_t create_time; befs_time_t last_modified_time; - befs_inode_addr parent; - befs_inode_addr attributes; - u32 type; + befs_disk_inode_addr parent; + befs_disk_inode_addr attributes; + fs32 type; - u32 inode_size; - u32 etc; /* not use */ + fs32 inode_size; + fs32 etc; /* not use */ union { - befs_data_stream datastream; + befs_disk_data_stream datastream; char symlink[BEFS_SYMLINK_LEN]; } data; - u32 pad[4]; /* not use */ + fs32 pad[4]; /* not use */ befs_small_data small_data[1]; } PACKED befs_inode; @@ -193,6 +210,16 @@ enum btree_types { }; typedef struct { + fs32 magic; + fs32 node_size; + fs32 max_depth; + fs32 data_type; + fs64 root_node_ptr; + fs64 free_node_ptr; + fs64 max_size; +} PACKED befs_disk_btree_super; + +typedef struct { u32 magic; u32 node_size; u32 max_depth; @@ -206,11 +233,19 @@ typedef struct { * Header stucture of each btree node */ typedef struct { + fs64 left; + fs64 right; + fs64 overflow; + fs16 all_key_count; + fs16 all_key_length; +} PACKED befs_btree_nodehead; + +typedef struct { befs_off_t left; befs_off_t right; befs_off_t overflow; u16 all_key_count; u16 all_key_length; -} PACKED befs_btree_nodehead; +} PACKED befs_host_btree_nodehead; #endif /* _LINUX_BEFS_FS_TYPES */ diff --git a/fs/befs/btree.c b/fs/befs/btree.c index 12e0fd6..81b042e 100644 --- a/fs/befs/btree.c +++ b/fs/befs/btree.c @@ -79,7 +79,7 @@ * In memory structure of each btree node */ typedef struct { - befs_btree_nodehead head; /* head of node converted to cpu byteorder */ + befs_host_btree_nodehead head; /* head of node converted to cpu byteorder */ struct buffer_head *bh; befs_btree_nodehead *od_node; /* on disk node */ } befs_btree_node; @@ -101,9 +101,9 @@ static int befs_bt_read_node(struct super_block *sb, befs_data_stream * ds, static int befs_leafnode(befs_btree_node * node); -static u16 *befs_bt_keylen_index(befs_btree_node * node); +static fs16 *befs_bt_keylen_index(befs_btree_node * node); -static befs_off_t *befs_bt_valarray(befs_btree_node * node); +static fs64 *befs_bt_valarray(befs_btree_node * node); static char *befs_bt_keydata(befs_btree_node * node); @@ -135,7 +135,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds, befs_btree_super * sup) { struct buffer_head *bh = NULL; - befs_btree_super *od_sup = NULL; + befs_disk_btree_super *od_sup = NULL; befs_debug(sb, "---> befs_btree_read_super()"); @@ -145,7 +145,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds, befs_error(sb, "Couldn't read index header."); goto error; } - od_sup = (befs_btree_super *) bh->b_data; + od_sup = (befs_disk_btree_super *) bh->b_data; befs_dump_index_entry(sb, od_sup); sup->magic = fs32_to_cpu(sb, od_sup->magic); @@ -341,7 +341,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node, u16 keylen; int findkey_len; char *thiskey; - befs_off_t *valarray; + fs64 *valarray; befs_debug(sb, "---> befs_find_key() %s", findkey); @@ -421,7 +421,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds, befs_btree_super bt_super; befs_off_t node_off = 0; int cur_key; - befs_off_t *valarray; + fs64 *valarray; char *keystart; u16 keylen; int res; @@ -571,7 +571,7 @@ befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds, this_node->head.overflow); *node_off = this_node->head.overflow; } else { - befs_off_t *valarray = befs_bt_valarray(this_node); + fs64 *valarray = befs_bt_valarray(this_node); *node_off = fs64_to_cpu(sb, valarray[0]); } if (befs_bt_read_node(sb, ds, this_node, *node_off) != BEFS_OK) { @@ -621,7 +621,7 @@ befs_leafnode(befs_btree_node * node) * * Except that rounding up to 8 works, and rounding up to 4 doesn't. */ -static u16 * +static fs16 * befs_bt_keylen_index(befs_btree_node * node) { const int keylen_align = 8; @@ -632,7 +632,7 @@ befs_bt_keylen_index(befs_btree_node * node) if (tmp) off += keylen_align - tmp; - return (u16 *) ((void *) node->od_node + off); + return (fs16 *) ((void *) node->od_node + off); } /** @@ -642,13 +642,13 @@ befs_bt_keylen_index(befs_btree_node * node) * Returns a pointer to the start of the value array * of the node pointed to by the node header */ -static befs_off_t * +static fs64 * befs_bt_valarray(befs_btree_node * node) { void *keylen_index_start = (void *) befs_bt_keylen_index(node); - size_t keylen_index_size = node->head.all_key_count * sizeof (u16); + size_t keylen_index_size = node->head.all_key_count * sizeof (fs16); - return (befs_off_t *) (keylen_index_start + keylen_index_size); + return (fs64 *) (keylen_index_start + keylen_index_size); } /** @@ -680,7 +680,7 @@ befs_bt_get_key(struct super_block *sb, befs_btree_node * node, { int prev_key_end; char *keystart; - u16 *keylen_index; + fs16 *keylen_index; if (index < 0 || index > node->head.all_key_count) { *keylen = 0; diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c index 67335e2..aacb4da 100644 --- a/fs/befs/datastream.c +++ b/fs/befs/datastream.c @@ -311,7 +311,7 @@ befs_find_brun_indirect(struct super_block *sb, befs_blocknr_t indir_start_blk; befs_blocknr_t search_blk; struct buffer_head *indirblock; - befs_block_run *array; + befs_disk_block_run *array; befs_block_run indirect = data->indirect; befs_blocknr_t indirblockno = iaddr2blockno(sb, &indirect); @@ -333,7 +333,7 @@ befs_find_brun_indirect(struct super_block *sb, return BEFS_ERR; } - array = (befs_block_run *) indirblock->b_data; + array = (befs_disk_block_run *) indirblock->b_data; for (j = 0; j < arraylen; ++j) { int len = fs16_to_cpu(sb, array[j].len); @@ -426,7 +426,7 @@ befs_find_brun_dblindirect(struct super_block *sb, struct buffer_head *dbl_indir_block; struct buffer_head *indir_block; befs_block_run indir_run; - befs_inode_addr *iaddr_array = NULL; + befs_disk_inode_addr *iaddr_array = NULL; befs_sb_info *befs_sb = BEFS_SB(sb); befs_blocknr_t indir_start_blk = @@ -481,7 +481,7 @@ befs_find_brun_dblindirect(struct super_block *sb, dbl_block_indx = dblindir_indx - (dbl_which_block * befs_iaddrs_per_block(sb)); - iaddr_array = (befs_inode_addr *) dbl_indir_block->b_data; + iaddr_array = (befs_disk_inode_addr *) dbl_indir_block->b_data; indir_run = fsrun_to_cpu(sb, iaddr_array[dbl_block_indx]); brelse(dbl_indir_block); iaddr_array = NULL; @@ -506,7 +506,7 @@ befs_find_brun_dblindirect(struct super_block *sb, } block_indx = indir_indx - (which_block * befs_iaddrs_per_block(sb)); - iaddr_array = (befs_inode_addr *) indir_block->b_data; + iaddr_array = (befs_disk_inode_addr *) indir_block->b_data; *run = fsrun_to_cpu(sb, iaddr_array[block_indx]); brelse(indir_block); iaddr_array = NULL; diff --git a/fs/befs/debug.c b/fs/befs/debug.c index bb68370..e831a8f 100644 --- a/fs/befs/debug.c +++ b/fs/befs/debug.c @@ -230,21 +230,20 @@ befs_dump_small_data(const struct super_block *sb, befs_small_data * sd) /* unused */ void -befs_dump_run(const struct super_block *sb, befs_block_run run) +befs_dump_run(const struct super_block *sb, befs_disk_block_run run) { #ifdef CONFIG_BEFS_DEBUG - run = fsrun_to_cpu(sb, run); + befs_block_run n = fsrun_to_cpu(sb, run); - befs_debug(sb, "[%u, %hu, %hu]", - run.allocation_group, run.start, run.len); + befs_debug(sb, "[%u, %hu, %hu]", n.allocation_group, n.start, n.len); #endif //CONFIG_BEFS_DEBUG } #endif /* 0 */ void -befs_dump_index_entry(const struct super_block *sb, befs_btree_super * super) +befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * super) { #ifdef CONFIG_BEFS_DEBUG diff --git a/fs/befs/endian.h b/fs/befs/endian.h index 979c543..e254a20 100644 --- a/fs/befs/endian.h +++ b/fs/befs/endian.h @@ -68,26 +68,26 @@ cpu_to_fs16(const struct super_block *sb, u16 n) /* Composite types below here */ static inline befs_block_run -fsrun_to_cpu(const struct super_block *sb, befs_block_run n) +fsrun_to_cpu(const struct super_block *sb, befs_disk_block_run n) { befs_block_run run; if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { - run.allocation_group = le32_to_cpu(n.allocation_group); - run.start = le16_to_cpu(n.start); - run.len = le16_to_cpu(n.len); + run.allocation_group = le32_to_cpu((__force __le32)n.allocation_group); + run.start = le16_to_cpu((__force __le16)n.start); + run.len = le16_to_cpu((__force __le16)n.len); } else { - run.allocation_group = be32_to_cpu(n.allocation_group); - run.start = be16_to_cpu(n.start); - run.len = be16_to_cpu(n.len); + run.allocation_group = be32_to_cpu((__force __be32)n.allocation_group); + run.start = be16_to_cpu((__force __be16)n.start); + run.len = be16_to_cpu((__force __be16)n.len); } return run; } -static inline befs_block_run +static inline befs_disk_block_run cpu_to_fsrun(const struct super_block *sb, befs_block_run n) { - befs_block_run run; + befs_disk_block_run run; if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { run.allocation_group = cpu_to_le32(n.allocation_group); @@ -102,7 +102,7 @@ cpu_to_fsrun(const struct super_block *sb, befs_block_run n) } static inline befs_data_stream -fsds_to_cpu(const struct super_block *sb, befs_data_stream n) +fsds_to_cpu(const struct super_block *sb, befs_disk_data_stream n) { befs_data_stream data; int i; -- cgit v1.1 From 31b1f85b71b0b69afba89a60989097cd805f13c3 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 24 Dec 2005 14:31:04 -0500 Subject: [PATCH] fs/fat endianness annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/fat/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 0457380..4613cb2 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c @@ -384,7 +384,7 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de) le16_to_cpu(de->cdate)) + secs; inode->i_ctime.tv_nsec = csecs * 10000000; inode->i_atime.tv_sec = - date_dos2unix(le16_to_cpu(0), le16_to_cpu(de->adate)); + date_dos2unix(0, le16_to_cpu(de->adate)); inode->i_atime.tv_nsec = 0; } else inode->i_ctime = inode->i_atime = inode->i_mtime; -- cgit v1.1 From 2ef1031282cd401b47a5f7f7477fe9ae69aff058 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 24 Dec 2005 14:31:53 -0500 Subject: [PATCH] hpfs endianness annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/hpfs/inode.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'fs') diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index bcf6ee3..7faef85 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c @@ -60,14 +60,14 @@ void hpfs_read_inode(struct inode *i) if (hpfs_sb(i->i_sb)->sb_eas) { if ((ea = hpfs_get_ea(i->i_sb, fnode, "UID", &ea_size))) { if (ea_size == 2) { - i->i_uid = le16_to_cpu(*(u16*)ea); + i->i_uid = le16_to_cpu(*(__le16*)ea); hpfs_inode->i_ea_uid = 1; } kfree(ea); } if ((ea = hpfs_get_ea(i->i_sb, fnode, "GID", &ea_size))) { if (ea_size == 2) { - i->i_gid = le16_to_cpu(*(u16*)ea); + i->i_gid = le16_to_cpu(*(__le16*)ea); hpfs_inode->i_ea_gid = 1; } kfree(ea); @@ -87,7 +87,7 @@ void hpfs_read_inode(struct inode *i) int rdev = 0; umode_t mode = hpfs_sb(sb)->sb_mode; if (ea_size == 2) { - mode = le16_to_cpu(*(u16*)ea); + mode = le16_to_cpu(*(__le16*)ea); hpfs_inode->i_ea_mode = 1; } kfree(ea); @@ -95,7 +95,7 @@ void hpfs_read_inode(struct inode *i) if (S_ISBLK(mode) || S_ISCHR(mode)) { if ((ea = hpfs_get_ea(i->i_sb, fnode, "DEV", &ea_size))) { if (ea_size == 4) - rdev = le32_to_cpu(*(u32*)ea); + rdev = le32_to_cpu(*(__le32*)ea); kfree(ea); } } @@ -148,7 +148,7 @@ static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode) we'd better not overwrite them hpfs_error(i->i_sb, "fnode %08x has some unknown HPFS386 stuctures", i->i_ino); } else*/ if (hpfs_sb(i->i_sb)->sb_eas >= 2) { - u32 ea; + __le32 ea; if ((i->i_uid != hpfs_sb(i->i_sb)->sb_uid) || hpfs_inode->i_ea_uid) { ea = cpu_to_le32(i->i_uid); hpfs_set_ea(i, fnode, "UID", (char*)&ea, 2); @@ -165,6 +165,7 @@ static void hpfs_write_inode_ea(struct inode *i, struct fnode *fnode) && i->i_mode != ((hpfs_sb(i->i_sb)->sb_mode & ~(S_ISDIR(i->i_mode) ? 0222 : 0333)) | (S_ISDIR(i->i_mode) ? S_IFDIR : S_IFREG))) || hpfs_inode->i_ea_mode) { ea = cpu_to_le32(i->i_mode); + /* sick, but legal */ hpfs_set_ea(i, fnode, "MODE", (char *)&ea, 2); hpfs_inode->i_ea_mode = 1; } -- cgit v1.1 From d02d48d8650bf3e2011f25373dbcf87f3c19f16b Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 24 Dec 2005 14:33:09 -0500 Subject: [PATCH] isofs endianness annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/isofs/joliet.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'fs') diff --git a/fs/isofs/joliet.c b/fs/isofs/joliet.c index 81a90e1..fb8fe7a 100644 --- a/fs/isofs/joliet.c +++ b/fs/isofs/joliet.c @@ -14,9 +14,9 @@ * Convert Unicode 16 to UTF-8 or ASCII. */ static int -uni16_to_x8(unsigned char *ascii, u16 *uni, int len, struct nls_table *nls) +uni16_to_x8(unsigned char *ascii, __be16 *uni, int len, struct nls_table *nls) { - wchar_t *ip, ch; + __be16 *ip, ch; unsigned char *op; ip = uni; @@ -24,8 +24,8 @@ uni16_to_x8(unsigned char *ascii, u16 *uni, int len, struct nls_table *nls) while ((ch = get_unaligned(ip)) && len) { int llen; - ch = be16_to_cpu(ch); - if ((llen = nls->uni2char(ch, op, NLS_MAX_CHARSET_SIZE)) > 0) + llen = nls->uni2char(be16_to_cpu(ch), op, NLS_MAX_CHARSET_SIZE); + if (llen > 0) op += llen; else *op++ = '?'; @@ -82,7 +82,7 @@ get_joliet_filename(struct iso_directory_record * de, unsigned char *outname, st len = wcsntombs_be(outname, de->name, de->name_len[0] >> 1, PAGE_SIZE); } else { - len = uni16_to_x8(outname, (u16 *) de->name, + len = uni16_to_x8(outname, (__be16 *) de->name, de->name_len[0] >> 1, nls); } if ((len > 2) && (outname[len-2] == ';') && (outname[len-1] == '1')) { -- cgit v1.1 From 3524de1c7953e7a22c43b9214ffc3680af6f8edb Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sat, 24 Dec 2005 14:39:13 -0500 Subject: [PATCH] fs/partitions endianness annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/partitions/msdos.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'fs') diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c index 4f8df71..8c7af17 100644 --- a/fs/partitions/msdos.c +++ b/fs/partitions/msdos.c @@ -32,13 +32,11 @@ #include #define SYS_IND(p) (get_unaligned(&p->sys_ind)) -#define NR_SECTS(p) ({ __typeof__(p->nr_sects) __a = \ - get_unaligned(&p->nr_sects); \ +#define NR_SECTS(p) ({ __le32 __a = get_unaligned(&p->nr_sects); \ le32_to_cpu(__a); \ }) -#define START_SECT(p) ({ __typeof__(p->start_sect) __a = \ - get_unaligned(&p->start_sect); \ +#define START_SECT(p) ({ __le32 __a = get_unaligned(&p->start_sect); \ le32_to_cpu(__a); \ }) -- cgit v1.1 From 44aa5359be589f9cbe9cf0d5c97e22b27a04c7d3 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 13 Aug 2006 01:54:30 -0400 Subject: [PATCH] ufs endianness annotations Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- fs/ufs/util.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'fs') diff --git a/fs/ufs/util.c b/fs/ufs/util.c index 22f820a..1743757 100644 --- a/fs/ufs/util.c +++ b/fs/ufs/util.c @@ -184,14 +184,13 @@ void _ubh_memcpyubh_(struct ufs_sb_private_info * uspi, dev_t ufs_get_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi) { - __fs32 fs32; + __u32 fs32; dev_t dev; if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86) - fs32 = ufsi->i_u1.i_data[1]; + fs32 = fs32_to_cpu(sb, ufsi->i_u1.i_data[1]); else - fs32 = ufsi->i_u1.i_data[0]; - fs32 = fs32_to_cpu(sb, fs32); + fs32 = fs32_to_cpu(sb, ufsi->i_u1.i_data[0]); switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { case UFS_ST_SUNx86: case UFS_ST_SUN: @@ -212,7 +211,7 @@ ufs_get_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi) void ufs_set_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi, dev_t dev) { - __fs32 fs32; + __u32 fs32; switch (UFS_SB(sb)->s_flags & UFS_ST_MASK) { case UFS_ST_SUNx86: @@ -227,11 +226,10 @@ ufs_set_inode_dev(struct super_block *sb, struct ufs_inode_info *ufsi, dev_t dev fs32 = old_encode_dev(dev); break; } - fs32 = cpu_to_fs32(sb, fs32); if ((UFS_SB(sb)->s_flags & UFS_ST_MASK) == UFS_ST_SUNx86) - ufsi->i_u1.i_data[1] = fs32; + ufsi->i_u1.i_data[1] = cpu_to_fs32(sb, fs32); else - ufsi->i_u1.i_data[0] = fs32; + ufsi->i_u1.i_data[0] = cpu_to_fs32(sb, fs32); } /** -- cgit v1.1