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

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

diff -u --recursive --new-file v2.3.42/linux/fs/ext2/file.c linux/fs/ext2/file.c
@@ -21,13 +21,6 @@
 #include <linux/fs.h>
 #include <linux/sched.h>
 
-
-
-#define	NBUF	32
-
-#define MIN(a,b) (((a)<(b))?(a):(b))
-#define MAX(a,b) (((a)>(b))?(a):(b))
-
 static loff_t ext2_file_lseek(struct file *, loff_t, int);
 static int ext2_open_file (struct inode *, struct file *);
 
@@ -73,40 +66,6 @@
 	return offset;
 }
 
-static inline void remove_suid(struct inode *inode)
-{
-	unsigned int mode;
-
-	/* set S_IGID if S_IXGRP is set, and always set S_ISUID */
-	mode = (inode->i_mode & S_IXGRP)*(S_ISGID/S_IXGRP) | S_ISUID;
-
-	/* was any of the uid bits set? */
-	mode &= inode->i_mode;
-	if (mode && !capable(CAP_FSETID)) {
-		inode->i_mode &= ~mode;
-		mark_inode_dirty(inode);
-	}
-}
-
-/*
- * Write to a file (through the page cache).
- */
-static ssize_t
-ext2_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
-{
-	ssize_t retval;
-
-	retval = generic_file_write(file, buf, count,
-						 ppos, block_write_partial_page);
-	if (retval > 0) {
-		struct inode *inode = file->f_dentry->d_inode;
-		remove_suid(inode);
-		inode->i_ctime = inode->i_mtime = CURRENT_TIME;
-		mark_inode_dirty(inode);
-	}
-	return retval;
-}
-
 /*
  * Called when an inode is released. Note that this is different
  * from ext2_file_open: open gets called at every open, but release
@@ -137,37 +96,17 @@
  * the ext2 filesystem.
  */
 static struct file_operations ext2_file_operations = {
-	ext2_file_lseek,	/* lseek */
-	generic_file_read,	/* read */
-	ext2_file_write,	/* write */
-	NULL,			/* readdir - bad */
-	NULL,			/* poll - default */
-	ext2_ioctl,		/* ioctl */
-	generic_file_mmap,	/* mmap */
-	ext2_open_file,
-	NULL,			/* flush */
-	ext2_release_file,	/* release */
-	ext2_sync_file,		/* fsync */
-	NULL,			/* fasync */
+	llseek:		ext2_file_lseek,
+	read:		generic_file_read,
+	write:		generic_file_write,
+	ioctl:		ext2_ioctl,
+	mmap:		generic_file_mmap,
+	open:		ext2_open_file,
+	release:	ext2_release_file,
+	fsync:		ext2_sync_file,
 };
 
 struct inode_operations ext2_file_inode_operations = {
-	&ext2_file_operations,/* default file operations */
-	NULL,			/* create */
-	NULL,			/* lookup */
-	NULL,			/* link */
-	NULL,			/* unlink */
-	NULL,			/* symlink */
-	NULL,			/* mkdir */
-	NULL,			/* rmdir */
-	NULL,			/* mknod */
-	NULL,			/* rename */
-	NULL,			/* readlink */
-	NULL,			/* follow_link */
-	ext2_get_block,		/* get_block */
-	block_read_full_page,	/* readpage */
-	block_write_full_page,	/* writepage */
-	ext2_truncate,		/* truncate */
-	NULL,			/* permission */
-	NULL,			/* revalidate */
+	&ext2_file_operations,
+	truncate:	ext2_truncate,
 };

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