patch-2.3.35 linux/fs/qnx4/file.c
Next file: linux/fs/qnx4/inode.c
Previous file: linux/fs/qnx4/dir.c
Back to the patch index
Back to the overall index
- Lines: 161
- Date:
Wed Dec 22 17:38:27 1999
- Orig file:
v2.3.34/linux/fs/qnx4/file.c
- Orig date:
Mon Dec 20 18:48:22 1999
diff -u --recursive --new-file v2.3.34/linux/fs/qnx4/file.c linux/fs/qnx4/file.c
@@ -1,12 +1,12 @@
-/*
+/*
* QNX4 file system, Linux implementation.
- *
- * Version : 0.1
- *
+ *
+ * Version : 0.2.1
+ *
* Using parts of the xiafs filesystem.
- *
+ *
* History :
- *
+ *
* 25-05-1998 by Richard Frowijn : first release.
* 21-06-1998 by Frank Denis : wrote qnx4_readpage to use generic_file_read.
* 27-06-1998 by Frank Denis : file overwriting.
@@ -34,8 +34,6 @@
#define MAX(a,b) (((a)>(b))?(a):(b))
-static int qnx4_readpage(struct dentry *dentry, struct page *page);
-
#ifdef CONFIG_QNX4FS_RW
static ssize_t qnx4_file_write(struct file *filp, const char *buf,
size_t count, loff_t * ppos)
@@ -124,7 +122,7 @@
}
break;
}
- update_vm_cache(inode, pos, p, c);
+// update_vm_cache(inode, pos, p, c);
mark_buffer_uptodate(bh, 1);
mark_buffer_dirty(bh, 0);
brelse(bh);
@@ -145,112 +143,28 @@
#endif
/*
- * We have moostly NULL's here: the current defaults are ok for
+ * We have mostly NULL's here: the current defaults are ok for
* the qnx4 filesystem.
*/
static struct file_operations qnx4_file_operations =
{
- NULL, /* lseek - default */
- generic_file_read, /* read */
+ read: generic_file_read,
#ifdef CONFIG_QNX4FS_RW
- qnx4_file_write, /* write */
-#else
- NULL,
+ write: qnx4_file_write,
#endif
- NULL, /* readdir - bad */
- NULL, /* poll - default */
- NULL, /* ioctl - default */
- generic_file_mmap, /* mmap */
- NULL, /* no special open is needed */
- NULL, /* no special flush code */
- NULL, /* release */
-#ifdef CONFIG_QNX4FS_RW
- qnx4_sync_file, /* fsync */
-#else
- NULL,
+ mmap: generic_file_mmap,
+#ifdef CONFIG_QNX4FS_RW
+ fsync: qnx4_sync_file,
#endif
- NULL, /* fasync */
- NULL, /* check_media_change */
- NULL, /* revalidate */
- NULL /* lock */
};
struct inode_operations qnx4_file_inode_operations =
{
- &qnx4_file_operations, /* default file operations */
- NULL, /* create? It's not a directory */
- NULL, /* lookup */
- NULL, /* link */
- NULL, /* unlink */
- NULL, /* symlink */
- NULL, /* mkdir */
- NULL, /* rmdir */
- NULL, /* mknod */
- NULL, /* rename */
- NULL, /* readlink */
- NULL, /* follow_link */
- qnx4_bmap, /* get_block */
- qnx4_readpage, /* readpage */
- NULL, /* writepage */
+ default_file_ops: &qnx4_file_operations,
+ get_block: qnx4_get_block,
+ readpage: block_read_full_page,
#ifdef CONFIG_QNX4FS_RW
- qnx4_truncate, /* truncate */
-#else
- NULL,
+ writepage: block_write_full_page,
+ truncate: qnx4_truncate,
#endif
- NULL, /* permission */
- NULL /* revalidate */
};
-
-static int qnx4_readpage(struct dentry *dentry, struct page *page)
-{
- struct inode *inode = dentry->d_inode;
- struct qnx4_inode_info *qnx4_ino = &inode->u.qnx4_i;
- unsigned long buf;
- unsigned long offset, avail, readlen;
- unsigned long start;
- unsigned long count;
- struct buffer_head *bh;
- int res = -EIO;
-
- QNX4DEBUG(("qnx4: readpage index=[%ld]\n", (long) page->index));
-
- if (qnx4_ino->i_xblk != 0) {
- printk("qnx4: sorry, this file is extended, don't know how to handle it (yet) !\n");
- return -EIO;
- }
- atomic_inc(&page->count);
- buf = page_address(page);
- clear_bit(PG_uptodate, &page->flags);
- clear_bit(PG_error, &page->flags);
- offset = page->index<<PAGE_SHIFT;
-
- if (offset < inode->i_size) {
- res = 0;
- avail = inode->i_size - offset;
- readlen = MIN(avail, PAGE_SIZE);
- start = qnx4_ino->i_first_xtnt.xtnt_blk + (offset >> 9) - 1;
- count = PAGE_SIZE / QNX4_BLOCK_SIZE;
- do {
- QNX4DEBUG(("qnx4: reading page starting at [%ld]\n", (long) start));
- if ((bh = bread(inode->i_dev, start, QNX4_BLOCK_SIZE)) == NULL) {
- printk("qnx4: data corrupted or I/O error.\n");
- res = -EIO;
- } else {
- memcpy((void *) buf, bh->b_data, QNX4_BLOCK_SIZE);
- }
- buf += QNX4_BLOCK_SIZE;
- start++;
- count--;
- } while (count != 0);
- }
- if (res != 0) {
- set_bit(PG_error, &page->flags);
- memset((void *) buf, 0, PAGE_SIZE);
- } else {
- set_bit(PG_uptodate, &page->flags);
- }
- UnlockPage(page);
-/* free_page(buf); */
-
- return res;
-}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)