File: 2x-cdrom-io-fix.patch

package info (click to toggle)
xpcd 2.08-11.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 652 kB
  • ctags: 556
  • sloc: ansic: 6,384; makefile: 227; sh: 204; perl: 12
file content (40 lines) | stat: -rw-r--r-- 1,199 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
*** fs/isofs/inode.c.~3~	Sat Mar 15 10:05:46 1997
--- fs/isofs/inode.c	Sun Mar 23 18:55:25 1997
***************
*** 532,537 ****
--- 532,565 ----
  		printk("_isofs_bmap: block<0");
  		return 0;
  	}
+ 
+ 	/*
+ 	 * If we are beyond the end of this file, don't give out any
+ 	 * blocks.
+ 	 */
+ 	if( (block << ISOFS_BUFFER_BITS(inode)) >= inode->i_size )
+ 	  {
+ 	    off_t	max_legal_read_offset;
+ 
+ 	    /*
+ 	     * If we are *way* beyond the end of the file, print a message.
+ 	     * Access beyond the end of the file up to the next page boundary
+ 	     * is normal because of the way the page cache works.
+ 	     * In this case, we just return 0 so that we can properly fill
+ 	     * the page with useless information without generating any
+ 	     * I/O errors.
+ 	     */
+ 	    max_legal_read_offset = (inode->i_size + PAGE_SIZE - 1) 
+ 	      & ~(PAGE_SIZE - 1);
+ 	    if( (block << ISOFS_BUFFER_BITS(inode)) >= max_legal_read_offset )
+ 	      {
+ 
+ 		printk("_isofs_bmap: block>= EOF(%d, %d)", block, 
+ 		       inode->i_size);
+ 	      }
+ 	    return 0;
+ 	  }
+ 
  	return (inode->u.isofs_i.i_first_extent >> ISOFS_BUFFER_BITS(inode)) + block;
  }
  
[05/13/1997 07:55:25]