[PATCH] C99-style named initializers for 2.5

Christoph Hellwig <[email protected]> Tue, 23 Jul 2002 16:47:26 +0200
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
and also move the operation vectors to the bottom of the file
everywhere.  A patch for 2.4 will follow later.


Index: fs/jfs/file.c
===================================================================
RCS file: /usr/cvs/jfs/linux25/fs/jfs/file.c,v
retrieving revision 1.10
diff -u -u -r1.10 file.c
--- fs/jfs/file.c	19 Jun 2002 14:25:37 -0000	1.10
+++ fs/jfs/file.c	23 Jul 2002 14:45:31 -0000
@@ -45,15 +45,6 @@
 	return rc ? -EIO : 0;
 }
 
-struct file_operations jfs_file_operations = {
-	open:		generic_file_open,
-	llseek:		generic_file_llseek,
-	write:		generic_file_write,
-	read:		generic_file_read,
-	mmap:		generic_file_mmap,
-	fsync:		jfs_fsync,
-};
-
 /*
  * Guts of jfs_truncate.  Called with locks already held.  Can be called
  * with directory for truncating directory index table.
@@ -98,5 +89,14 @@
 }
 
 struct inode_operations jfs_file_inode_operations = {
-	truncate:	jfs_truncate,
+	.truncate	= jfs_truncate,
+};
+
+struct file_operations jfs_file_operations = {
+	.open		= generic_file_open,
+	.llseek		= generic_file_llseek,
+	.write		= generic_file_write,
+	.read		= generic_file_read,
+	.mmap		= generic_file_mmap,
+	.fsync		= jfs_fsync,
 };
Index: fs/jfs/inode.c
===================================================================
RCS file: /usr/cvs/jfs/linux25/fs/jfs/inode.c,v
retrieving revision 1.15
diff -u -u -r1.15 inode.c
--- fs/jfs/inode.c	7 Jun 2002 18:41:40 -0000	1.15
+++ fs/jfs/inode.c	23 Jul 2002 14:45:32 -0000
@@ -301,11 +301,11 @@
 }
 
 struct address_space_operations jfs_aops = {
-	readpage:	jfs_readpage,
-	writepage:	jfs_writepage,
-	sync_page:	block_sync_page,
-	prepare_write:	jfs_prepare_write,
-	commit_write:	generic_commit_write,
-	bmap:		jfs_bmap,
-	direct_IO:	jfs_direct_IO,
+	.readpage	= jfs_readpage,
+	.writepage	= jfs_writepage,
+	.sync_page	= block_sync_page,
+	.prepare_write	= jfs_prepare_write,
+	.commit_write	= generic_commit_write,
+	.bmap		= jfs_bmap,
+	.direct_IO	= jfs_direct_IO,
 };
Index: fs/jfs/namei.c
===================================================================
RCS file: /usr/cvs/jfs/linux25/fs/jfs/namei.c,v
retrieving revision 1.17
diff -u -u -r1.17 namei.c
--- fs/jfs/namei.c	18 Jun 2002 22:03:42 -0000	1.17
+++ fs/jfs/namei.c	23 Jul 2002 14:45:33 -0000
@@ -1437,19 +1437,19 @@
 }
 
 struct inode_operations jfs_dir_inode_operations = {
-	create:		jfs_create,
-	lookup:		jfs_lookup,
-	link:		jfs_link,
-	unlink:		jfs_unlink,
-	symlink:	jfs_symlink,
-	mkdir:		jfs_mkdir,
-	rmdir:		jfs_rmdir,
-	mknod:		jfs_mknod,
-	rename:		jfs_rename,
+	.create		= jfs_create,
+	.lookup		= jfs_lookup,
+	.link		= jfs_link,
+	.unlink		= jfs_unlink,
+	.symlink	= jfs_symlink,
+	.mkdir		= jfs_mkdir,
+	.rmdir		= jfs_rmdir,
+	.mknod		= jfs_mknod,
+	.rename		= jfs_rename,
 };
 
 struct file_operations jfs_dir_operations = {
-	read:		generic_read_dir,
-	readdir:	jfs_readdir,
-	fsync:		jfs_fsync,
+	.read		= generic_read_dir,
+	.readdir	= jfs_readdir,
+	.fsync		= jfs_fsync,
 };
Index: fs/jfs/super.c
===================================================================
RCS file: /usr/cvs/jfs/linux25/fs/jfs/super.c,v
retrieving revision 1.27
diff -u -u -r1.27 super.c
--- fs/jfs/super.c	20 Jun 2002 21:23:52 -0000	1.27
+++ fs/jfs/super.c	23 Jul 2002 14:45:34 -0000
@@ -36,6 +36,10 @@
 
 static kmem_cache_t * jfs_inode_cachep;
 
+static struct super_operations jfs_super_operations;
+static struct export_operations jfs_export_operations;
+static struct file_system_type jfs_fs_type;
+
 int jfs_stop_threads;
 static pid_t jfsIOthread;
 static pid_t jfsCommitThread;
@@ -223,21 +227,6 @@
 	return 0;
 }
 
-static struct super_operations jfs_super_operations = {
-	alloc_inode:	jfs_alloc_inode,
-	destroy_inode:	jfs_destroy_inode,
-	dirty_inode:	jfs_dirty_inode,
-	write_inode:	jfs_write_inode,
-	delete_inode:	jfs_delete_inode,
-	put_super:	jfs_put_super,
-	statfs:		jfs_statfs,
-	remount_fs:	jfs_remount,
-};
-
-static struct export_operations jfs_export_operations = {
-	get_parent:	jfs_get_parent,
-};
-
 static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 {
 	struct jfs_sb_info *sbi;
@@ -362,12 +351,27 @@
 	return get_sb_bdev(fs_type, flags, dev_name, data, jfs_fill_super);
 }
 
+static struct super_operations jfs_super_operations = {
+	.alloc_inode	= jfs_alloc_inode,
+	.destroy_inode	= jfs_destroy_inode,
+	.dirty_inode	= jfs_dirty_inode,
+	.write_inode	= jfs_write_inode,
+	.delete_inode	= jfs_delete_inode,
+	.put_super	= jfs_put_super,
+	.statfs		= jfs_statfs,
+	.remount_fs	= jfs_remount,
+};
+
+static struct export_operations jfs_export_operations = {
+	.get_parent	= jfs_get_parent,
+};
+
 static struct file_system_type jfs_fs_type = {
-	owner:		THIS_MODULE,
-	name:		"jfs",
-	get_sb:		jfs_get_sb,
-	kill_sb:	kill_block_super,
-	fs_flags:	FS_REQUIRES_DEV,
+	.owner		= THIS_MODULE,
+	.name		= "jfs",
+	.get_sb		= jfs_get_sb,
+	.kill_sb	= kill_block_super,
+	.fs_flags	= FS_REQUIRES_DEV,
 };
 
 extern int metapage_init(void);
Index: fs/jfs/symlink.c
===================================================================
RCS file: /usr/cvs/jfs/linux25/fs/jfs/symlink.c,v
retrieving revision 1.4
diff -u -u -r1.4 symlink.c
--- fs/jfs/symlink.c	7 Jun 2002 18:41:41 -0000	1.4
+++ fs/jfs/symlink.c	23 Jul 2002 14:45:34 -0000
@@ -19,17 +19,6 @@
 #include <linux/fs.h>
 #include "jfs_incore.h"
 
-static int jfs_readlink(struct dentry *, char *buffer, int buflen);
-static int jfs_follow_link(struct dentry *dentry, struct nameidata *nd);
-
-/*
- * symlinks can't do much...
- */
-struct inode_operations jfs_symlink_inode_operations = {
-	readlink:	jfs_readlink,
-	follow_link:	jfs_follow_link,
-};
-
 static int jfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
 	char *s = JFS_IP(dentry->d_inode)->i_inline;
@@ -41,3 +30,9 @@
 	char *s = JFS_IP(dentry->d_inode)->i_inline;
 	return vfs_readlink(dentry, buffer, buflen, s);
 }
+
+struct inode_operations jfs_symlink_inode_operations = {
+	.readlink	= jfs_readlink,
+	.follow_link	= jfs_follow_link,
+};
+