Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / fs / efs / file.c
blob535881569e8b5eb9e9cf4f016be08dd2752db5f1
1 /*
2 * file.c
4 * Copyright (c) 1999 Al Smith
6 * Portions derived from work (c) 1995,1996 Christian Vogelgsang.
7 */
9 #include <linux/buffer_head.h>
10 <<<<<<< HEAD:fs/efs/file.c
11 #include <linux/efs_fs.h>
12 =======
13 #include "efs.h"
14 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:fs/efs/file.c
16 int efs_get_block(struct inode *inode, sector_t iblock,
17 struct buffer_head *bh_result, int create)
19 int error = -EROFS;
20 long phys;
22 if (create)
23 return error;
24 if (iblock >= inode->i_blocks) {
25 #ifdef DEBUG
27 * i have no idea why this happens as often as it does
29 printk(KERN_WARNING "EFS: bmap(): block %d >= %ld (filesize %ld)\n",
30 block,
31 inode->i_blocks,
32 inode->i_size);
33 #endif
34 return 0;
36 phys = efs_map_block(inode, iblock);
37 if (phys)
38 map_bh(bh_result, inode->i_sb, phys);
39 return 0;
42 int efs_bmap(struct inode *inode, efs_block_t block) {
44 if (block < 0) {
45 printk(KERN_WARNING "EFS: bmap(): block < 0\n");
46 return 0;
49 /* are we about to read past the end of a file ? */
50 if (!(block < inode->i_blocks)) {
51 #ifdef DEBUG
53 * i have no idea why this happens as often as it does
55 printk(KERN_WARNING "EFS: bmap(): block %d >= %ld (filesize %ld)\n",
56 block,
57 inode->i_blocks,
58 inode->i_size);
59 #endif
60 return 0;
63 return efs_map_block(inode, block);