[PATCH] C99-style named initializers for 2.4

Christoph Hellwig <[email protected]> Tue, 23 Jul 2002 17:18:03 +0200
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
C99-style initializers for the 2.4 tree.  Basically the same patch, but
it also renames jfs_sops to jfs_super_operations as in 2.5 and gets rid
of the DECLARE_FSTYPE_DEV macro in favour of declaring jfs_fs_type
directly (also as in 2.5).


Index: fs/jfs/file.c
===================================================================
RCS file: /usr/cvs/jfs/linux24/fs/jfs/file.c,v
retrieving revision 1.15
diff -u -r1.15 file.c
--- fs/jfs/file.c	19 Jun 2002 14:25:37 -0000	1.15
+++ fs/jfs/file.c	23 Jul 2002 15:14:23 -0000
@@ -48,15 +48,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.
@@ -101,5 +92,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/linux24/fs/jfs/inode.c,v
retrieving revision 1.31
diff -u -r1.31 inode.c
--- fs/jfs/inode.c	7 Jun 2002 18:48:49 -0000	1.31
+++ fs/jfs/inode.c	23 Jul 2002 15:14:23 -0000
@@ -331,13 +331,13 @@
 #endif				/* Kernel >= 2.4.15 */
 
 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,
+	.readpage	= jfs_readpage,
+	.writepage	= jfs_writepage,
+	.sync_page	= block_sync_page,
+	.prepare_write	= jfs_prepare_write,
+	.commit_write	= generic_commit_write,
+	.bmap		= jfs_bmap,
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,15))
-	direct_IO:	jfs_direct_IO,
+	.direct_IO	= jfs_direct_IO,
 #endif
 };
Index: fs/jfs/namei.c
===================================================================
RCS file: /usr/cvs/jfs/linux24/fs/jfs/namei.c,v
retrieving revision 1.33
diff -u -r1.33 namei.c
--- fs/jfs/namei.c	18 Jun 2002 22:03:41 -0000	1.33
+++ fs/jfs/namei.c	23 Jul 2002 15:14:24 -0000
@@ -1425,19 +1425,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/linux24/fs/jfs/super.c,v
retrieving revision 1.39
diff -u -r1.39 super.c
--- fs/jfs/super.c	20 Jun 2002 21:23:51 -0000	1.39
+++ fs/jfs/super.c	23 Jul 2002 15:14:25 -0000
@@ -34,6 +34,9 @@
 MODULE_AUTHOR("Steve Best/Dave Kleikamp/Barry Arndt, IBM");
 MODULE_LICENSE("GPL");
 
+static struct super_operations jfs_super_operations;
+static struct file_system_type jfs_fs_type;
+
 int jfs_stop_threads;
 static pid_t jfsIOthread;
 static pid_t jfsCommitThread;
@@ -201,17 +204,6 @@
 	return 0;
 }
 
-static struct super_operations jfs_sops = {
-	read_inode:	jfs_read_inode,
-	dirty_inode:	jfs_dirty_inode,
-	write_inode:	jfs_write_inode,
-	clear_inode:	jfs_clear_inode,
-	delete_inode:	jfs_delete_inode,
-	put_super:	jfs_put_super,
-	statfs:		jfs_statfs,
-	remount_fs:	jfs_remount,
-};
-
 static struct super_block *jfs_read_super(struct super_block *sb,
 					  void *data, int silent)
 {
@@ -260,7 +252,7 @@
 	if (rc)
 		goto out_free_inode;
 
-	sb->s_op = &jfs_sops;
+	sb->s_op = &jfs_super_operations;;
 	rc = jfs_mount(sb);
 	if (rc) {
 		if (!silent) {
@@ -333,7 +325,23 @@
 	return NULL;
 }
 
-static DECLARE_FSTYPE_DEV(jfs_fs_type, "jfs", jfs_read_super);
+static struct super_operations jfs_super_operations = {
+	.read_inode	= jfs_read_inode,
+	.dirty_inode	= jfs_dirty_inode,
+	.write_inode	= jfs_write_inode,
+	.clear_inode	= jfs_clear_inode,
+	.delete_inode	= jfs_delete_inode,
+	.put_super	= jfs_put_super,
+	.statfs		= jfs_statfs,
+	.remount_fs	= jfs_remount,
+};
+
+static struct file_system_type jfs_fs_type = {
+	.owner		= THIS_MODULE,
+	.name		= "jfs",
+	.read_super	= jfs_read_super,
+	.fs_flags	= FS_REQUIRES_DEV,
+};
 
 extern int metapage_init(void);
 extern int txInit(void);
Index: fs/jfs/symlink.c
===================================================================
RCS file: /usr/cvs/jfs/linux24/fs/jfs/symlink.c,v
retrieving revision 1.9
diff -u -r1.9 symlink.c
--- fs/jfs/symlink.c	7 Jun 2002 18:41:40 -0000	1.9
+++ fs/jfs/symlink.c	23 Jul 2002 15:14:25 -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,
+};
+