* better
[mascara-docs.git] / i386 / linux-2.3.21 / fs / efs / file.c
blobb86965f8fa8ed2e24f3acf9b6fa588cdc320e1ce
1 /*
2 * file.c
4 * Copyright (c) 1999 Al Smith
6 * Portions derived from work (c) 1995,1996 Christian Vogelgsang.
7 */
9 #include <linux/efs_fs.h>
11 int efs_get_block(struct inode *inode, long iblock,
12 struct buffer_head *bh_result, int create)
14 int error = -EROFS;
15 long phys;
17 if (create)
18 return error;
19 if (iblock >= inode->i_blocks) {
20 #ifdef DEBUG
22 * i have no idea why this happens as often as it does
24 printk(KERN_WARNING "EFS: bmap(): block %d >= %ld (filesize %ld)\n",
25 block,
26 inode->i_blocks,
27 inode->i_size);
28 #endif
29 return 0;
31 phys = efs_map_block(inode, iblock);
32 if (phys) {
33 bh_result->b_dev = inode->i_dev;
34 bh_result->b_blocknr = phys;
35 bh_result->b_state |= (1UL << BH_Mapped);
37 return 0;
40 int efs_bmap(struct inode *inode, efs_block_t block) {
42 if (block < 0) {
43 printk(KERN_WARNING "EFS: bmap(): block < 0\n");
44 return 0;
47 /* are we about to read past the end of a file ? */
48 if (!(block < inode->i_blocks)) {
49 #ifdef DEBUG
51 * i have no idea why this happens as often as it does
53 printk(KERN_WARNING "EFS: bmap(): block %d >= %ld (filesize %ld)\n",
54 block,
55 inode->i_blocks,
56 inode->i_size);
57 #endif
58 return 0;
61 return efs_map_block(inode, block);
64 static struct file_operations efs_file_operations = {
65 NULL, /* lseek */
66 generic_file_read, /* read */
67 NULL, /* write */
68 NULL, /* readdir */
69 NULL, /* poll */
70 NULL, /* ioctl */
71 generic_file_mmap, /* mmap */
72 NULL, /* open */
73 NULL, /* flush */
74 NULL, /* release */
75 NULL, /* fsync */
76 NULL, /* fasync */
77 NULL, /* check_media_change */
78 NULL /* revalidate */
81 struct inode_operations efs_file_inode_operations = {
82 &efs_file_operations, /* default file operations */
83 NULL, /* create */
84 NULL, /* lookup */
85 NULL, /* link */
86 NULL, /* unlink */
87 NULL, /* symlink */
88 NULL, /* mkdir */
89 NULL, /* rmdir */
90 NULL, /* mknod */
91 NULL, /* rename */
92 NULL, /* readlink */
93 NULL, /* follow_link */
94 efs_get_block, /* get_block */
95 block_read_full_page, /* readpage */
96 NULL, /* writepage */
97 NULL, /* flushpage */
98 NULL, /* truncate */
99 NULL, /* permission */
100 NULL, /* smap */
101 NULL /* revalidate */