Skip to contentSkip to conversation

Compatibility fixes for SLES10

PATCH In review Jeff Mahoney 2 participants 13 messages Jan 31, 2008 – Feb 1, 2008 OCFS2

lore
Share & tools
lore
#0 lore raw

cover Compatibility fixes for SLES10

Hi guys -

I just merged today's git tree against SLES10. There were a few errors and a few warnings that have been there all along. This patch set creates new checks to fix all of them.

-Jeff

--
Jeff Mahoney
SUSE Labs

#1 lore raw

PATCH 1/5 ocfs2: add compatibility for lockdep

SLES10 doesn't have lockdep support. This patch ifdefs out the lockdep annotations when lockdep isn't found.

---

 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/inode.c  |    4 ++++
 4 files changed, 14 insertions(+)
Config.make.in +1 -0
@@ -87,6 +87,7 @@ FILLDIR_T_WITH_INO_T = @FILLDIR_T_WITH_I
 INVALIDATEPAGE_RETURNS_INT = @INVALIDATEPAGE_RETURNS_INT@
 DIO_OLD_GET_BLOCKS = @DIO_OLD_GET_BLOCKS@
 HAS_SYSTEM_UTSNAME = @HAS_SYSTEM_UTSNAME@
+NO_LOCKDEP = @NO_LOCKDEP@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
configure.in +5 -0
@@ -379,6 +379,11 @@ OCFS2_CHECK_KERNEL([system_utsname in ut
   HAS_SYSTEM_UTSNAME=yes, , [^extern struct new_utsname system_utsname])
 AC_SUBST(HAS_SYSTEM_UTSNAME)
 
+NO_LOCKDEP=
+OCFS2_CHECK_KERNEL([linux/lockdep.h], lockdep.h, ,
+  NO_LOCKDEP=yes, [^struct lock_class {])
+AC_SUBST(NO_LOCKDEP)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
fs/ocfs2/Makefile +4 -0
@@ -136,6 +136,10 @@ ifdef DIO_OLD_GET_BLOCKS
 EXTRA_CFLAGS += -DDIO_OLD_GET_BLOCKS
 endif
 
+ifdef NO_LOCKDEP
+EXTRA_CFLAGS += -DNO_LOCKDEP
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
fs/ocfs2/inode.c +4 -0
@@ -60,7 +60,9 @@ struct ocfs2_find_inode_args
 	unsigned int	fi_sysfile_type;
 };
 
+#ifndef NO_LOCKDEP
 static struct lock_class_key ocfs2_sysfile_lock_key[NUM_SYSTEM_INODES];
+#endif
 
 static int ocfs2_read_locked_inode(struct inode *inode,
 				   struct ocfs2_find_inode_args *args);
@@ -205,9 +207,11 @@ static int ocfs2_init_locked_inode(struc
 
 	inode->i_ino = args->fi_ino;
 	OCFS2_I(inode)->ip_blkno = args->fi_blkno;
+#ifndef NO_LOCKDEP
 	if (args->fi_sysfile_type != 0)
 		lockdep_set_class(&inode->i_mutex,
 			&ocfs2_sysfile_lock_key[args->fi_sysfile_type]);
+#endif
 
 	mlog_exit(0);
 	return 0;
#2 lore raw

[Ocfs2-devel] Re: [patch 1/5] ocfs2: add compatibility for lockdep

Quoted 5 lines · Jeff Mahoney

SLES10 doesn't have lockdep support. This patch ifdefs out the lockdep annotations when lockdep isn't found.

Quoted 72 lines

---

 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/inode.c  |    4 ++++
 4 files changed, 14 insertions(+)
Config.make.in +1 -0
@@ -87,6 +87,7 @@ FILLDIR_T_WITH_INO_T = @FILLDIR_T_WITH_I
 INVALIDATEPAGE_RETURNS_INT = @INVALIDATEPAGE_RETURNS_INT@
 DIO_OLD_GET_BLOCKS = @DIO_OLD_GET_BLOCKS@
 HAS_SYSTEM_UTSNAME = @HAS_SYSTEM_UTSNAME@
+NO_LOCKDEP = @NO_LOCKDEP@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
configure.in +5 -0
@@ -379,6 +379,11 @@ OCFS2_CHECK_KERNEL([system_utsname in ut
   HAS_SYSTEM_UTSNAME=yes, , [^extern struct new_utsname system_utsname])
 AC_SUBST(HAS_SYSTEM_UTSNAME)
 
+NO_LOCKDEP=
+OCFS2_CHECK_KERNEL([linux/lockdep.h], lockdep.h, ,
+  NO_LOCKDEP=yes, [^struct lock_class {])
+AC_SUBST(NO_LOCKDEP)
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
fs/ocfs2/Makefile +4 -0
@@ -136,6 +136,10 @@ ifdef DIO_OLD_GET_BLOCKS
 EXTRA_CFLAGS += -DDIO_OLD_GET_BLOCKS
 endif
 
+ifdef NO_LOCKDEP
+EXTRA_CFLAGS += -DNO_LOCKDEP
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
fs/ocfs2/inode.c +4 -0
@@ -60,7 +60,9 @@ struct ocfs2_find_inode_args
 	unsigned int	fi_sysfile_type;
 };
 
+#ifndef NO_LOCKDEP
 static struct lock_class_key ocfs2_sysfile_lock_key[NUM_SYSTEM_INODES];
+#endif
 
 static int ocfs2_read_locked_inode(struct inode *inode,
 				   struct ocfs2_find_inode_args *args);
@@ -205,9 +207,11 @@ static int ocfs2_init_locked_inode(struc
 
 	inode->i_ino = args->fi_ino;
 	OCFS2_I(inode)->ip_blkno = args->fi_blkno;
+#ifndef NO_LOCKDEP
 	if (args->fi_sysfile_type != 0)
 		lockdep_set_class(&inode->i_mutex,
 			&ocfs2_sysfile_lock_key[args->fi_sysfile_type]);
+#endif
 
 	mlog_exit(0);
 	return 0;
#3 lore raw

PATCH 2/5 ocfs2: add compatibility for mandatory_lock()

In reply to Jeff Mahoney

SLES10 doesn't have a mandatory_lock() function, but does support IS_MANDATORY() and the associated functions.

This patch adds mandatory_lock() support.

---

 Config.make.in                       |    1 +
 configure.in                         |    6 ++++++
 fs/ocfs2/Makefile                    |    4 ++++
 kapi-compat/include/mandatory_lock.h |   27 +++++++++++++++++++++++++++
 4 files changed, 38 insertions(+)
Config.make.in +1 -0
@@ -88,6 +88,7 @@ INVALIDATEPAGE_RETURNS_INT = @INVALIDATE
 DIO_OLD_GET_BLOCKS = @DIO_OLD_GET_BLOCKS@
 HAS_SYSTEM_UTSNAME = @HAS_SYSTEM_UTSNAME@
 NO_LOCKDEP = @NO_LOCKDEP@
+NO_MANDATORY_LOCK = @NO_MANDATORY_LOCK@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
configure.in +6 -0
@@ -384,6 +384,12 @@ OCFS2_CHECK_KERNEL([linux/lockdep.h], lo
   NO_LOCKDEP=yes, [^struct lock_class {])
 AC_SUBST(NO_LOCKDEP)
 
+NO_MANDATORY_LOCK=
+OCFS2_CHECK_KERNEL([mandatory_lock() in fs.h], fs.h, ,
+  NO_MANDATORY_LOCK=yes, [^static inline int mandatory_lock(])
+AC_SUBST(NO_MANDATORY_LOCK)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS mandatory_lock.h"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
fs/ocfs2/Makefile +4 -0
@@ -140,6 +140,10 @@ ifdef NO_LOCKDEP
 EXTRA_CFLAGS += -DNO_LOCKDEP
 endif
 
+ifdef NO_MANDATORY_LOCK
+EXTRA_CFLAGS += -DNO_MANDATORY_LOCK
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
kapi-compat/include/mandatory_lock.h new file +27 -0
@@ -0,0 +1,27 @@
+#ifndef KAPI_MANDATORY_LOCK_H
+#define KAPI_MANDATORY_LOCK_H
+
+#ifdef NO_MANDATORY_LOCK
+#include <linux/fs.h>
+/*
+ * Candidates for mandatory locking have the setgid bit set
+ * but no group execute bit -  an otherwise meaningless combination.
+ */
+
+static inline int __mandatory_lock(struct inode *ino)
+{
+        return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
+}
+
+/*
+ * ... and these candidates should be on MS_MANDLOCK mounted fs,
+ * otherwise these will be advisory locks
+ */
+
+static inline int mandatory_lock(struct inode *ino)
+{
+        return IS_MANDLOCK(ino) && __mandatory_lock(ino);
+}
+#endif
+
+#endif /* KAPI_MANDATORY_LOCK_H */
#4 lore raw

[Ocfs2-devel] Re: [patch 2/5] ocfs2: add compatibility for mandatory_lock()

Quoted 7 lines · Jeff Mahoney

SLES10 doesn't have a mandatory_lock() function, but does support IS_MANDATORY() and the associated functions.

This patch adds mandatory_lock() support.

Quoted 79 lines

---

 Config.make.in                       |    1 +
 configure.in                         |    6 ++++++
 fs/ocfs2/Makefile                    |    4 ++++
 kapi-compat/include/mandatory_lock.h |   27 +++++++++++++++++++++++++++
 4 files changed, 38 insertions(+)
Config.make.in +1 -0
@@ -88,6 +88,7 @@ INVALIDATEPAGE_RETURNS_INT = @INVALIDATE
 DIO_OLD_GET_BLOCKS = @DIO_OLD_GET_BLOCKS@
 HAS_SYSTEM_UTSNAME = @HAS_SYSTEM_UTSNAME@
 NO_LOCKDEP = @NO_LOCKDEP@
+NO_MANDATORY_LOCK = @NO_MANDATORY_LOCK@
 
 OCFS_DEBUG = @OCFS_DEBUG@
 
configure.in +6 -0
@@ -384,6 +384,12 @@ OCFS2_CHECK_KERNEL([linux/lockdep.h], lo
   NO_LOCKDEP=yes, [^struct lock_class {])
 AC_SUBST(NO_LOCKDEP)
 
+NO_MANDATORY_LOCK=
+OCFS2_CHECK_KERNEL([mandatory_lock() in fs.h], fs.h, ,
+  NO_MANDATORY_LOCK=yes, [^static inline int mandatory_lock(])
+AC_SUBST(NO_MANDATORY_LOCK)
+KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS mandatory_lock.h"
+
 # using -include has two advantages:
 #  the source doesn't need to know to include compat headers
 #  the compat header file names don't go through the search path
fs/ocfs2/Makefile +4 -0
@@ -140,6 +140,10 @@ ifdef NO_LOCKDEP
 EXTRA_CFLAGS += -DNO_LOCKDEP
 endif
 
+ifdef NO_MANDATORY_LOCK
+EXTRA_CFLAGS += -DNO_MANDATORY_LOCK
+endif
+
 #
 # Since SUBDIRS means something to kbuild, define them safely.  Do not
 # include trailing slashes.
kapi-compat/include/mandatory_lock.h new file +27 -0
@@ -0,0 +1,27 @@
+#ifndef KAPI_MANDATORY_LOCK_H
+#define KAPI_MANDATORY_LOCK_H
+
+#ifdef NO_MANDATORY_LOCK
+#include <linux/fs.h>
+/*
+ * Candidates for mandatory locking have the setgid bit set
+ * but no group execute bit -  an otherwise meaningless combination.
+ */
+
+static inline int __mandatory_lock(struct inode *ino)
+{
+        return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
+}
+
+/*
+ * ... and these candidates should be on MS_MANDLOCK mounted fs,
+ * otherwise these will be advisory locks
+ */
+
+static inline int mandatory_lock(struct inode *ino)
+{
+        return IS_MANDLOCK(ino) && __mandatory_lock(ino);
+}
+#endif
+
+#endif /* KAPI_MANDATORY_LOCK_H */
#5 lore raw

PATCH 3/5 ocfs2: Add check for const file_operations

In reply to Jeff Mahoney

SLES10 doesn't have a const f_op in struct file. This patch adds a check.

---

 Config.make.in        |    1 +
 configure.in          |    5 +++++
 fs/ocfs2/Makefile     |    4 ++++
 fs/ocfs2/dlm/Makefile |    4 ++++
 fs/ocfs2/dlm/dlmfs.c  |    8 ++++++++
 fs/ocfs2/dlmglue.c    |    4 ++++
 fs/ocfs2/file.c       |    8 ++++++++
 fs/ocfs2/file.h       |    5 +++++
 8 files changed, 39 insertions(+)
Config.make.in +1 -0
index 5b58fe1..dc5431b 100644
@@ -72,6 +72,7 @@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@
 NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@
 SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@
 IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@
+FOP_IS_NOT_CONST = @FOP_IS_NOT_CONST@
 NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@
 NO_SPLICE_FROM_PIPE = @NO_SPLICE_FROM_PIPE@
 OLD_BIO_END_IO = @OLD_BIO_END_IO@
configure.in +5 -0
index d1ebeae..3d9e49f 100644
@@ -305,6 +305,11 @@ OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h,
   , IOP_IS_NOT_CONST=yes, [^.*const struct inode_operations.*\*i_op;])
 AC_SUBST(IOP_IS_NOT_CONST)
 
+FOP_IS_NOT_CONST=
+OCFS2_CHECK_KERNEL([f_op declared as const in struct file in fs.h], fs.h,
+  , FOP_IS_NOT_CONST=yes, [^.*const struct file_operations.*\*f_op;])
+AC_SUBST(FOP_IS_NOT_CONST)
+
 NO_VECTORIZED_AIO=
 OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h,
   , NO_VECTORIZED_AIO=yes, [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);])
fs/ocfs2/Makefile +4 -0
index b53630d..5750280 100644
@@ -84,6 +84,10 @@ ifdef IOP_IS_NOT_CONST
 EXTRA_CFLAGS += -DIOP_IS_NOT_CONST
 endif
 
+ifdef FOP_IS_NOT_CONST
+EXTRA_CFLAGS += -DFOP_IS_NOT_CONST
+endif
+
 ifdef NO_VECTORIZED_AIO
 CFLAGS_file.o += -DNO_VECTORIZED_AIO
 endif
fs/ocfs2/dlm/Makefile +4 -0
index 74bd019..4b718cf 100644
@@ -46,6 +46,10 @@ ifdef IOP_IS_NOT_CONST
 EXTRA_CFLAGS += -DIOP_IS_NOT_CONST
 endif
 
+ifdef FOP_IS_NOT_CONST
+EXTRA_CFLAGS += -DFOP_IS_NOT_CONST
+endif
+
 ifdef NO_VFSMOUNT_IN_GET_SB_BDEV
 EXTRA_CFLAGS += -DNO_VFSMOUNT_IN_GET_SB_BDEV
 endif
fs/ocfs2/dlm/dlmfs.c +8 -0
index ba35f76..f7e0263 100644
@@ -65,7 +65,11 @@ static struct super_operations dlmfs_ops;
 #else
 static const struct super_operations dlmfs_ops;
 #endif
+#ifdef FOP_IS_NOT_CONST
+static struct file_operations dlmfs_file_operations;
+#else
 static const struct file_operations dlmfs_file_operations;
+#endif
 #ifdef IOP_IS_NOT_CONST
 static struct inode_operations dlmfs_dir_inode_operations;
 static struct inode_operations dlmfs_root_inode_operations;
@@ -546,7 +550,11 @@ static int dlmfs_fill_super(struct super_block * sb,
 	return 0;
 }
 
+#ifdef FOP_IS_NOT_CONST
+static struct file_operations dlmfs_file_operations = {
+#else
 static const struct file_operations dlmfs_file_operations = {
+#endif
 	.open		= dlmfs_file_open,
 	.release	= dlmfs_file_release,
 	.read		= dlmfs_file_read,
fs/ocfs2/dlmglue.c +4 -0
index 9ce2881..04f9ec3 100644
@@ -2441,7 +2441,11 @@ out:
 	return ret;
 }
 
+#ifdef FOP_IS_NOT_CONST
+static struct file_operations ocfs2_dlm_debug_fops = {
+#else
 static const struct file_operations ocfs2_dlm_debug_fops = {
+#endif
 	.open =		ocfs2_dlm_debug_open,
 	.release =	ocfs2_dlm_debug_release,
 	.read =		seq_read,
fs/ocfs2/file.c +8 -0
index 40122fe..e068a76 100644
@@ -2488,7 +2488,11 @@ const struct inode_operations ocfs2_special_file_iops = {
 	.permission	= ocfs2_permission,
 };
 
+#ifdef FOP_IS_NOT_CONST
+struct file_operations ocfs2_fops = {
+#else
 const struct file_operations ocfs2_fops = {
+#endif
 	.llseek		= generic_file_llseek,
 	.read		= do_sync_read,
 	.write		= do_sync_write,
@@ -2509,7 +2513,11 @@ const struct file_operations ocfs2_fops = {
 #endif
 };
 
+#ifdef FOP_IS_NOT_CONST
+struct file_operations ocfs2_dops = {
+#else
 const struct file_operations ocfs2_dops = {
+#endif
 	.llseek		= generic_file_llseek,
 	.read		= generic_read_dir,
 	.readdir	= ocfs2_readdir,
fs/ocfs2/file.h +5 -0
index 8cf0821..2b118b8 100644
@@ -26,8 +26,13 @@
 #ifndef OCFS2_FILE_H
 #define OCFS2_FILE_H
 
+#ifdef FOP_IS_NOT_CONST
+extern struct file_operations ocfs2_fops;
+extern struct file_operations ocfs2_dops;
+#else
 extern const struct file_operations ocfs2_fops;
 extern const struct file_operations ocfs2_dops;
+#endif
 #ifdef IOP_IS_NOT_CONST
 extern struct inode_operations ocfs2_file_iops;
 extern struct inode_operations ocfs2_special_file_iops;
#6 lore raw

[Ocfs2-devel] Re: [patch 3/5] ocfs2: Add check for const file_operations

Quoted 4 lines · Jeff Mahoney

SLES10 doesn't have a const f_op in struct file. This patch adds a check.

Quoted 163 lines

---

 Config.make.in        |    1 +
 configure.in          |    5 +++++
 fs/ocfs2/Makefile     |    4 ++++
 fs/ocfs2/dlm/Makefile |    4 ++++
 fs/ocfs2/dlm/dlmfs.c  |    8 ++++++++
 fs/ocfs2/dlmglue.c    |    4 ++++
 fs/ocfs2/file.c       |    8 ++++++++
 fs/ocfs2/file.h       |    5 +++++
 8 files changed, 39 insertions(+)
Config.make.in +1 -0
index 5b58fe1..dc5431b 100644
@@ -72,6 +72,7 @@ NO_SHOULD_REMOVE_SUID = @NO_SHOULD_REMOVE_SUID@
 NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@
 SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@
 IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@
+FOP_IS_NOT_CONST = @FOP_IS_NOT_CONST@
 NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@
 NO_SPLICE_FROM_PIPE = @NO_SPLICE_FROM_PIPE@
 OLD_BIO_END_IO = @OLD_BIO_END_IO@
configure.in +5 -0
index d1ebeae..3d9e49f 100644
@@ -305,6 +305,11 @@ OCFS2_CHECK_KERNEL([i_op declared as const in struct inode in fs.h], fs.h,
   , IOP_IS_NOT_CONST=yes, [^.*const struct inode_operations.*\*i_op;])
 AC_SUBST(IOP_IS_NOT_CONST)
 
+FOP_IS_NOT_CONST=
+OCFS2_CHECK_KERNEL([f_op declared as const in struct file in fs.h], fs.h,
+  , FOP_IS_NOT_CONST=yes, [^.*const struct file_operations.*\*f_op;])
+AC_SUBST(FOP_IS_NOT_CONST)
+
 NO_VECTORIZED_AIO=
 OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h,
   , NO_VECTORIZED_AIO=yes, [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);])
fs/ocfs2/Makefile +4 -0
index b53630d..5750280 100644
@@ -84,6 +84,10 @@ ifdef IOP_IS_NOT_CONST
 EXTRA_CFLAGS += -DIOP_IS_NOT_CONST
 endif
 
+ifdef FOP_IS_NOT_CONST
+EXTRA_CFLAGS += -DFOP_IS_NOT_CONST
+endif
+
 ifdef NO_VECTORIZED_AIO
 CFLAGS_file.o += -DNO_VECTORIZED_AIO
 endif
fs/ocfs2/dlm/Makefile +4 -0
index 74bd019..4b718cf 100644
@@ -46,6 +46,10 @@ ifdef IOP_IS_NOT_CONST
 EXTRA_CFLAGS += -DIOP_IS_NOT_CONST
 endif
 
+ifdef FOP_IS_NOT_CONST
+EXTRA_CFLAGS += -DFOP_IS_NOT_CONST
+endif
+
 ifdef NO_VFSMOUNT_IN_GET_SB_BDEV
 EXTRA_CFLAGS += -DNO_VFSMOUNT_IN_GET_SB_BDEV
 endif
fs/ocfs2/dlm/dlmfs.c +8 -0
index ba35f76..f7e0263 100644
@@ -65,7 +65,11 @@ static struct super_operations dlmfs_ops;
 #else
 static const struct super_operations dlmfs_ops;
 #endif
+#ifdef FOP_IS_NOT_CONST
+static struct file_operations dlmfs_file_operations;
+#else
 static const struct file_operations dlmfs_file_operations;
+#endif
 #ifdef IOP_IS_NOT_CONST
 static struct inode_operations dlmfs_dir_inode_operations;
 static struct inode_operations dlmfs_root_inode_operations;
@@ -546,7 +550,11 @@ static int dlmfs_fill_super(struct super_block * sb,
 	return 0;
 }
 
+#ifdef FOP_IS_NOT_CONST
+static struct file_operations dlmfs_file_operations = {
+#else
 static const struct file_operations dlmfs_file_operations = {
+#endif
 	.open		= dlmfs_file_open,
 	.release	= dlmfs_file_release,
 	.read		= dlmfs_file_read,
fs/ocfs2/dlmglue.c +4 -0
index 9ce2881..04f9ec3 100644
@@ -2441,7 +2441,11 @@ out:
 	return ret;
 }
 
+#ifdef FOP_IS_NOT_CONST
+static struct file_operations ocfs2_dlm_debug_fops = {
+#else
 static const struct file_operations ocfs2_dlm_debug_fops = {
+#endif
 	.open =		ocfs2_dlm_debug_open,
 	.release =	ocfs2_dlm_debug_release,
 	.read =		seq_read,
fs/ocfs2/file.c +8 -0
index 40122fe..e068a76 100644
@@ -2488,7 +2488,11 @@ const struct inode_operations ocfs2_special_file_iops = {
 	.permission	= ocfs2_permission,
 };
 
+#ifdef FOP_IS_NOT_CONST
+struct file_operations ocfs2_fops = {
+#else
 const struct file_operations ocfs2_fops = {
+#endif
 	.llseek		= generic_file_llseek,
 	.read		= do_sync_read,
 	.write		= do_sync_write,
@@ -2509,7 +2513,11 @@ const struct file_operations ocfs2_fops = {
 #endif
 };
 
+#ifdef FOP_IS_NOT_CONST
+struct file_operations ocfs2_dops = {
+#else
 const struct file_operations ocfs2_dops = {
+#endif
 	.llseek		= generic_file_llseek,
 	.read		= generic_read_dir,
 	.readdir	= ocfs2_readdir,
fs/ocfs2/file.h +5 -0
index 8cf0821..2b118b8 100644
@@ -26,8 +26,13 @@
 #ifndef OCFS2_FILE_H
 #define OCFS2_FILE_H
 
+#ifdef FOP_IS_NOT_CONST
+extern struct file_operations ocfs2_fops;
+extern struct file_operations ocfs2_dops;
+#else
 extern const struct file_operations ocfs2_fops;
 extern const struct file_operations ocfs2_dops;
+#endif
 #ifdef IOP_IS_NOT_CONST
 extern struct inode_operations ocfs2_file_iops;
 extern struct inode_operations ocfs2_special_file_iops;
#7 lore raw

PATCH 4/5 ocfs2: Add check for const address_space_operations

In reply to Jeff Mahoney

SLES10 doesn't have a const a_ops in struct address_space. This patch adds a check.

---

 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/aops.c   |    4 ++++
 fs/ocfs2/inode.h  |    4 ++++
 5 files changed, 18 insertions(+)
Config.make.in +1 -0
index dc5431b..98bf410 100644
@@ -73,6 +73,7 @@ NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@
 SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@
 IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@
 FOP_IS_NOT_CONST = @FOP_IS_NOT_CONST@
+AOPS_IS_NOT_CONST = @AOPS_IS_NOT_CONST@
 NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@
 NO_SPLICE_FROM_PIPE = @NO_SPLICE_FROM_PIPE@
 OLD_BIO_END_IO = @OLD_BIO_END_IO@
configure.in +5 -0
index 3d9e49f..a4b3f0e 100644
@@ -310,6 +310,11 @@ OCFS2_CHECK_KERNEL([f_op declared as const in struct file in fs.h], fs.h,
   , FOP_IS_NOT_CONST=yes, [^.*const struct file_operations.*\*f_op;])
 AC_SUBST(FOP_IS_NOT_CONST)
 
+AOPS_IS_NOT_CONST=
+OCFS2_CHECK_KERNEL([a_ops declared as const in struct address_space in fs.h], fs.h,
+  , AOPS_IS_NOT_CONST=yes, [^.*const struct address_space_operations.*\*a_ops;])
+AC_SUBST(AOPS_IS_NOT_CONST)
+
 NO_VECTORIZED_AIO=
 OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h,
   , NO_VECTORIZED_AIO=yes, [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);])
fs/ocfs2/Makefile +4 -0
index 5750280..c8a81c4 100644
@@ -88,6 +88,10 @@ ifdef FOP_IS_NOT_CONST
 EXTRA_CFLAGS += -DFOP_IS_NOT_CONST
 endif
 
+ifdef AOPS_IS_NOT_CONST
+EXTRA_CFLAGS += -DAOPS_IS_NOT_CONST
+endif
+
 ifdef NO_VECTORIZED_AIO
 CFLAGS_file.o += -DNO_VECTORIZED_AIO
 endif
fs/ocfs2/aops.c +4 -0
index 54dd079..9b2a743 100644
@@ -1953,7 +1953,11 @@ int ocfs2_write_end(struct file *file, struct address_space *mapping,
 	return ret;
 }
 
+#ifdef AOPS_IS_NOT_CONST
+struct address_space_operations ocfs2_aops = {
+#else
 const struct address_space_operations ocfs2_aops = {
+#endif
 	.readpage	= ocfs2_readpage,
 	.readpages	= ocfs2_readpages,
 	.writepage	= ocfs2_writepage,
fs/ocfs2/inode.h +4 -0
index 390a855..01437ca 100644
@@ -111,7 +111,11 @@ static inline struct ocfs2_inode_info *OCFS2_I(struct inode *inode)
 
 extern struct kmem_cache *ocfs2_inode_cache;
 
+#ifdef AOPS_IS_NOT_CONST
+extern struct address_space_operations ocfs2_aops;
+#else
 extern const struct address_space_operations ocfs2_aops;
+#endif
 
 struct buffer_head *ocfs2_bread(struct inode *inode, int block,
 				int *err, int reada);
#8 lore raw

[Ocfs2-devel] Re: [patch 4/5] ocfs2: Add check for const address_space_operations

Quoted 5 lines · Jeff Mahoney

SLES10 doesn't have a const a_ops in struct address_space. This patch adds a check.

Quoted 87 lines

---

 Config.make.in    |    1 +
 configure.in      |    5 +++++
 fs/ocfs2/Makefile |    4 ++++
 fs/ocfs2/aops.c   |    4 ++++
 fs/ocfs2/inode.h  |    4 ++++
 5 files changed, 18 insertions(+)
Config.make.in +1 -0
index dc5431b..98bf410 100644
@@ -73,6 +73,7 @@ NO_GENERIC_SEGMENT_CHECKS = @NO_GENERIC_SEGMENT_CHECKS@
 SOP_IS_NOT_CONST = @SOP_IS_NOT_CONST@
 IOP_IS_NOT_CONST = @IOP_IS_NOT_CONST@
 FOP_IS_NOT_CONST = @FOP_IS_NOT_CONST@
+AOPS_IS_NOT_CONST = @AOPS_IS_NOT_CONST@
 NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@
 NO_SPLICE_FROM_PIPE = @NO_SPLICE_FROM_PIPE@
 OLD_BIO_END_IO = @OLD_BIO_END_IO@
configure.in +5 -0
index 3d9e49f..a4b3f0e 100644
@@ -310,6 +310,11 @@ OCFS2_CHECK_KERNEL([f_op declared as const in struct file in fs.h], fs.h,
   , FOP_IS_NOT_CONST=yes, [^.*const struct file_operations.*\*f_op;])
 AC_SUBST(FOP_IS_NOT_CONST)
 
+AOPS_IS_NOT_CONST=
+OCFS2_CHECK_KERNEL([a_ops declared as const in struct address_space in fs.h], fs.h,
+  , AOPS_IS_NOT_CONST=yes, [^.*const struct address_space_operations.*\*a_ops;])
+AC_SUBST(AOPS_IS_NOT_CONST)
+
 NO_VECTORIZED_AIO=
 OCFS2_CHECK_KERNEL([aio_read() in struct file_operations using iovec in fs.h], fs.h,
   , NO_VECTORIZED_AIO=yes, [ssize_t (\*aio_read) (struct kiocb \*, const struct iovec \*, unsigned long, loff_t);])
fs/ocfs2/Makefile +4 -0
index 5750280..c8a81c4 100644
@@ -88,6 +88,10 @@ ifdef FOP_IS_NOT_CONST
 EXTRA_CFLAGS += -DFOP_IS_NOT_CONST
 endif
 
+ifdef AOPS_IS_NOT_CONST
+EXTRA_CFLAGS += -DAOPS_IS_NOT_CONST
+endif
+
 ifdef NO_VECTORIZED_AIO
 CFLAGS_file.o += -DNO_VECTORIZED_AIO
 endif
fs/ocfs2/aops.c +4 -0
index 54dd079..9b2a743 100644
@@ -1953,7 +1953,11 @@ int ocfs2_write_end(struct file *file, struct address_space *mapping,
 	return ret;
 }
 
+#ifdef AOPS_IS_NOT_CONST
+struct address_space_operations ocfs2_aops = {
+#else
 const struct address_space_operations ocfs2_aops = {
+#endif
 	.readpage	= ocfs2_readpage,
 	.readpages	= ocfs2_readpages,
 	.writepage	= ocfs2_writepage,
fs/ocfs2/inode.h +4 -0
index 390a855..01437ca 100644
@@ -111,7 +111,11 @@ static inline struct ocfs2_inode_info *OCFS2_I(struct inode *inode)
 
 extern struct kmem_cache *ocfs2_inode_cache;
 
+#ifdef AOPS_IS_NOT_CONST
+extern struct address_space_operations ocfs2_aops;
+#else
 extern const struct address_space_operations ocfs2_aops;
+#endif
 
 struct buffer_head *ocfs2_bread(struct inode *inode, int block,
 				int *err, int reada);
#9 lore raw

PATCH 5/5 ocfs2: Add check for type of b_size in struct buffer_head

In reply to Jeff Mahoney

SLES10 has a b_size of type u32, not size_t in struct buffer_head. This patch adds a check.

---

 Config.make.in     |    1 +
 configure.in       |    5 +++++
 fs/ocfs2/Makefile  |    4 ++++
 fs/ocfs2/journal.c |    7 ++++++-
 4 files changed, 16 insertions(+), 1 deletion(-)
Config.make.in +1 -0
index 98bf410..24740c1 100644
@@ -77,6 +77,7 @@ AOPS_IS_NOT_CONST = @AOPS_IS_NOT_CONST@
 NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@
 NO_SPLICE_FROM_PIPE = @NO_SPLICE_FROM_PIPE@
 OLD_BIO_END_IO = @OLD_BIO_END_IO@
+B_SIZE_IS_U32 = @B_SIZE_IS_U32@
 NO_EXPORTFS_HEADER = @NO_EXPORTFS_HEADER@
 WRITEBACK_CONTROL_NO_RANGE_PREFIX = @WRITEBACK_CONTROL_NO_RANGE_PREFIX@
 NO_SYNC_FILE_FLAGS = @NO_SYNC_FILE_FLAGS@
configure.in +5 -0
index a4b3f0e..c783d4a 100644
@@ -331,6 +331,11 @@ OCFS2_CHECK_KERNEL([old bio_end_io_t in bio.h], bio.h,
   OLD_BIO_END_IO=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);])
 AC_SUBST(OLD_BIO_END_IO)
 
+B_SIZE_IS_U32=
+OCFS2_CHECK_KERNEL([b_size is u32 struct buffer_head in buffer_head.h], buffer_head.h,
+ B_SIZE_IS_U32=yes, , [^	u32 b_size;])
+AC_SUBST(B_SIZE_IS_U32)
+
 NO_EXPORTFS_HEADER=
 OCFS2_CHECK_KERNEL([exportfs.h], exportfs.h,
   , NO_EXPORTFS_HEADER=yes, [^struct export_operations {])
fs/ocfs2/Makefile +4 -0
index c8a81c4..af47a25 100644
@@ -100,6 +100,10 @@ ifdef NO_SPLICE_FROM_PIPE
 EXTRA_CFLAGS += -DNO_SPLICE_FROM_PIPE
 endif
 
+ifdef B_SIZE_IS_U32
+EXTRA_CFLAGS += -DB_SIZE_IS_U32
+endif
+
 ifdef NO_EXPORTFS_HEADER
 EXTRA_CFLAGS += -DNO_EXPORTFS_HEADER
 endif
fs/ocfs2/journal.c +6 -1
index 0332505..907a1bf 100644
@@ -235,7 +235,12 @@ int ocfs2_journal_access(handle_t *handle,
 	BUG_ON(!handle);
 	BUG_ON(!bh);
 
-	mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n",
+	mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = "
+#ifdef B_SIZE_IS_U32
+		   "%u\n",
+#else
+		   "%zu\n",
+#endif
 		   (unsigned long long)bh->b_blocknr, type,
 		   (type == OCFS2_JOURNAL_ACCESS_CREATE) ?
 		   "OCFS2_JOURNAL_ACCESS_CREATE" :
#10 lore raw

[Ocfs2-devel] Re: [patch 5/5] ocfs2: Add check for type of b_size in struct buffer_head

Quoted 5 lines · Jeff Mahoney

SLES10 has a b_size of type u32, not size_t in struct buffer_head. This patch adds a check.

Quoted 72 lines

---

 Config.make.in     |    1 +
 configure.in       |    5 +++++
 fs/ocfs2/Makefile  |    4 ++++
 fs/ocfs2/journal.c |    7 ++++++-
 4 files changed, 16 insertions(+), 1 deletion(-)
Config.make.in +1 -0
index 98bf410..24740c1 100644
@@ -77,6 +77,7 @@ AOPS_IS_NOT_CONST = @AOPS_IS_NOT_CONST@
 NO_VECTORIZED_AIO = @NO_VECTORIZED_AIO@
 NO_SPLICE_FROM_PIPE = @NO_SPLICE_FROM_PIPE@
 OLD_BIO_END_IO = @OLD_BIO_END_IO@
+B_SIZE_IS_U32 = @B_SIZE_IS_U32@
 NO_EXPORTFS_HEADER = @NO_EXPORTFS_HEADER@
 WRITEBACK_CONTROL_NO_RANGE_PREFIX = @WRITEBACK_CONTROL_NO_RANGE_PREFIX@
 NO_SYNC_FILE_FLAGS = @NO_SYNC_FILE_FLAGS@
configure.in +5 -0
index a4b3f0e..c783d4a 100644
@@ -331,6 +331,11 @@ OCFS2_CHECK_KERNEL([old bio_end_io_t in bio.h], bio.h,
   OLD_BIO_END_IO=yes, , [^typedef int (bio_end_io_t) (struct bio \*, unsigned int, int);])
 AC_SUBST(OLD_BIO_END_IO)
 
+B_SIZE_IS_U32=
+OCFS2_CHECK_KERNEL([b_size is u32 struct buffer_head in buffer_head.h], buffer_head.h,
+ B_SIZE_IS_U32=yes, , [^	u32 b_size;])
+AC_SUBST(B_SIZE_IS_U32)
+
 NO_EXPORTFS_HEADER=
 OCFS2_CHECK_KERNEL([exportfs.h], exportfs.h,
   , NO_EXPORTFS_HEADER=yes, [^struct export_operations {])
fs/ocfs2/Makefile +4 -0
index c8a81c4..af47a25 100644
@@ -100,6 +100,10 @@ ifdef NO_SPLICE_FROM_PIPE
 EXTRA_CFLAGS += -DNO_SPLICE_FROM_PIPE
 endif
 
+ifdef B_SIZE_IS_U32
+EXTRA_CFLAGS += -DB_SIZE_IS_U32
+endif
+
 ifdef NO_EXPORTFS_HEADER
 EXTRA_CFLAGS += -DNO_EXPORTFS_HEADER
 endif
fs/ocfs2/journal.c +6 -1
index 0332505..907a1bf 100644
@@ -235,7 +235,12 @@ int ocfs2_journal_access(handle_t *handle,
 	BUG_ON(!handle);
 	BUG_ON(!bh);
 
-	mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n",
+	mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = "
+#ifdef B_SIZE_IS_U32
+		   "%u\n",
+#else
+		   "%zu\n",
+#endif
 		   (unsigned long long)bh->b_blocknr, type,
 		   (type == OCFS2_JOURNAL_ACCESS_CREATE) ?
 		   "OCFS2_JOURNAL_ACCESS_CREATE" :
#11 lore raw
In reply to Jeff Mahoney

While I've not tested it, the patches here look good.

What about the breakup of the earlier patch? Will it be applied atop these?

Quoted 13 lines · Jeff Mahoney

Hi guys -

I just merged today's git tree against SLES10. There were a few errors and a few warnings that have been there all along. This patch set creates new checks to fix all of them.

-Jeff

--
Jeff Mahoney
SUSE Labs

#12 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 4 lines · Sunil Mushran

While I've not tested it, the patches here look good.

What about the breakup of the earlier patch? Will it be applied atop these?

Hahah, oops. Those are coming. I saw the code in my git tree and thought you'd applied them as a whole. It turns out I was just being monumentally stupid, since I had committed them locally to the tree to generate an easy diff. I thought it curious that the commit log had my local machines in the email address fields. I'll have those for you over the weekend. I apparently need more sleep. ;)

- -Jeff

Quoted 7 lines
Quoted 6 lines · Jeff Mahoney

Hi guys -

I just merged today's git tree against SLES10. There were a few errors and a few warnings that have been there all along. This patch set creates new checks to fix all of them.

Quoted 8 lines
Quoted 7 lines

-Jeff

Signature · 2 lines
Jeff Mahoney
SUSE Labs

- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFHo7ihLPWxlyuTD7IRApriAJ92MWOxXj3aXfxRsLzsl+5FN/sANwCfYeLM n9Yc+DI5Csum2xY0ftnAhGs=
=rOJW
-----END PGP SIGNATURE-----