lkml.org 
[lkml]   [2003]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patches in this message
/
Date
Subjectbuffer_head.b_bsize type
From
The buffer_head structure (include/linux/buffer_head.h) uses a u32 type 
while everywhere else (e.g. bread) the size parameter is of type int.

Currently on all architectures u32 is defined as unsigned int. We
should probably not be doing unsigned and signed swaps. And you should
never really have a negative size of a buffer.

So, there are two solutions: either change the buffer_head struct to be
int so it matches everywhere else, or change everywhere else.

The attached patch does the change in one place. Although perhaps
changing everywhere else would be better. Thoughts? I'm happy to make
up the patch if needed.


Applies cleanly to 2.5.69 and 2.5.70 and has been tested on i386
without causing any further problems (that I can see at least).

diff -ur linux-2.5.69-orig/include/linux/buffer_head.h
linux-2.5.69/include/linux/buffer_head.h
--- linux-2.5.69-orig/include/linux/buffer_head.h Mon May 5 09:52:49
2003
+++ linux-2.5.69/include/linux/buffer_head.h Fri May 16 12:05:16 2003
@@ -51,7 +51,7 @@
struct page *b_page; /* the page this bh is mapped to */

sector_t b_blocknr; /* block number */
- u32 b_size; /* block size */
+ int b_size; /* block size */
char *b_data; /* pointer to data block */

struct block_device *b_bdev;

diff -ur linux-2.5.69-orig/include/linux/buffer_head.h linux-2.5.69/include/linux/buffer_head.h
--- linux-2.5.69-orig/include/linux/buffer_head.h Mon May 5 09:52:49 2003
+++ linux-2.5.69/include/linux/buffer_head.h Fri May 16 12:05:16 2003
@@ -51,7 +51,7 @@
struct page *b_page; /* the page this bh is mapped to */

sector_t b_blocknr; /* block number */
- u32 b_size; /* block size */
+ int b_size; /* block size */
char *b_data; /* pointer to data block */

struct block_device *b_bdev;

------------------------------
Stewart Smith
stewartsmith@mac.com
Ph: +61 4 3884 4332
ICQ: 6734154
http://www.flamingspork.com/ http://www.linux.org.au
\
 
 \ /
  Last update: 2005-03-22 13:35    [W:1.286 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site