From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: Phillip Lougher <phillip@lougher.demon.co.uk>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 5/10] squashfs: (void*)ify read_blocklist
Date: Fri, 22 Apr 2005 09:20:37 +0200 [thread overview]
Message-ID: <20050422072037.GB10459@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <20050421011126.GD29755@wohnheim.fh-wedel.de>
Jörn
--
With a PC, I always felt limited by the software available. On Unix,
I am limited only by my knowledge.
-- Peter J. Schoenster
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
---
fs/squashfs/inode.c | 16 ++++++++++------
include/linux/squashfs_fs_sb.h | 6 +++---
2 files changed, 13 insertions(+), 9 deletions(-)
--- linux-2.6.12-rc3cow/fs/squashfs/inode.c~squashfs_cu5 2005-04-22 07:00:14.806604672 +0200
+++ linux-2.6.12-rc3cow/fs/squashfs/inode.c 2005-04-22 09:17:47.387021752 +0200
@@ -58,7 +58,7 @@ static struct dentry *squashfs_lookup(st
struct nameidata *);
static struct inode *squashfs_iget(struct super_block *s, squashfs_inode inode);
static unsigned int read_blocklist(struct inode *inode, int index,
- int readahead_blks, char *block_list,
+ int readahead_blks, void *block_list,
unsigned short **block_p, unsigned int *bsize);
static struct super_block *squashfs_get_sb(struct file_system_type *, int,
const char *, void *);
@@ -1116,7 +1116,7 @@ skip_read:
#define SIZE 256
static unsigned int read_blocklist(struct inode *inode, int index,
- int readahead_blks, char *block_list,
+ int readahead_blks, void *_block_list,
unsigned short **block_p, unsigned int *bsize)
{
squashfs_sb_info *msBlk = inode->i_sb->s_fs_info;
@@ -1125,6 +1125,7 @@ static unsigned int read_blocklist(struc
int block_ptr = SQUASHFS_I(inode)->block_list_start;
int offset = SQUASHFS_I(inode)->offset;
unsigned int block = SQUASHFS_I(inode)->start_block;
+ unsigned int *block_list = _block_list;
for (;;) {
int blocks = (index + readahead_blks - i);
@@ -1136,7 +1137,9 @@ static unsigned int read_blocklist(struc
}
if (msBlk->swap) {
- unsigned char sblock_list[SIZE];
+ unsigned int *sblock_list = kmalloc(SIZE, GFP_KERNEL);
+ if (!sblock_list)
+ return 0;
if (!squashfs_get_cached_block(inode->i_sb,
sblock_list, block_ptr,
@@ -1144,10 +1147,11 @@ static unsigned int read_blocklist(struc
&offset)) {
ERROR("Unable to read block list [%d:%x]\n",
block_ptr, offset);
+ kfree(sblock_list);
return 0;
}
- SQUASHFS_SWAP_INTS(((unsigned int *)block_list),
- ((unsigned int *)sblock_list), blocks);
+ SQUASHFS_SWAP_INTS(block_list, sblock_list, blocks);
+ kfree(sblock_list);
} else
if (!squashfs_get_cached_block(inode->i_sb,
block_list, block_ptr, offset,
@@ -1158,7 +1162,7 @@ static unsigned int read_blocklist(struc
return 0;
}
- for (block_listp = (unsigned int *) block_list; i < index &&
+ for (block_listp = block_list; i < index &&
blocks; i ++, block_listp ++, blocks --)
block += SQUASHFS_COMPRESSED_SIZE_BLOCK(*block_listp);
--- linux-2.6.12-rc3cow/include/linux/squashfs_fs_sb.h~squashfs_cu5 2005-04-22 07:00:14.693621848 +0200
+++ linux-2.6.12-rc3cow/include/linux/squashfs_fs_sb.h 2005-04-22 09:17:43.833561960 +0200
@@ -59,10 +59,10 @@ typedef struct squashfs_sb_info {
struct semaphore fragment_mutex;
wait_queue_head_t waitq;
wait_queue_head_t fragment_wait_queue;
- struct inode *(*iget)(struct super_block *s, squashfs_inode \
+ struct inode *(*iget)(struct super_block *s, squashfs_inode
inode);
- unsigned int (*read_blocklist)(struct inode *inode, int \
- index, int readahead_blks, char *block_list, \
+ unsigned int (*read_blocklist)(struct inode *inode, int
+ index, int readahead_blks, void *block_list,
unsigned short **block_p, unsigned int *bsize);
} squashfs_sb_info;
#endif
next prev parent reply other threads:[~2005-04-22 7:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-20 6:55 [PATCH] remove some usesless casts Jörn Engel
2005-04-20 15:20 ` Phillip Lougher
2005-04-20 21:33 ` Jörn Engel
2005-04-20 20:51 ` Phillip Lougher
2005-04-21 1:06 ` Jörn Engel
2005-04-21 6:36 ` Pekka Enberg
2005-04-21 6:48 ` Jörn Engel
2005-04-21 1:08 ` [PATCH 2/4] squashfs: kmalloc (less stack, less casts) Jörn Engel
2005-04-21 1:10 ` [PATCH 3/4] squashfs: (void*)ify squashfs_get_cached_block Jörn Engel
2005-04-21 1:11 ` [PATCH 4/4] squashfs: (void*)ify squashfs_read_data Jörn Engel
2005-04-22 7:20 ` Jörn Engel [this message]
2005-04-22 7:22 ` [PATCH 6/10] squashfs: conserve stack, remove casts Jörn Engel
2005-04-22 7:22 ` [PATCH 6/10] squashfs: remove one cast Jörn Engel
2005-04-22 7:23 ` [PATCH 8/10] squashfs: add swabbing infrastructure Jörn Engel
2005-04-22 7:24 ` [PATCH 9/10] squashfs: remove some more casts Jörn Engel
2005-04-22 7:25 ` [PATCH 9/10] squashfs: first use of swabbing Jörn Engel
2005-04-22 7:52 ` [PATCH 8/10] squashfs: add swabbing infrastructure Jörn Engel
2005-04-22 7:26 ` [PATCH 6/10] squashfs: remove one cast Jörn Engel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050422072037.GB10459@wohnheim.fh-wedel.de \
--to=joern@wohnheim.fh-wedel.de \
--cc=linux-kernel@vger.kernel.org \
--cc=phillip@lougher.demon.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®