LINUX: Build fixes for older kernels

Error and warning fixes for older kernels in osi_compat.h:

 - In afs_posix_test_lock, remove the assignment in the conditional to
   silence a warning

 - Call getsockopt for kernel_getsockopt, instead of setsockopt

 - Missing end brace in afs_try_to_freeze

 - Prototype find_exported_dentry, since Linux doesn't give us one

Change-Id: Iae56bb0b0405bfd23dfd68a22c1d7922663b1442
Reviewed-on: http://gerrit.openafs.org/2946
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Andrew Deason 2010-10-07 11:04:04 -05:00 committed by Derrick Brashear
parent e16d7b7d6a
commit e279ae77a7

View File

@ -46,7 +46,8 @@ afs_posix_test_lock(struct file *fp, struct file_lock *flp) {
} }
#elif defined(POSIX_TEST_LOCK_RETURNS_CONFLICT) #elif defined(POSIX_TEST_LOCK_RETURNS_CONFLICT)
struct file_lock *conflict; struct file_lock *conflict;
if (conflict = posix_test_lock(fp, flp)) { conflict = posix_test_lock(fp, flp);
if (conflict) {
locks_copy_lock(flp, conflict); locks_copy_lock(flp, conflict);
flp->fl_type = F_UNLCK; flp->fl_type = F_UNLCK;
} }
@ -257,7 +258,7 @@ kernel_getsockopt(struct socket *sockp, int level, int name, char *val,
int ret; int ret;
set_fs(get_ds()); set_fs(get_ds());
ret = sockp->ops->setsockopt(sockp, level, name, val, len); ret = sockp->ops->getsockopt(sockp, level, name, val, len);
set_fs(old_fs); set_fs(old_fs);
return ret; return ret;
@ -279,6 +280,7 @@ afs_try_to_freeze(void) {
# ifdef CONFIG_PM # ifdef CONFIG_PM
if (current->flags & PF_FREEZE) { if (current->flags & PF_FREEZE) {
refrigerator(PF_FREEZE); refrigerator(PF_FREEZE);
}
# endif # endif
} }
#endif #endif
@ -338,8 +340,17 @@ afs_init_sb_export_ops(struct super_block *sb) {
* decode_fh will call this function. If not defined for this FS, make * decode_fh will call this function. If not defined for this FS, make
* sure it points to the default * sure it points to the default
*/ */
if (!sb->s_export_op->find_exported_dentry) if (!sb->s_export_op->find_exported_dentry) {
/* Some kernels (at least 2.6.9) do not prototype find_exported_dentry,
* even though it is exported, so prototype it ourselves. Newer
* kernels do prototype it, but as long as our protoype matches the
* real one (the signature never changed before NEW_EXPORT_OPS came
* into play), there should be no problems. */
extern struct dentry * find_exported_dentry(struct super_block *sb, void *obj, void *parent,
int (*acceptable)(void *context, struct dentry *de),
void *context);
sb->s_export_op->find_exported_dentry = find_exported_dentry; sb->s_export_op->find_exported_dentry = find_exported_dentry;
}
#endif #endif
} }