patch-2.2.15 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: 145
- Date:
Fri Apr 21 12:46:45 2000
- Orig file:
v2.2.14/fs/qnx4/file.c
- Orig date:
Fri Mar 26 21:57:41 1999
diff -u --new-file --recursive --exclude-from ../../exclude v2.2.14/fs/qnx4/file.c linux/fs/qnx4/file.c
@@ -1,7 +1,7 @@
/*
* QNX4 file system, Linux implementation.
*
- * Version : 0.1
+ * Version : 0.2.1
*
* Using parts of the xiafs filesystem.
*
@@ -34,9 +34,8 @@
#define MAX(a,b) (((a)>(b))?(a):(b))
-static int qnx4_readpage(struct file *file, 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)
{
@@ -145,115 +144,27 @@
#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 */
+ mmap: generic_file_mmap,
#ifdef CONFIG_QNX4FS_RW
- qnx4_sync_file, /* fsync */
-#else
- NULL,
+ 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_readpage, /* readpage */
- NULL, /* writepage */
- qnx4_bmap, /* bmap */
+ default_file_ops: &qnx4_file_operations,
+ readpage: generic_readpage,
+ bmap: qnx4_bmap,
#ifdef CONFIG_QNX4FS_RW
- qnx4_truncate, /* truncate */
-#else
- NULL,
+ truncate: qnx4_truncate,
#endif
- NULL, /* permission */
- NULL /* smap */
};
-
-static int qnx4_readpage(struct file *file, struct page *page)
-{
- struct dentry *dentry = file->f_dentry;
- 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 offset=[%ld]\n", (long) page->offset));
-
- 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);
- set_bit(PG_locked, &page->flags);
- buf = page_address(page);
- clear_bit(PG_uptodate, &page->flags);
- clear_bit(PG_error, &page->flags);
- offset = page->offset;
-
- 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);
- }
- clear_bit(PG_locked, &page->flags);
- wake_up(&page->wait);
-/* 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)