[2.0.30] block_dev.c and Linux on Alpha

Michal Jaegermann (michal@ellpspace.math.ualberta.ca)
Wed, 9 Apr 1997 22:29:07 -0600 (MDT)


Recent changes in linux/fs/block_dev.c unfortunately conflicted
with Linux as used on 64-bit Alpah (c.f.
http://www.azstarnet.com/~axplinux/ for a complete set of "axp-diffs").
I include below differences between Intel and axp versions of
block_dev.c from 2.0.30; they are neutral on Intel but surely
are important on Alpha.

If you use these patches, then declarations of block_read and
block_write in include/linux/fs.h also have to be adjusted
accordingly.

Michal
michal@ellpspace.math.ualberta.ca

--- block_dev.c.intel Wed Apr 9 19:50:25 1997
+++ block_dev.c Wed Apr 9 20:35:08 1997
@@ -20,16 +20,16 @@
#define MAX_BUF_PER_PAGE (PAGE_SIZE / 512)
#define NBUF 64

-int block_write(struct inode * inode, struct file * filp,
- const char * buf, int count)
+long block_write(struct inode * inode, struct file * filp,
+ const char * buf, unsigned long count)
{
int blocksize, blocksize_bits, i, buffercount,write_error;
- int block, blocks;
+ long block, blocks;
loff_t offset;
- int chars;
- int written = 0;
+ long chars;
+ long written = 0;
struct buffer_head * bhlist[NBUF];
- unsigned int size;
+ unsigned long size;
kdev_t dev;
struct buffer_head * bh, *bufferlist[NBUF];
register char * p;
@@ -145,22 +145,22 @@
return written;
}

-int block_read(struct inode * inode, struct file * filp,
- char * buf, int count)
+long block_read(struct inode * inode, struct file * filp,
+ char * buf, unsigned long count)
{
unsigned int block;
loff_t offset;
int blocksize;
int blocksize_bits, i;
- unsigned int blocks, rblocks, left;
+ unsigned long blocks, rblocks, left;
int bhrequest, uptodate;
struct buffer_head ** bhb, ** bhe;
struct buffer_head * buflist[NBUF];
struct buffer_head * bhreq[NBUF];
- unsigned int chars;
+ unsigned long chars;
loff_t size;
kdev_t dev;
- int read;
+ long read;

dev = inode->i_rdev;
blocksize = BLOCK_SIZE;
@@ -182,13 +182,13 @@
if (offset > size)
left = 0;
/* size - offset might not fit into left, so check explicitly. */
- else if (size - offset > INT_MAX)
- left = INT_MAX;
+ else if (size - offset > LONG_MAX)
+ left = LONG_MAX;
else
left = size - offset;
if (left > count)
left = count;
- if (left <= 0)
+ if (!left)
return 0;
read = 0;
block = offset >> blocksize_bits;