patch-2.3.43 linux/fs/affs/file.c

Next file: linux/fs/affs/inode.c
Previous file: linux/fs/affs/dir.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.42/linux/fs/affs/file.c linux/fs/affs/file.c
@@ -44,19 +44,10 @@
 static int alloc_ext_cache(struct inode *inode);
 
 static struct file_operations affs_file_operations = {
-	NULL,			/* lseek - default */
-	generic_file_read,	/* read */
-	affs_file_write,	/* write */
-	NULL,			/* readdir - bad */
-	NULL,			/* poll - default */
-	NULL,			/* ioctl - default */
-	generic_file_mmap,	/* mmap */
-	NULL,			/* no special open */
-	NULL,			/* flush */
-	NULL,			/* release */
-	file_fsync,		/* brute force, but works */
-	NULL,			/* fasync */
-	NULL			/* lock */
+	read:		generic_file_read,
+	write:		affs_file_write,
+	mmap:		generic_file_mmap,
+	fsync:		file_fsync,
 };
 
 struct inode_operations affs_file_inode_operations = {
@@ -72,28 +63,15 @@
 	NULL,			/* rename */
 	NULL,			/* readlink */
 	NULL,			/* follow_link */
-	affs_bmap,		/* get_block */
-	block_read_full_page,	/* readpage */
-	NULL,			/* writepage */
 	affs_truncate,		/* truncate */
 	NULL,			/* permission */
 	NULL			/* revalidate */
 };
 
 static struct file_operations affs_file_operations_ofs = {
-	NULL,			/* lseek - default */
-	affs_file_read_ofs,	/* read */
-	affs_file_write_ofs,	/* write */
-	NULL,			/* readdir - bad */
-	NULL,			/* poll - default */
-	NULL,			/* ioctl - default */
-	NULL,			/* mmap */
-	NULL,			/* no special open */
-	NULL,			/* flush */
-	NULL,			/* release */
-	file_fsync,		/* brute force, but works */
-	NULL,			/* fasync */
-	NULL			/* lock */
+	read:		affs_file_read_ofs,
+	write:		affs_file_write_ofs,
+	fsync:		file_fsync,
 };
 
 struct inode_operations affs_file_inode_operations_ofs = {
@@ -109,9 +87,6 @@
 	NULL,			/* rename */
 	NULL,			/* readlink */
 	NULL,			/* follow_link */
-	NULL,			/* get_block */
-	NULL,			/* readpage */
-	NULL,			/* writepage */
 	affs_truncate,		/* truncate */
 	NULL,			/* permission */
 	NULL			/* revalidate */
@@ -340,6 +315,37 @@
 	affs_brelse(bh);
 	return key;
 }
+
+/* AFFS is currently broken */
+static int affs_get_block(struct inode *inode, long block, struct buffer_head *bh, int create)
+{
+	BUG();
+	return -1;
+}
+static int affs_writepage(struct dentry *dentry, struct page *page)
+{
+	return block_write_full_page(page,affs_get_block);
+}
+static int affs_readpage(struct dentry *dentry, struct page *page)
+{
+	return block_read_full_page(page,affs_get_block);
+}
+static int affs_prepare_write(struct page *page, unsigned from, unsigned to)
+{
+	return cont_prepare_write(page,from,to,affs_get_block,
+		&((struct inode*)page->mapping->host)->u.affs_i.mmu_private);
+}
+static int _affs_bmap(struct address_space *mapping, long block)
+{
+	return generic_block_bmap(mapping,block,affs_get_block);
+}
+struct address_space_operations affs_aops = {
+	readpage: affs_readpage,
+	writepage: affs_writepage,
+	prepare_write: affs_prepare_write,
+	commit_write: generic_commit_write,
+	bmap: _affs_bmap
+};
 
 /* With the affs, getting a random block from a file is not
  * a simple business. Since this fs does not allow holes,

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)